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 362
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();
}
doc_Drupal
2016-10-29 09:53:15
Comments
Leave a Comment

Please login to continue.