use wcf\data\user\group\UserGroup;
use wcf\data\user\User;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
/**
* ACP search result provider implementation for users.
*
- * @author Matthias Schmidt
- * @copyright 2001-2019 WoltLab GmbH
+ * @author Joshua Ruesweg, Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\System\Search\Acp
*/
return [];
}
- $results = [];
+ $conditionBuilder = new PreparedStatementConditionBuilder(true, 'OR');
+ $conditionBuilder->add("username LIKE ?", [[$query . '%']]);
+
+ if (WCF::getSession()->getPermission('admin.user.canEditMailAddress')) {
+ $conditionBuilder->add("email LIKE ?", [[$query . '%']]);
+ }
$sql = "SELECT *
FROM wcf" . WCF_N . "_user
- WHERE username LIKE ?";
+ " . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([$query . '%']);
+ $statement->execute($conditionBuilder->getParameters());
+
+ $results = [];
/** @var User $user */
while ($user = $statement->fetchObject(User::class)) {