function social_user_is_blocked in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.2 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.3 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.4 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.5 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.7 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 8.8 modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 10.3.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 10.0.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 10.1.x modules/social_features/social_user/social_user.module \social_user_is_blocked()
- 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 342 - 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;
}