How to reproduce:

  1. Set up an entity reference field (here og_group_ref) in a content type that refers to an Organic Group type.
  2. Set the widget type for that entity reference field to "Select list" instead of "OG reference". The bug happens with any widget, but only widgets without auto-complete will let us see our options easily.
  3. In the field instance settings fro that entity reference field, set "Entity selection: Mode: Organic Groups".
  4. Call a URL to a node creation form that should result in prepopulating the field, such as http://example.com/node/add/post?og_group_ref=1234, with 1234 being a node ID of an Organic Group of which the user is not a member, but can post into. You have to set up your OG permissions accordingly for that.

As a result, the field is not prepopulated, but the option we wanted it to prepopulate with is visible in the select list of the field's widget. I believe this is a bug, since the user can select that option from the select list and successfully create a node with this setting – if the user can, so should entityreference_prepopulate.

The bug does not happen with "Entity selection: Mode: Simple" or "Entity selection: Mode: Commons OG" (available if you use the Drupal Commons distribution). Means the "Organic Groups" entity selection mode is able to interfere somehow with the ability to prepopulate with available options from the select list. I suggest that this very ability should be removed. If something is available in the option list, it should be a possible option, and if there is a permission issue with the option on node creation, the server should complain. It's not the responsibility of entityreference_prepopulate to guess what will happen serverside.

Note that Organic Groups since version 2.2 is supposed to allow entityreference_prepopulate to prepopulate with all groups the user can post to [see #1902086-24: Allow group-audience widget to allow adding new content to groups a user doesn't belong to and confirmed in their README]. So there's a bug from the OG side involved as well, which I reported as #2692525: Remove entityreference_prepopulate way to select group of which user is not member. But the issue on the entityreference_prepopulate side, as I see it, is that it's overstepping its responsibilities by enabling OG to interfere with selecting an available field option in the first place.

Comments

tanius created an issue. See original summary.

tanius’s picture

Issue summary: View changes