Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. user.module

function 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 106

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();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal