function user_is_blocked

user_is_blocked($name)

Checks for usernames blocked by user administration.

Parameters

string $name: A string containing a name of the user.

Return value

bool TRUE if the user is blocked, FALSE otherwise.

File

core/modules/user/user.module, line 360
Enables the user registration and login system.

Code

function user_is_blocked($name) {
  return (bool) \Drupal::entityQuery('user')
    ->condition('name', $name)
    ->condition('status', 0)
    ->execute();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!user!user.module/function/user_is_blocked/8.1.x