| Commit | Line | Data |
|---|---|---|
| 446de5a3 | 1 | <?php |
| 446de5a3 OT |
2 | |
| 3 | /** | |
| 4 | * @file | |
| cf9f729d | 5 | * Provides a preprocess function to integrate Privatemsg with Author Pane. |
| 446de5a3 OT |
6 | */ |
| 7 | ||
| 8 | /** | |
| cf9f729d | 9 | * Implements hook_preprocess_author_pane(). |
| 446de5a3 OT |
10 | */ |
| 11 | function privatemsg_preprocess_author_pane(&$variables) { | |
| cf9f729d SG |
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; | |
| 446de5a3 | 15 | } |
| cf9f729d SG |
16 | |
| 17 | global $user; | |
| 18 | $account = $variables['account']; | |
| cf9f729d | 19 | |
| 4e03dd09 | 20 | if ($account->uid != $user->uid) { |
| cf9f729d SG |
21 | $url = privatemsg_get_link($account); |
| 22 | if (!empty($url)) { | |
| ac43a90f | 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)); |
| cf9f729d SG |
24 | } |
| 25 | } | |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 4c834a39 | 29 | * Implements hook_author_pane_allow_preprocess_disable(). |
| cf9f729d SG |
30 | */ |
| 31 | function privatemsg_author_pane_allow_preprocess_disable() { | |
| 32 | return array('privatemsg' => 'Privatemsg'); | |
| 446de5a3 | 33 | } |