You are here

public static function CleantalkFuncs::_cleantalk_user_has_role_id in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_cleantalk_user_has_role_id()
  2. 9.1.x src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_cleantalk_user_has_role_id()
1 call to CleantalkFuncs::_cleantalk_user_has_role_id()
CleantalkFuncs::_cleantalk_check_spam in src/CleantalkFuncs.php
Cleantalk inner function - performs antispam checking.

File

src/CleantalkFuncs.php, line 749

Class

CleantalkFuncs
Cleantalk class create request

Namespace

Drupal\cleantalk

Code

public static function _cleantalk_user_has_role_id($role_id, $user = NULL) {
  $roles = \Drupal::currentUser()
    ->getRoles();
  if (is_array($roles) && in_array($role_id, $roles)) {
    return TRUE;
  }
  return FALSE;
}