You are here

privatemsg.author-pane.inc in Author Pane 5

This file provides a preprocess function for the Author Pane module.

File

modules/privatemsg.author-pane.inc
View source
<?php

/**
 * @file
 *   This file provides a preprocess function for the Author Pane module.  
 */

/**
 * Implementation of hook_preprocess_author_pane().
 */
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);
  }
}

Functions

Namesort descending Description
privatemsg_preprocess_author_pane Implementation of hook_preprocess_author_pane().