Gizra / og

https://www.drupal.org/project/og
92 stars 133 forks source link

Illegal choice [nid] in Your groups element with entityreference_prepopulate #206

Open miromarchi opened 7 years ago

miromarchi commented 7 years ago

Hi. I am using github issue queue as stated in the project page on drupal.org

tl;dr Entityreference_prepopulate is not filling in the "other groups" widget for "og admin users", but adding the prepopulated nid to the "your groups" widget, causing an error.

details I have a website with:

Members can only create group content for their groups, while curators can do everything within every group.

The problem:

If a member creates a new node in his/her group, everything is fine. The prepopulate module fills the "og reference" field with the node being viewed as his/her group (the "add node" button is only visible if the user is member of the group being viewed).

If a curator wants to create a node in another group, prepopulate module fills the "og reference" field with the node being viewed, but this group name appears in the "default widget" not in the "administrator widget". This is already strange because it appears under "Your groups" list, while it should be under "Other groups" list, IMO.

But the real problem is that node creation will work only if the curator only fills in the title and/or other simple fields and saves. If the curator fills in other fields that make a server call, like address field, or uploads a file, or fills an autocomplete entity reference field, the creation fails with message An illegal choice has been detected. Please contact the site administrator. Watchdog shows Illegal choice [nid] in Your groups element, where [nid] is that of the currently being viewed group.

If the curator creates the node with only the title and simple text fields, then he/she can edit the node later on and fill every other field no problem.

If the curator creates the node without using entityreference_prepopulate, he/she can specify any other group in the "Other groups" list, and it can also fill in every complex field, no problem.

Curator role has the "Administer Organic groups permissions" perm.

I am on drupal 7.44, panopoly 7.x-1.37, og 7.x-2.9

Thank you for attention.

miromarchi commented 7 years ago

I have updated a bit the issue because the problem actually persist only with fields which make a server call before saving the node.