function role_watchdog_user_edit_submit in Role Watchdog 5
Implementation of hook_form_submit()
1 call to role_watchdog_user_edit_submit()
- role_watchdog_user in ./
role_watchdog.module - Implementation of hook_user().
File
- ./
role_watchdog.module, line 111 - Logs changes to user roles.
Code
function role_watchdog_user_edit_submit($uid, &$form, $account) {
$old_roles = array_keys($account->roles);
$new_roles = array_keys($form['roles']);
//is role added?
foreach ($new_roles as $rid) {
$count += _role_watchdog_add_role($rid, $old_roles, $account);
}
//is role removed?
foreach ($old_roles as $rid) {
$count += _role_watchdog_remove_role($rid, $new_roles, $account, NOT_IN_ARRAY);
}
_role_watchdog_set_message($count);
}