Projet

Général

Profil

Paste
Télécharger (1007 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / privatemsg / privatemsg.author-pane.inc @ d719f12f

1
<?php
2

    
3
/**
4
 * @file
5
 * Provides a preprocess function to integrate Privatemsg with Author Pane.
6
 */
7

    
8
/**
9
 * Implements hook_preprocess_author_pane().
10
 */
11
function privatemsg_preprocess_author_pane(&$variables) {
12
  // Check if this preprocess needs to be run given who's calling it.
13
  if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) {
14
    return;
15
  }
16

    
17
  global $user;
18
  $account = $variables['account'];
19

    
20
  if ($account->uid != $user->uid) {
21
    $url = privatemsg_get_link($account);
22
    if (!empty($url)) {
23
      $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));
24
    }
25
  }
26
}
27

    
28
/**
29
 * Implements hook_author_pane_allow_preprocess_disable().
30
 */
31
function privatemsg_author_pane_allow_preprocess_disable() {
32
  return array('privatemsg' => 'Privatemsg');
33
}