After testing the OG Menu module, I have discovered a scenario that may not be desired when using the pre-populate module.
The Entity Prepopulate module allows the 'group audience field' in this case to prepopulated. This means the menu is set accordingly with the group's menu.

When creating an OG group that has no menus assigned to it (e.g. Main Menu, Navigation) for this particular content type; the 'Parent Item' where you set the menus only shows the menu related to this group. This is correct.

However, if you have a content type such as Basic Page, that can be used as 'content for a group' AND content outside of a group, you get problems with the menus.
Say if I 'add' a new basic page; I set the details as required. When I come to add the item to the menu, not only is the OG menu shown but the other menus assigned to this content type. Thus I end up with the 'Primary Links' menu and group menu in one list. Baring in mind, this has had the group audience field pre-populated.

If the group audience field has been pre-populated, I suggest that all other menus should be hidden.
This is not necessarily a OG Menu issue but coupled with Entity Prepopulate.

The other menus are appended to the menu drop down in og_menu.module around line 424, which simply appends the new menus. If we could add a setting and a boolean check, this could fix a problem but it would need to be generic enough to work in all scenarios.

The other option is to hook_form_alter() in a custom module to override the menu again.

CommentFileSizeAuthor
#6 og_menu_2016_03_18.patch1.91 KBAmarjit
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Amarjit created an issue. See original summary.

rv0’s picture

Status: Active » Postponed (maintainer needs more info)

What happens if you select "Limit available menus to provided context" on admin/config/group/og_menu ?

Amarjit’s picture

Apologies, I should have checked the configuration.
When the reference query is added, it is loading the context correctly because the 'group' section is hidden when used.

So with the following settings, we have the following:

"Limit available menus to provided context" ENABLED
/node/add/page:

  • Enabled non-organic menu shown
  • No organic menu shown

/node/add/page?og_group_ref=xxx:

  • Enabled non-organic menus shown
  • Organic menus shown for group

"Limit available menus to provided context" DISABLED
/node/add/page:

  • Enabled non-organic menus shown
  • No organic menu shown

/node/add/page?og_group_ref=xxx:

  • Enabled non-organic shown
  • Organic menus shown for group

The setting does not seem to make a difference.

Debug Info:
Setting the variable is definitely being updated in the variable table.

og_menu.module around line 705, checks if the variable is set or not.

If not, the block at line 743, is executed. This correctly loads the organic group menu. Removing this block of code, and refreshing the page still shows the non-organic menus listed.
Either the menu is already generated at this point or another module is hooking in and adding the menus in. Either way, I suppose the non-organic menus need un-setting.

rv0’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

If a user has permissions to add items to other menu's, I'm afraid he will be able to do so.
This is by design.

I would recommend you use a content type specifically for OG, I don't think I'll add this feature any time soon. Sadly the current design doesn't allow us to easily do that.
I'm open to review patches though, so feel free to re-open.

Amarjit’s picture

Thanks rv0. I'll look into working a patch.

Just for anyone who comes across this issue. This only occurs if you try to create say a 'basic page' outside of a group. E.g. creating a content via the administration menu.

Amarjit’s picture

FileSize
1.91 KB

I have attached a patch that will temporarily get around this problem. This is not a permanent patch.

Thanks,
Amarjit