URL: http://turczynski.com/blog/2011-02-07/drupal-7-node-multiple-authors
I have to migrate from my old Drupal 5 site, that had multiple authors assigned to one node, and this is the solution for Drupal 7. First of all you will need to download References module and enable User Reference. Then go to your module (sites\all\modules\references\) and edit file user_reference\user_reference.module at line number 481 as it has an error. Change line: $query->condition($user_uid_alias, $ids, 'IN', $ids); to this: $query->condition("u.$user_uid_alias", $ids, 'IN', $ids); Now go to your theme, and edit template.php file adding this lines.
function MYTHEME_preprocess_node(&$vars, $hook) { '!username' => MYTHEME_article_authors($vars['field_author']['und']), } else { '!username' => t('Anonymous'), } } function MYTHEME_article_authors($uids) { foreach($uids as $author) { $user = user_load($author['uid']); if ($user->uid) { $authors[] = l($user->name, 'user/' . $user->uid); } } } } return $authors[0]; } return t('Anonymous'); }
You need to login to post a comment.
