You are here

public static function UserRestrictions::getInstanceByMask in User restrictions 7

2 calls to UserRestrictions::getInstanceByMask()
user_restrictions_unblock_mail in ./user_restrictions.rules.inc
Rules callback to unblock an email.
user_restrictions_unblock_name in ./user_restrictions.rules.inc
Rules callback to unblock a username.

File

./user_restrictions.classes.inc, line 121
Contains the classes used by the User restrictions module.

Class

UserRestrictions
The main class used by the User Restrictions module.

Code

public static function getInstanceByMask($type, $mask) {
  $result = db_query('SELECT urid FROM {user_restrictions} WHERE type = :type AND mask = :mask', array(
    ':type' => $type,
    'mask' => $mask,
  ));
  if ($result) {
    $record = $result
      ->fetchColumn();
    $instance = self::getInstance($record);
  }
  else {
    $instance = new UserRestrictions();
  }
  return empty($instance) ? FALSE : $instance;
}