I am trying to create nodes that display multiple authors (from a custom "authors" field - not the user field) and a bio for each author.
With the help of http://turczynski.com/blog/2011-02-07/drupal-7-node-multiple-authors, I was able to do the first task. I cannot seem to get the bios fields passed to the node template.
These are the preprocess functions I am using (in template.php), which work for the authors but not for the bios. Has anyone tried this or have any advice?
function genesis_icenter_preprocess_node(&$vars, $hook) {
if (isset($vars['field_authors']['und']) && is_array($vars['field_authors']['und'])) {
$vars['name'] = t('!username', array(
'!username' => genesis_icenter_article_authors($vars['field_authors']['und'])));
$vars['bio'] = t('!bio', array(
'!bio' => genesis_icenter_article_bios($vars['field_authors']['und'])));
} else {
$vars['name'] = t('by !username', array(
'!username' => t('Anonymous')));
$vars['bio'] = t('by !username', array(
'!username' => t('')));
}
}
function genesis_icenter_article_authors($uids) {
$authors = array();
if (count($uids)) {
foreach($uids as $author) {
$user = user_load($author['uid']);
if ($user->uid) {
$authors[] = l($user->name, 'user/' . $user->uid);