From 767c2020d015c76a581460d89f693ad0ade0ddc1 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 31 Jul 2016 12:52:00 +0200 Subject: [PATCH] Add TUserLookupPageHandler --- .../handler/TUserLookupPageHandler.class.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php diff --git a/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php b/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php new file mode 100644 index 0000000000..c82ea8e08c --- /dev/null +++ b/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php @@ -0,0 +1,35 @@ + + * @package WoltLabSuite\Core\System\Page\Handler + * @since 3.0 + */ +trait TUserLookupPageHandler { + /** + * @see ILookupPageHandler::lookup() + */ + public function lookup($searchString) { + $userList = new UserProfileList(); + $userList->getConditionBuilder()->add('user_table.username LIKE ?', ['%' . $searchString . '%']); + $userList->readObjects(); + + $results = []; + foreach ($userList as $user) { + $results[] = [ + 'image' => $user->getAvatar()->getImageTag(48), + 'link' => $user->getLink(), + 'objectID' => $user->userID, + 'title' => $user->username + ]; + } + + return $results; + } +} -- 2.20.1