You are here

function privatemsg_view_access in Privatemsg 6.2

Same name and namespace in other branches
  1. 6 privatemsg.module \privatemsg_view_access()
  2. 7.2 privatemsg.module \privatemsg_view_access()
  3. 7 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 385
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;
  }
  $arg = substr_count(variable_get('privatemsg_url_prefix', 'messages'), '/') + 1;
  if (privatemsg_user_access('read privatemsg') && arg($arg) == 'view') {
    return TRUE;
  }
  return FALSE;
}