function privatemsg_node_view in Privatemsg 7
Same name and namespace in other branches
- 7.2 privatemsg.module \privatemsg_node_view()
Implements hook_node_view().
File
- ./
privatemsg.module, line 2390 - Allows users to send private messages to other users.
Code
function privatemsg_node_view($node, $view_mode) {
$types = array_filter(variable_get('privatemsg_link_node_types', array()));
if (in_array($node->type, $types) && ($view_mode == 'full' || variable_get('privatemsg_display_on_teaser', 1) && $view_mode == 'teaser')) {
$url = privatemsg_get_link(user_load($node->uid));
if (!empty($url)) {
$node->content['links']['#links']['privatemsg_link'] = array(
'title' => t('Send author a message'),
'href' => $url . '/' . t('Message regarding @node', array(
'@node' => $node->title,
)),
'query' => drupal_get_destination(),
'attributes' => array(
'class' => 'privatemsg-send-link privatemsg-send-link-node',
),
);
}
}
}