You are here

function privatemsg_view_access in Privatemsg 7

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

Check access to the view messages page.

Function to restrict the access of the view messages page to just the messages/view/% pages and not to leave tabs artifact on other lower level pages such as the messages/new/%.

Parameters

$thread: A array containing all information about a specific thread, generated by privatemsg_thread_load().

Related topics

1 string reference to 'privatemsg_view_access'
privatemsg_menu in ./privatemsg.module
Implements hook_menu().

File

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

Code

function privatemsg_view_access($thread) {

  // Do not allow access to threads without messages.
  if (empty($thread['messages'])) {

    // Count all messages, if there
    return FALSE;
  }
  if (privatemsg_user_access('read privatemsg') && arg(1) == 'view') {
    return TRUE;
  }
  return FALSE;
}