function user_is_blocked
Same name in other branches
- 7.x modules/user/user.module \user_is_blocked()
- 8.9.x core/modules/user/user.module \user_is_blocked()
- 10 core/modules/user/user.module \user_is_blocked()
- 11.x 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 293
Code
function user_is_blocked($name) {
return (bool) \Drupal::entityQuery('user')->accessCheck(FALSE)
->condition('name', $name)
->condition('status', 0)
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.