You are here

function user_restrictions_user_restrictions_info in User restrictions 7

Implements hook_user_restrictions_info().

File

./user_restrictions.module, line 91
Specifies rules for restricting the data users can set for their accounts.

Code

function user_restrictions_user_restrictions_info($id, $arg1 = NULL, $arg2 = NULL) {
  switch ($id) {
    case 'fields':
      switch ($arg2) {
        case 'check_mail':
          return array(
            'mail' => $arg1['values']['value'],
          );
        case 'check_name':
          return array(
            'name' => $arg1['values']['value'],
          );
        case 'login':
          $account = user_load($arg1['uid']);
          return array(
            'name' => $account->name,
          );
        case 'profile':
          if (isset($arg1['values']['mail'])) {
            return array(
              'mail' => $arg1['values']['mail'],
              'name' => $arg1['values']['name'],
            );
          }
          else {
            return array(
              'mail' => $arg1['user']->mail,
              'name' => $arg1['user']->name,
            );
          }
        case 'register':
          return array(
            'mail' => $arg1['values']['mail'],
            'name' => $arg1['values']['name'],
          );
      }
      break;
    case 'status options':
      return array(
        t('Denied'),
        t('Allowed'),
      );
    case 'type options':
      return array(
        'mail' => t('Email'),
        'name' => t('Username'),
      );
    default:
      watchdog('user_restrictions', 'got an unexpected id value in user_restrictions_user_restrictions_info ' . print_r($id, TRUE), NULL, WATCHDOG_ERROR);
  }
}