You are here

function privatemsg_user_access in Privatemsg 6

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

Privatemsg wrapper for user_access.

Never allows anonymous user access as that doesn't makes sense.

Parameters

$permission: Permission string, defaults to read privatemsg

Return value

TRUE if user has access, FALSE if not

Related topics

20 calls to privatemsg_user_access()
pm_email_notify_user in pm_email_notify/pm_email_notify.module
Implements hook_user().
privatemsg_delete in ./privatemsg.module
privatemsg_filter_create_tags in privatemsg_filter/privatemsg_filter.module
Function to create a tag
privatemsg_filter_form in privatemsg_filter/privatemsg_filter.module
Form to show and allow modification of tagging information of a conversation.
privatemsg_filter_form_privatemsg_list_alter in privatemsg_filter/privatemsg_filter.module
Implements hook_form_FORM_ID_alter().

... See full list

2 string references to 'privatemsg_user_access'
privatemsg_filter_menu in privatemsg_filter/privatemsg_filter.module
Implements hook_menu().
privatemsg_menu in ./privatemsg.module
Implements hook_menu().

File

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

Code

function privatemsg_user_access($permission = 'read privatemsg', $account = NULL) {
  if ($account === NULL) {
    global $user;
    $account = $user;
  }
  if (!$account->uid) {

    // Disallow anonymous access, regardless of permissions
    return FALSE;
  }
  if (!user_access($permission, $account)) {
    return FALSE;
  }
  return TRUE;
}