function user_is_blocked

Same name in other branches
  1. 7.x modules/user/user.module \user_is_blocked()
  2. 9 core/modules/user/user.module \user_is_blocked()
  3. 8.9.x core/modules/user/user.module \user_is_blocked()
  4. 10 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.

Deprecated

in drupal:11.0.0 and is removed from drupal:12.0.0. Use Drupal\user\UserInterface::isBlocked() instead.

See also

https://www.drupal.org/node/3411040

1 call to user_is_blocked()
UserAuthenticationController::userIsBlocked in core/modules/user/src/Controller/UserAuthenticationController.php
Verifies if the user is blocked.

File

core/modules/user/user.module, line 235

Code

function user_is_blocked($name) {
    @trigger_error('user_is_blocked() is deprecated in drupal:11.0.0 and is removed from drupal:12.0.0. Use \\Drupal\\user\\UserInterface::isBlocked() instead. See https://www.drupal.org/node/3411040', E_USER_DEPRECATED);
    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.