From ce8b814182333fefc887d8686f3794418173856f Mon Sep 17 00:00:00 2001 From: MC-brunomendes <42571547+MC-brunomendes@users.noreply.github.com> Date: Fri, 19 Nov 2021 17:19:25 +0000 Subject: [PATCH] Update hook.php If the user doesn't exists on database it doesn't show anything --- hook.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hook.php b/hook.php index d31f44b..9e7ce8b 100644 --- a/hook.php +++ b/hook.php @@ -43,18 +43,19 @@ function plugin_remotesupport_postinit() { $requester = $row['users_id']; // select id, name, users_id from glpi_computers where users_id = 178; - $req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester]]); - $url = ""; - - while ($row2 = $req2->next()){ - $url .= "
  • " . $row2['name'] . "
  • "; - } - - if ($url != ""){ - echo "
    "; - } + if ($row['users_id'] != 0) { + $req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester]]); + $url = ""; + + while ($row2 = $req2->next()){ + $url .= "
  • "; + } + } } } ?>