From #1451852: Allowing references to unpublished content, we all agree that changing to "views selection" mode is the perfect workaround when creating/updates nodes that reference unpublished content, through the Drupal UI.

The problem lies when programmatically creating/updating a node with a reference to an unpublished node. This is not possible without this patch. Even if you have "views selection" mode enabled, it is not possible to programmatically create/update a node with a reference to an unpublished node unless using the patch .

The patch is most likely not usable for the majority of sites. What is a more practical way for this to become a possibility? When "views selection" is enabled, can the module be expanded to use that result set in the $query condition? Other ideas?

Comments

tyler.frankenstein created an issue. See original summary.

tyler.frankenstein’s picture

Issue summary: View changes
amaisano’s picture

I need a way to completely ignore user role access permissions, because the Rules module operates under the Anonymous role which I can't (won't) grant unpublished access to. Keeping my eye on this thread - the patch noted above did not help.

tyler.frankenstein’s picture

Status: Active » Closed (works as designed)

I'm going to close this issue, as my issue description is totally wrong. The whole time it was my fault in an implementation of hook_node_presave() accidentally ripping out an entity reference value. Once I fixed that bug, I am able to successfully reference an unpublished node on an entity reference field programmatically, without the patch mentioned above.

As for the Rules problem mentioned by @amaisano , I'd advise opening a new issue describing in detail what's going wrong.