Answer the question
In order to leave comments, you need to log in
How to filter CUser::GetList by several indexes at once?
The input field contains a string - full name, email or login. How to get a list of users whose search expression occurs in at least one index?
If I specify
$filter = Array (
"LOGIN" => 'ключевые | слова',
"NAME" => 'ключевые | слова',
"EMAIL" => 'ключевые | слова'
);
Answer the question
In order to leave comments, you need to log in
$filter = Array (
"LOGIC"=>"OR",
array( "LOGIN" => 'ключевые | слова'),
array( "NAME" => 'ключевые | слова'),
array( "EMAIL" => 'ключевые | слова')
);
Unfortunately, only through query
$connection = Bitrix\Main\Application::getConnection();
$sqlHelper = $connection->getSqlHelper();
$sql = "SELECT * FROM b_user WHERE
LOGIN = '".$sqlHelper->forSql($keyw)."'
OR EMAIL = '".$sqlHelper->forSql($keyw)."'
OR NAME = '".$sqlHelper->forSql($keyw)."'
";
$recordset = $connection->query($sql);
if ($record = $recordset->fetch())
{
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question