You are here

function administerusersbyrole_user in Administer Users by Role 5

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

File

./administerusersbyrole.module, line 118
Allows users with 'administer users' permission and a role (specified in 'Access control') to edit/delete other users with a specified role. If the user being edited has multiple roles, the user doing the editing must have…

Code

function administerusersbyrole_user($op, &$edit, &$account, $category = NULL) {
  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']);
      }
    }
  }
}