You are here

function privatemsg_is_disabled in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 privatemsg.module \privatemsg_is_disabled()
  2. 7 privatemsg.module \privatemsg_is_disabled()

Checks the status of private messaging for provided user.

Parameters

user object to check:

Return value

TRUE if user has disabled private messaging, FALSE otherwise

4 calls to privatemsg_is_disabled()
privatemsg_form_alter in ./privatemsg.module
Implements hook_form_alter().
privatemsg_privatemsg_block_message in ./privatemsg.module
Implements hook_privatemsg_block_message().
privatemsg_user_access in ./privatemsg.module
Privatemsg wrapper for user_access.
privatemsg_user_update in ./privatemsg.module
Implements hook_user_update().

File

./privatemsg.module, line 407
Allows users to send private messages to other users.

Code

function privatemsg_is_disabled($account) {
  if (!$account || !isset($account->uid) || !$account->uid) {
    return FALSE;
  }

  // Make sure we have a fully loaded user object and try to load it if not.
  if ((!empty($account->roles) || ($account = user_load($account->uid))) && user_access('allow disabling privatemsg', $account)) {
    $ids = privatemsg_get_default_setting_ids($account);
    return (bool) privatemsg_get_setting('disabled', $ids);
  }
  else {
    return FALSE;
  }
}