You are here

function privatemsg_is_disabled in Privatemsg 6.2

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

Checks the status of private messaging for provided user.

Parameters

$account: User object to check.

Return value

TRUE if user has disabled private messaging, FALSE otherwise

4 calls to privatemsg_is_disabled()
privatemsg_menu_access in ./privatemsg.module
Checks access to a menu entry.
privatemsg_privatemsg_block_message in ./privatemsg.module
Implements hook_privatemsg_block_message().
privatemsg_user in ./privatemsg.module
privatemsg_user_access in ./privatemsg.module
Privatemsg wrapper for user_access.

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;
  }
}