function privatemsg_user_update in Privatemsg 7.2
Same name and namespace in other branches
- 7 privatemsg.module \privatemsg_user_update()
Implements hook_user_update().
1 call to privatemsg_user_update()
- privatemsg_user_insert in ./
privatemsg.module - Implements hook_user_insert().
File
- ./
privatemsg.module, line 1441 - Allows users to send private messages to other users.
Code
function privatemsg_user_update(&$edit, $account, $category) {
if (isset($edit['pm_enable']) && (user_access('write privatemsg') || user_access('read privatemsg')) && user_access('allow disabling privatemsg') && privatemsg_allow_disable($account)) {
$current = privatemsg_is_disabled($account);
$disabled = (int) (!$edit['pm_enable']);
$edit['pm_enable'] = NULL;
// Only perform the save if the value has changed.
if ($current != $disabled) {
// If disabled is 1.
if ($disabled == 1) {
// Insert the setting.
privatemsg_set_setting('user', $account->uid, 'disabled', $disabled);
}
else {
// Delete the setting.
privatemsg_del_setting('user', $account->uid, 'disabled');
}
}
}
}