Closed (outdated)
Project:
Views PHP
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2012 at 04:48 UTC
Updated:
8 Feb 2021 at 16:22 UTC
Jump to comment: Most recent
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
Comment #1
liam morlandDrupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.