You are here

function privatemsg_preprocess_author_pane in Privatemsg 7

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

Implements hook_preprocess_author_pane().

File

./privatemsg.author-pane.inc, line 11
Provides a preprocess function to integrate Privatemsg with Author Pane.

Code

function privatemsg_preprocess_author_pane(&$variables) {

  // Check if this preprocess needs to be run given who's calling it.
  if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) {
    return;
  }
  global $user;
  $account = $variables['account'];
  if ($account->uid != $user->uid) {
    $url = privatemsg_get_link($account);
    if (!empty($url)) {
      $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array(
        'attributes' => array(
          'class' => array(
            'author-pane-link',
          ),
          'title' => t('Send @name a private message', array(
            '@name' => privatemsg_recipient_format($account, array(
              'plain' => TRUE,
            )),
          )),
        ),
        'html' => TRUE,
      ));
    }
  }
}