You are here

function privatemsg_preprocess_author_pane in Privatemsg 5

Same name and namespace in other branches
  1. 6.2 privatemsg.author-pane.inc \privatemsg_preprocess_author_pane()
  2. 6 privatemsg.author-pane.inc \privatemsg_preprocess_author_pane()
  3. 7.2 privatemsg.author-pane.inc \privatemsg_preprocess_author_pane()
  4. 7 privatemsg.author-pane.inc \privatemsg_preprocess_author_pane()

This file provides a preprocess function for the author pane used by Advanced Forum and Advanced Profile Kit.

Implementation of hook_preprocess_author_pane().

File

./privatemsg.module, line 2563

Code

function privatemsg_preprocess_author_pane(&$variables) {
  global $user;
  $account = $variables['account'];
  $account_id = $variables['account']->uid;
  $image_path = $variables['image_path'];
  $variables['privatemsg'] = '';
  $user_can_access = user_access('access private messages');
  $author_can_access = $account_id != 0 && user_access('access private messages', $account);
  $author_allows = isset($account->privatemsg_allow) ? $account->privatemsg_allow : 1;

  // Send private message
  if ($user_can_access && $author_can_access && $account_id != $user->uid && $author_allows) {
    $variables['privatemsg'] = l(theme('image', "{$image_path}/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE), "privatemsg/new/{$account_id}", array(), NULL, NULL, FALSE, TRUE);
    $variables['privatemsg_link'] = l(t('Send PM'), 'privatemsg/new/' . $account_id);
  }
}