mirror of
https://github.com/getgrav/grav.git
synced 2025-12-07 00:09:57 +01:00
Imroved UserIndex:find() to only search user if query isn't empty
This commit is contained in:
@@ -80,6 +80,7 @@ class UserIndex extends FlexIndex
|
||||
*/
|
||||
public function find($query, $fields = ['username', 'email']): UserInterface
|
||||
{
|
||||
if (is_string($query) && $query !== '') {
|
||||
foreach ((array)$fields as $field) {
|
||||
if ($field === 'key') {
|
||||
$user = $this->get($query);
|
||||
@@ -98,6 +99,7 @@ class UserIndex extends FlexIndex
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user