1

Using Open Atrium 6.x-1.2 (Organic Groups 6.x-2.3 inc it's access control.mod), would someone be as kind to provide an example function that would detect the current user's role? It's my understanding OG overrides the standard Drupal permissions page. My end goal is to allow certain roles access to groups they don't specifically have membership (eg: Executive) for a custom OA/OG access control policy/module.

Would some implementation of Rules be possible here?

My skill level: no PHP but just started studying module dev

1 Answer 1

0

To test whether the currently-logged-in User has a specific Role, you can do this:

global $user;
if (in_array('Executive', $user->roles)) {
  drupal_set_message("I have the 'Executive' role.");
}
2
  • Wow. Seems I was thinking things would be more complicated by the nature of OG ignoring the standard Drupal perms. Brilliant & my thanks to you, good sir.
    – The Doctor
    Commented May 15, 2012 at 11:20
  • @TheDoctor Please don't change the title if the question becomes solved, simply mark the answer as accepted as stated in How to Ask
    – Chapabu
    Commented May 15, 2012 at 11:25

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.