Question

I'm using Organic Groups on my (D7) site. I've set it up so that group managers can create new roles and change permissions in their groups. I've overridden some of the permissions using hook_og_permission_alter() to limit what they can actually change, and this seems to work well.

The problem I'm having is I want to alter/remove the section headers (ex. Organic Groups, Organic groups UI) that are set up by the different OG modules in this permissions table (I currently have three modules generating their own heading), and I can't find a way to do this. I can't find a hook that does what I want, and I've tried making sure none of the permissions are associated with the headings, but that didn't remove them. I guess I could edit the modules generating these headings and change their names to what I want the headings to display, but that really doesn't feel like the right approach here (and I'd rather remove the headings altogether anyways).

Does anyone know how I can approach this?

Was it helpful?

Solution

Implement hook_page_alter() and

function mymodule_page_alter(&$page) {
  if (current_path() == 'admin/people/permissions') {
    foreach ($page['content']['system_main']['permission'] as $index => $permission) {
      if ($permission['#markup'] == 'Organic Groups') {
        $page['content']['system_main']['permission'][$index]['#markup'] = 'Foobar';
      }
    }
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top