Download & Extend

Refactor og_group_ref field definition

Project:Drupal Commons
Version:7.x-3.x-dev
Component:Groups
Category:task
Priority:major
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

when creating new post content on a fresh install.

Comments

#1

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

#2

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.

#3

#4

Assigned to:ezra-g» Anonymous

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.

#5

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.

#6

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.

#7

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.

#8

#9

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 :).

#10

#11

Assigned to:Anonymous» 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.

#12

#13

Assigned to:jrbeeman» Anonymous

#14

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

#15

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)".

#16

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.

#17

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.

#18

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.

#19

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

#20

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?

#21

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

Re-titling to be more accurate.

#22

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)

Let's continue this work at #1961296: Refactor og_group_ref field per OG API improvements.