I was trying to create a view which are accessible to group admins only. But following code does not return true for group admin. In fact the $group variable remains NULL

if (module_exists('og')){

//check we've got a group, rights to view the group,
// and of type "group_type" - change this to whichever group you want to restrict the block to
//or remove the condition entirely
if (($group = og_get_group_context()) && node_access('view', $group) && ($group->type == 'group_type') ) {

//check current user is a team admin
if (og_is_node_admin($group))  return TRUE;
}
}

For debugging I tried a simple code and if ($group) return $TRUE and that did not work.

Comments

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.