I have updated from 7.x-3.0-rc5 to 7.x-3.0 and noticed that the Og Menu will not work for a user with access to only one group. If a user has access to multiple groups the correct menu will appear based on the group audience. However, if that user belongs to only one group, the Parent item is empty. I believe this is related to the fact that these content types were built with Og Menu 7.x-2.0, since I don’t have this issue with any sites built using only Og Menu 7.x-3.0.

CommentFileSizeAuthor
#10 og menu.jpg259.15 KBbmsomega

Issue fork og_menu-2392027

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rv0’s picture

Status: Active » Postponed (maintainer needs more info)

Did you select the "Enable for OG Menus" setting on the content type?
Which type of widget are you using?
Is this on content creation or on content editing?
Are OG Menu permissions granted globally or on group level?

bspeare’s picture

Yes, I have selected "Enable for OG Menus" setting on the content type. I am using the OG Reference widget, and this occurs on content creation and when editing existing nodes. And I am setting permissions at admin/config/group/permissions/node/group instead of for each individual group.

rv0’s picture

On content creation you need to have an OG context set from the url., and configure the og widget to listen to it.. are you doing that?

(sorry for the questions, just have to be sure before i start testing this)

bspeare’s picture

Thanks for the help. I am setting the Groups audience from the OG reference widget - is that what you mean?

rv0’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Can you try latest dev and tell me if the problem is still there?

I'm afraid it's hard to say whats going on without having a look at the og, og_menu and menu related tables in your database..

westonpay’s picture

Beating a dead horse here and I apologize. I just wanted to confirm this is still an issue even with 7.x-3.x-dev. I am running OG 7.x-2.9. If a user belongs to only one group the parent item dropdown is empty.

rv0’s picture

@westonpay
I'm 100% sure this works when a user only has one group.

are you sure it is not permission related?
How/where are users given access to the OG (!) menu ?

bmsomega’s picture

Status: Closed (cannot reproduce) » Active

Hi,
I'm using version 7.x-3.1 and I'm experiencing this issue as well.
I'm thinking that this is a javascript issue. Since the parent menu selection is triggered by selecting a group within the Groups Audience field, users can’t select a parent menu item because there isn’t a chance to actually select a group if the user is only part of one group.

rv0’s picture

see my previous post.
there is a configuration reason for this, but without knowing your exact config I cannot help

bmsomega’s picture

FileSize
259.15 KB

A work-around that worked for me was reconfiguring the Groups Audience field widget from "OG reference" to anything else and then back to "OG reference". Doing this messed with the field settings a little bit so I had to make sure my field was configured correctly as well.

Before, the Groups Audience field was being automatically populated by the only group the user was a member of. Now instead, after doing that reconfiguration, the Groups Audience field now shows "Select a value" and the user needs to select the group. (See attached image)

Not sure if this sheds any light as to why I was experiencing this problem.

rv0’s picture

there must have been something different then in your field config

if you have a backup and could roll back, this might help people experiencing this issue

drumm’s picture

Issue tags: +affects drupal.org

A key part of this looks like the cardinality setting for the OG group ref field. Changing it from 1 to unlimited seems to have triggered this on www.drupal.org. The widget as the affected user sees it is a single select field, but og_menu.js is processing it as cardinality != 1 and is looking for a multi-select field.

Drupal.ogMenu.selected ends up being something like [3, 0, 2, 5, 7, 6, 8] instead of [3025768]

drumm’s picture

Status: Active » Needs review

MR !1 checks the multiple attribute of the HTML element instead of trusting the select element to match the field cardinality.

rv0’s picture

@drumm
Seems like a proper solution, and nice to see some light on an issue from 2014
I don't have access to any D7 sites with OG Menu, or any development environment with a proper configuration for it.
Could you provide exact steps to reproduce the issue? (field and widget setting and whatever else is relevant?)

Thanks in advance

drumm’s picture

I spotted where the single/multiple select list switch happens: https://git.drupalcode.org/project/drupal/-/blob/7.77/modules/field/modu...

I don’t have a clean development environment with all the steps to reproduce. I think the key parts are:

  • The OG group reference field must have cardinality > 1, so the node can be in multiple groups.
  • The user must have access to one group, so they only have one option.

(We do have www.drupal.org’s configuration exported at https://git.drupalcode.org/project/drupalorg/-/blob/61514c71f32a3e85e098..., but I don’t expect that to be too helpful as the module has a lot of unrelated baggage.)

  • rv0 committed fe01576 on 7.x-3.x authored by drumm
    Issue #2392027 by drumm: Menu parent item is empty if user belongs to...
rv0’s picture

Status: Needs review » Fixed

A new 7.x-3.3 release is coming, thanks for your contribution!

Status: Fixed » Closed (fixed)

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