You are here

function social_user_is_blocked in Open Social 8.4

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  2. 8 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  3. 8.2 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  4. 8.3 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  5. 8.5 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  6. 8.6 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  7. 8.7 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  8. 8.8 modules/social_features/social_user/social_user.module \social_user_is_blocked()
  9. 10.3.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
  10. 10.0.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
  11. 10.1.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
  12. 10.2.x modules/social_features/social_user/social_user.module \social_user_is_blocked()

Check if an users with the input field for name or mail field is blocked.

Parameters

string $name_or_mail: Username or email address.

Return value

bool TRUE if blocked FALSE if not blocked

1 call to social_user_is_blocked()
SocialUserLoginForm::validateNameMail in modules/social_features/social_user/src/Form/SocialUserLoginForm.php
Sets an error if supplied username or mail has been blocked.

File

modules/social_features/social_user/social_user.module, line 245
The social user module alterations.

Code

function social_user_is_blocked($name_or_mail) {
  $is_blocked_name = (bool) \Drupal::entityQuery('user')
    ->condition('name', $name_or_mail)
    ->condition('status', 0)
    ->execute();
  $is_blocked_mail = (bool) \Drupal::entityQuery('user')
    ->condition('mail', $name_or_mail)
    ->condition('status', 0)
    ->execute();
  if ($is_blocked_name || $is_blocked_mail) {
    return TRUE;
  }
  return FALSE;
}