You are here

function _role_watchdog_remove_role in Role Watchdog 5

Same name and namespace in other branches
  1. 6.2 role_watchdog.module \_role_watchdog_remove_role()
  2. 6 role_watchdog.module \_role_watchdog_remove_role()
  3. 7.2 role_watchdog.module \_role_watchdog_remove_role()
  4. 7 role_watchdog.module \_role_watchdog_remove_role()

Internal function

Handles removal of roles.

2 calls to _role_watchdog_remove_role()
role_watchdog_user_admin_account_submit in ./role_watchdog.module
Implementation of hook_form_submit()
role_watchdog_user_edit_submit in ./role_watchdog.module
Implementation of hook_form_submit()

File

./role_watchdog.module, line 172
Logs changes to user roles.

Code

function _role_watchdog_remove_role($rid, $old_roles, $account, $in_array = TRUE) {
  if ($rid > 2 && (in_array($rid, $old_roles) xor !$in_array)) {
    global $user;
    $roles = user_roles();
    $message = t('%user removed role %role from %account', array(
      '%user' => $user->name,
      '%role' => $roles[$rid],
      '%account' => $account->name,
    ));
    watchdog('user', $message);
    _role_watchdog_notification($rid, $message);
    return 1;
  }
  return 0;
}