具有多个作者的Drupal7节点
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了具有多个作者的Drupal7节点相关的知识,希望对你有一定的参考价值。
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__](http://drupal.org/project/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'); }
以上是关于具有多个作者的Drupal7节点的主要内容,如果未能解决你的问题,请参考以下文章