In OG 7.x-2.x you can assign roles to group members and you can override roles for a specific group. I am trying to create a view of all admin members. I am filtering the view with PHP.

Option #1: Use $roles = og_get_user_roles('node', $row->gid, $row->uid); and then check for role '3' (normally the admin role in OG). -> the obvious problem is that if a group has overridden the default roles, its "admin" role has an other (undefined) id

Option #2: Check with the 'Administer group' permission: $administrator = og_user_access('node', $row->gid, 'Administer group ', $account); -> However I will get all the site administrators that can administer all the group, while I am looking in this context only those explicitly accounted as group admin (that in some cases could be site admin too).

Any hint on how to filter for an user that has explicitly be granted administer group permission ?

1 Answer 1


You can add a relationship to "OG roles from membership" in your view and then filter on the OG role. No need for custom code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.