privatemsg.author-pane.inc

  1. 1 privatemsg.author-pane.inc
  2. 7-1 privatemsg.author-pane.inc
  3. 7-2 privatemsg.author-pane.inc
  4. 6-2 privatemsg.author-pane.inc

Provides a preprocess function to integrate Privatemsg with Author Pane.

File

privatemsg.author-pane.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provides a preprocess function to integrate Privatemsg with Author Pane.
  5. */
  6. /**
  7. * Implements hook_preprocess_author_pane().
  8. */
  9. function privatemsg_preprocess_author_pane(&$variables) {
  10. // Check if this preprocess needs to be run given who's calling it.
  11. if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) {
  12. return;
  13. }
  14. global $user;
  15. $account = $variables['account'];
  16. if ($account->uid != $user->uid) {
  17. $url = privatemsg_get_link($account);
  18. if (!empty($url)) {
  19. $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));
  20. }
  21. }
  22. }
  23. /**
  24. * Implements hook_author_pane_allow_preprocess_disable().
  25. */
  26. function privatemsg_author_pane_allow_preprocess_disable() {
  27. return array('privatemsg' => 'Privatemsg');
  28. }

Functions

Namesort descending Description
privatemsg_author_pane_allow_preprocess_disable Implements hook_author_pane_allow_preprocess_disable().
privatemsg_preprocess_author_pane Implements hook_preprocess_author_pane().