To recreate:
1) log in as an admin with "administer groups" permission
2) in a group where the logged in user is not a member, create new content using a required group audience field with entity prepopulate via the URL.
3) Despite not being a member, the group appears in the 'default' field as part of the combo audience field for group administrators.
5) Click 'upload' on a file/image field within the group content node form. The default field will still show the prepopulated group in 'your groups'. (If no ajax submit buttons are clicked, saving works.)
6) Attempt to save.
7) Your groups is cleared, and the node form throws the following error: "An illegal choice has been detected. Please contact the site administrator." - from line 1388 in includes/form.inc - because the value of the prepopulated group is no long in the options for 'your groups'.
8) This error is compounded because after the error, it's no longer possible to select the prepopulated group in EITHER 'your groups' or 'other groups'. If selected in 'other groups', the referenced group throws "The referenced group (@type: @id) is invalid." from OgBehaviorHandler.class.php because the prepopulated value is not listed in the results from entityreference_get_selection_handler() any longer.
This issue is specific to fields with 'skip_perm' configured and users with the matching permission. It occurs because entityreference_prepopulate_field_attach_form() has a continue; statement for users with 'skip permissions' BEFORE executing the code that would store the value in the $form_state.
Comment | File | Size | Author |
---|---|---|---|
#8 | jastraat-og-error.sql_.zip | 288.26 KB | jastraat |
#1 | skip_perm_ajax-2447657.patch | 1.49 KB | jastraat |
Comments
Comment #1
jastraat CreditAttribution: jastraat commentedPatch against current dev is attached. To fix this error, you need both the current dev version of this module + this patch.
Comment #2
amitaibu@HelenaEksler can you please review.
Comment #3
HelenaEksler CreditAttribution: HelenaEksler commented@amitaibu
The patch looks fine as to me.
I've repeated the described way, got the error without patch and the patch has solved the problem.
Comment #4
jastraat CreditAttribution: jastraat commented@HelenaEksler - could you mark this reviewed?
Comment #5
amitaibuIs this the same issue as #1958800: AJAX causes entityreference_prepopulate_get_values_from_url to fail?
Comment #6
jastraat CreditAttribution: jastraat commented@amitai - not quite. This patch simply moves a group-admin-only section of code (e.g. if ((!empty($settings['skip_perm'])) below the already existing code in the OG dev branch with the comment
// Store prepopulated values in the form state to make them persistent,
The error in this issue is specific to OG admins who can skip permissions, and it doesn't matter what fallback action is selected for pre-populate.
"Not hiding or disabling the Groups Audience field" prevents the error in #1958800 - but there is no work around for this admin-only issue.
Comment #7
amitaibuHi Jess(y) :)
Keeping my promises -- I've tried to reproduce the error on a clean installation but couldn't - possibly because I wasn't to reproduce exactly your environment. Can you attach a db dump of a clean installation and a set of simple steps to recreate?
Comment #8
jastraat CreditAttribution: jastraat commentedThanks Amitai!
I've attached the DB of a fresh Drupal install with the following modules:
Drupal core 7.37
Chaos tools (ctools) 7.x-1.7
Entity Reference (entityreference) 7.x-1.1+4-dev (latest dev)
Entity reference prepopulate (entityreference_prepopulate) 7.x-1.5+5-dev (latest dev)
Organic groups (og) 7.x-2.7+30-dev (latest dev)
Organic groups context (og_context) 7.x-2.7+30-dev (latest dev)
Organic groups UI (og_ui) 7.x-2.7+30-dev (latest dev)
Entity API (entity) 7.x-1.6
Views (views) 7.x-3.11
Views Bulk Operations (views_bulk_operations) 7.x-3.2
I've created an example group at node one that this admin is not a member of.
login: admin/admin
To recreate, login and go to yourdomain.com/node/add/article?og_group_ref=1
Then follow the steps in this issue to recreate the error.
Comment #10
amitaibuMerged, thanks.
@jastraat, See you in the issue queues ... :)