Since OG User Roles 5.x-2.7 (also in 5.x-2.8) in the 'Group details' menu of a user I do not have the content types only as menu items on the top menu level: I have in addition a menu item "create content" under which the menu links for the content types appear for a second time. I cannot find out how I can change it in a way, that a content type only appears once in the group menu. I hope someone can help me.

CommentFileSizeAuthor
#4 og_user_roles.module.5.x-3.2.patch10.88 KBSomebodySysop
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sebo’s picture

Version: 5.x-2.7 » 5.x-2.8

If you want to customize the 'Group details' block, here are some hints (copy/pasted) from the OG readme.txt:

- You alter the links in the group details block using hook_og_link_alter($links, $group_node). See bottom of og_og_block_details(). Or you may completely take over this block by defining a og_block_details for each of your custom group node types. See og_block_details().

To remove the 'create content' item from this block, here is the function I wrote according to the preceeding guideline:

function <put your module name here>_og_link_alter(&$links, $group_node) {
  unset($links[0]); // 'create content' link
}

To get the name of the item to remove, you can just add a print_r($links) to this function: it will show you all the items ready to be themed. You can remove them using the same kind of 'unset' instruction (this is how I figured out that the 'Create content' item has the key '0').

I hope it helps.

mikox’s picture

Thank you, with your help I could change the `Group details' menu the way I wanted.

But it still seems strange to me that with the standard installation of OG User Roles (since 5.x-2.7) the content types are shown twice in this menu (as described before); I believe this is only in the interest of a small minority of users.

kimadactyl’s picture

This function does it the other way round and gets rid of everything *but* the create content link.

function yourmodule_og_link_alter(&$links, $group_node) {
  foreach($links as $key => $value) {
    if(substr($key,0,7) == 'create_') {
      unset($links["$key"]);
    }
  }
}
SomebodySysop’s picture

Version: 5.x-2.8 » 5.x-3.1
FileSize
10.88 KB

Thanks dar-es-balat. I decided to incorporate your code as an option.

Try this patch against a clean download of the 3.1 release.

On the 'Edit' form of the group, you will find an option to display 'Create content' and remove the default OG 'Create ..."

Hopefully this will satisfy everyone.

SomebodySysop’s picture

Assigned: Unassigned » SomebodySysop
Status: Active » Needs review
SomebodySysop’s picture

Status: Needs review » Fixed

The modifications will be included in the 3.2 release.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.