Last updated August 23, 2009. Created by rfay on November 21, 2008.
Edited by SLIU, jhodgdon, lsabug. Log in to edit this page.
This is to include the name of the author of a node and the group the node belongs to. From christefano's post at Drupal Groups: http://groups.drupal.org/node/15751.
Add the following code to the node type template in your theme folder.
<?php if ($submitted): ?>
<?php if ($og_groups): ?>
<!-- the post is submitted to a group -->
<?php
$og_projects = array();
foreach ($node->og_groups_both as $key => $name) {
$og_projects[] = l($name,'node/'.$key,array('class'=>'group'));
}
$og_projects = implode(', ',$og_projects);
?>
<span class="submitted">
<?php print $submitted ?>
<?php print $og_projects; ?>
</span>
<?php elseif (!$og_groups): ?>
<!-- the post is not submitted to a group -->
<span class="submitted">
<?php print $submitted ?>
</span>
<?php endif; ?>
<?php endif; ?>The output will look like this:
Submitted by lsabug on November 20, 2008 - 3:29pm. For Testing Classroom blog
Comments
Hi does this work for drupal
Hi does this work for drupal 6? I was just wanting to put the groups a node belongs to in the teaser view.
http://onlinebanter.com