Hello i seem to be struggling to add the group name a node belongs to in the node.tpl. Ive used devel and ive added

<?php print render($content['og_group_ref']);


but with no success. Could anyone tell me the best way to display the group name?



fadgadget’s picture

I think the answer could be in this post.

I think its suggesting adding this code to my node.tpl

foreach (og_get_entity_groups('node', $node) as $entity_type => $og_memberships) {
  foreach ($og_memberships as $membership_id => $entity_id) {
    if ($entity_type == 'node') {
      // Assuming we only want to deal with node groups, we can
      // access the group node with...
      $group_node = node_load($entity_id);          

I just get a wsod when i add it wrapped in php tags. Could anyone assist me in printing the group name a node belongs to on the node?


fadgadget’s picture

hello im still trying to achieve this. Does anyone know how to print the group in the node tpl?


fadgadget’s picture

Status: Active » Fixed

seems my first attemp works. dunno why it wasnt till now. dont mind me.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.