function privatemsg_preprocess_author_pane in Author Pane 5
Implementation of hook_preprocess_author_pane().
File
- modules/
privatemsg.author-pane.inc, line 10 - This file provides a preprocess function for the Author Pane module.
Code
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);
}
}