I have a field in my user profile of byline (field_byline). I'd like to call this in the node template so that the byline is included next to the author's name (e.g. Posted by Mr. Rogers | Sweater Entrepreneur) I kind of have it working, but not quite there yet. I'm using Drupal 7.10
Right now, I have this in my template.php
global $user;
$user = user_load($user->uid);
$bylines = field_get_items('user', $user, 'field_byline');
if ($bylines) {
$vars['field_byline'] = $bylines[0]['value'];
}
}
And this in my node.tpl.php
if (isset($field_byline) && !empty($field_byline)) :
echo '<span class="byline">| ' . $field_byline.'</span>';
endif;
But, my problem is this only calls the correct byline while viewing the individual node. It breaks on the front page when all the nodes are looped out and only displays the byline of the first user, not the one that wrote the post.
Any help or direction would be much appreciated!