You are here

function administerusersbyrole_user in Administer Users by Role 6

Same name and namespace in other branches
  1. 5 administerusersbyrole.module \administerusersbyrole_user()

Implements hook_user().

File

./administerusersbyrole.module, line 149
Non-displayable characters.

Code

function administerusersbyrole_user($op, &$edit, &$account, $category = NULL) {
  if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install') {
    return;
  }
  if ($op === 'update' && $category === 'account') {
    if (!_administerusersbyrole_can_edit_user($account)) {
      if (isset($edit['status'])) {
        $action = $edit['status'] ? t('unblock') : t('block');
        drupal_set_message(t('You do not have permission to @action %user.', array(
          '@action' => $action,
          '%user' => $account->name,
        )), 'error');
        unset($edit['status']);
      }
    }
  }
}