when creating new post content on a fresh install.

CommentFileSizeAuthor
#12 1818180_warnings-group-ref_12.patch1.03 KBjrbeeman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Title: Group ref field instances overidden, can't reference groups » Group ref field instances overidden, can't reference groups without prepopulation from URL
ezra-g’s picture

Title: Group ref field instances overidden, can't reference groups without prepopulation from URL » Can't reference groups without prepopulation from URL

http://drupalcode.org/project/commons_groups.git/commitdiff/dd5efde?hp=2... resolves the field being overridden in my testing. Leaving this issue open for remaining bug.

ezra-g’s picture

ezra-g’s picture

Assigned: ezra-g » Unassigned

I'm not actively working on this at the moment. I plan to come back to it, but if someone wanted to troubleshoot this, commons_groups_entityreference_default_value() would be the place to start.

Matt V.’s picture

I looked into this a bit on Friday. Oddly, the errors persisted even when I commented out the contents of the entire commons_groups_entityreference_default_value() function.

There is an issue in the Entity reference queue #1784608: error when using with auotocomplete(tagged) widget that mentions a similar error. Unfortunately, the proposed solution, the latest dev release is already in use in Commons.

Matt V.’s picture

This issue seems to be specific to the Autocomplete (Tags style) reference widget within Organic Groups. The other OG reference field widgets don't have the same problem.

I've opened a ticket in the OG issue queue: #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches. And I'll continue to look into it.

ezra-g’s picture

Status: Active » Postponed

Awesome - Thanks for looking into this, Matt!

Marking this issue as postponed pending #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches.

ezra-g’s picture

ezra-g’s picture

Status: Postponed » Needs review

Marking as "needs review" based on the patch now available at #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches :).

ezra-g’s picture

jrbeeman’s picture

Assigned: Unassigned » jrbeeman

Found the issue here. Working on patches to related modules and will post back once I've submitted them to the relevant issue queues, along with a Commons make file patch.

jrbeeman’s picture

jrbeeman’s picture

Assigned: jrbeeman » Unassigned
Matt V.’s picture

Status: Needs review » Needs work

jrbeeman, It looks like you may have a copy-and-paste error. The OG patch you reference in your patch is the same one applied 3-lines above.

 projects[og][patch][] = "http://drupal.org/files/og-add-group-message.patch"
+; Fix warning in og_field_widget_form(), in og.field.inc
+; http://drupal.org/node/1876696
+projects[og][patch][] = "http://drupal.org/files/og-add-group-message.patch"                      <-- same as 3-lines above
Matt V.’s picture

jrbeeman,

In my testing, the original issue is already fixed in the latest 2013-Jan-27 dev release, presumably by the fact that Commons already uses the 2.x-dev release of OG, which includes the fix from #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches.

Are these other two patches necessary? I noticed that the OG issue (#1876696: Warning message in line 69 of og.field.inc using Entity reference prepopulate module) was marked as "closed (works as designed)".

ezra-g’s picture

Title: Can't reference groups without prepopulation from URL » Can't reference groups where the user is not a member

I resolved the invalid argument foreach warnings by making commons_groups_entityreference_default_value() return an $items array in all cases where there are no matches: http://drupalcode.org/project/commons_groups.git/commitdiff/8c7b38d

However, I'm now unable to reference groups where the current user is not already a member. This regression may have been introduced by #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches.

ezra-g’s picture

I filed #1902086: Allow group-audience widget to allow adding new content to groups a user doesn't belong to to request some guidance from amitaibu on how best to proceed.

ezra-g’s picture

After further investigation, I re-titled to #1902086: Allow group-audience widget to allow adding new content to groups a user doesn't belong to, filed a patch and added it to the Commons make file with http://drupalcode.org/project/commons.git/commit/523f2e5.

However, since then, the patch has failed OG's automated testing.

ezra-g’s picture

I reviewed the proposed alternative patch/issue and re-opened #1902086.

johnlutz’s picture

Kind of unrelated but when I got here from an error that this post was related to, I also got a related error/notice you might want to be aware of:

Notice: Undefined variable: id in commons_groups_entityreference_default_value() (line 397...

In commons_groups_entityreference_default_value it is coded:

(og_user_access($target_type, $target_id, "create $entity->type content") || og_user_access($target_type, $id, "update any $entity->type content"))

Figure that $id should be $target_id?

ezra-g’s picture

Title: Can't reference groups where the user is not a member » Re-Roll og_group_ref/og_user_access field patch
Category: bug » task

Re-titling to be more accurate.

ezra-g’s picture

Title: Re-Roll og_group_ref/og_user_access field patch » Refactor og_group_ref field definition
Priority: Critical » Major
Status: Needs work » Closed (duplicate)