function redhen_contact_preprocess_comment in RedHen CRM 7
Implements theme_preprocess_comment().
Use the RedHen Contact as the comment author.
File
- modules/
redhen_contact/ redhen_contact.module, line 1525 - Module file for RedHen contacts.
Code
function redhen_contact_preprocess_comment(&$variables) {
if (variable_get(REDHEN_CONTACT_ALTER_COMMENT_AUTHOR, FALSE) && ($contact = redhen_contact_load_by_user(user_load($variables['comment']->uid)))) {
if (entity_access('view', 'redhen_contact', $contact)) {
$contact_uri = $contact
->uri();
$variables['author'] = l($contact
->label(), $contact_uri['path'], array(
'attributes' => array(
'title' => 'View profile',
'class' => 'username',
),
));
}
else {
$variables['author'] = $contact
->label();
}
}
}