function user_is_blocked in Drupal 8
Same name and namespace in other branches
- 4 modules/user.module \user_is_blocked()
- 5 modules/user/user.module \user_is_blocked()
- 6 modules/user/user.module \user_is_blocked()
- 7 modules/user/user.module \user_is_blocked()
- 9 core/modules/user/user.module \user_is_blocked()
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.
2 calls to user_is_blocked()
- UserAuthenticationController::userIsBlocked in core/
modules/ user/ src/ Controller/ UserAuthenticationController.php - Verifies if the user is blocked.
- UserLoginForm::validateName in core/
modules/ user/ src/ Form/ UserLoginForm.php - Sets an error if supplied username has been blocked.
File
- core/
modules/ user/ user.module, line 392 - Enables the user registration and login system.
Code
function user_is_blocked($name) {
return (bool) \Drupal::entityQuery('user')
->accessCheck(FALSE)
->condition('name', $name)
->condition('status', 0)
->execute();
}