Original post here https://www.drupal.org/node/1170380#comment-5996382

For author profile info on the node:

<?php
$node = $variables['node'];
$author = user_load($node->uid);
$first_name = field_get_items('user', $author, 'field_first_name');
$last_name = field_get_items('user', $author, 'field_last_name');
$userid = $node->uid;
?>
<?php if ($first_name && $last_name) : ?>
<div class="author">
<label class="inline">Author: </label>
<a href="/user/<?php print $userid; ?>/contact">
<?php print render($first_name[0]['value']); ?>
<?php print render($last_name[0]['value']); ?>
</a>
</div>
<?php endif; ?>

And for author info in comments:

<?php
$comment_author = user_load($comment->uid);
$first_name = field_get_items('user', $comment_author, 'field_first_name');
$last_name = field_get_items('user', $comment_author, 'field_last_name');
$userid = $comment->uid;
?>
<?php if ($first_name && $last_name) : ?>
<div class="author">
<label class="inline">By </label>
<a href="/user/<?php print $userid; ?>/contact">
<?php print render($first_name[0]['value']); ?>
<?php print render($last_name[0]['value']); ?>
</a>
</div>
<?php endif; ?>

Leave a Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Get reliable web hosting services

Recurring donation

Make Donation

  • Other: $

Donate now

Single donation

Make Donation

  • Other: $

Donate now