function privatemsg_allow_disable in Privatemsg 7.2
Checks if the user is allowed to disable/enable private message.
Parameters
object: User object to check.
Return value
bool TRUE if the user is allowed to disable the private message.
2 calls to privatemsg_allow_disable()
- privatemsg_form_alter in ./
privatemsg.module - Implements hook_form_alter().
- privatemsg_user_update in ./
privatemsg.module - Implements hook_user_update().
File
- ./
privatemsg.module, line 1470 - Allows users to send private messages to other users.
Code
function privatemsg_allow_disable($account) {
global $user;
$allow_disable_privatemsg = TRUE;
// Compare it to current user id.
if ($user->uid != $account->uid) {
// User must have administer permission to disable other users' private message
// and the edited user must be able to change the setting.
$allow_disable_privatemsg = user_access('administer privatemsg settings') && user_access('allow disabling privatemsg', $account);
}
return $allow_disable_privatemsg;
}