Error: EntityMetadataWrapperException: Unknown data property og_group_ref. in EntityStructureWrapper->getPropertyInfo() (line 339 of /Users/jimmy/Downloads/commons-7.x-3.x-dev/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc

This happens with 3.x-dev (Nov 19), default installation and content type Document.

Steps to reproduce:
- Enable Document Feature
- Go to a specific group
- Upload a document, click Save

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

meba’s picture

Note that you need to do thsi from the short form, not full form. It looks like the short form is lacking group context

meba’s picture

Title: EntityMetadataWrapperException: Unknown data property og_group_ref. in EntityStructureWrapper->getPropertyInfo » Please enter one more groups where this content will be posted.
ezra-g’s picture

Issue tags: +commons 7.x-3.6 radar

Sorry to hear that you're having problems here. Adding to our Commons 7.x-.3.6 radar for triage.

japerry’s picture

Assigned: Unassigned » japerry
japerry’s picture

Hello, this issue is due to the trusted contacts module not being reverted after the documents feature is enabled. Once you revert trusted contacts, this issue should go away!

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Marking as postponed pending more info. Please let us know if japerry's suggestion above resolves your issue.

japerry’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
6.49 KB

What a fun issue! Not.

So I've done a bit of re-writing here because a few assumptions made back when trusted contacts and commons_groups were made, have changed.

Biggest change is relying on site-wide permissions for group posting, as well as removing groups from being a required field (when trusted contacts were added)

This essentially means that any 'node/add/(content type)' link should allow someone with sufficient privileges to post outside of a group. We let OG and entity reference permissions handle this now. Because of this, we can remove the node_validate function within commons_groups.

Secondly, with trusted contacts added and og_access optional, we had to make a few use cases for the bw_widget, which is where we really want to be controlling if people could accidently be posting outside of groups. For now (because of site-wide views on the front page), we've decided that the bw_widget should not allow site-wide posting of group content. I've altered the validation functions in this patch to work mainly on the bw_widget to disallow site-wide posting.

I've also fixed the earlier bug where trusted contacts can deny people from being able to post within a group when og_access is disabled.

All said and done, this has been fairly well tested against the above use cases and I think is good to go for 3.6

ezra-g’s picture

Thanks, japerry!

We'll do some functional testing on this today. One part of the code that may need revision is this:

-  else if ($group_audience_type == 'custom' && !empty($node->{OG_AUDIENCE_FIELD})) {
+  else if (!empty($node->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE])) {

At a glance, I'm not sure if we can count on LANGUAGE_NONE here in all cases. Also, marking #2160221: Missing validation on frontpage short form as duplicate of this.

ezra-g’s picture

Based on my functional testing on a single language site, #7 seems like a solid stopgap. I think we can use this approach and then pursue a more comprehensive fix as part of #2020061: Allow users to create content outside of groups, ideally for Commons 7.x-3.7.

Devin Carlson’s picture

My experience has been the same as #9.

The only issue I've come across is the poor UX of displaying an error message to users but not showing the associated field (as it is hidden by Drupal.behaviors.commonsBwExpandableForm).

Required fields are hidden.

I'd suggest doing something like:

      // Hide the hidden fields on load unless they have an error.
      if (!hideables.find('.error')) {
        hideables.addClass('element-invisible');
      }

in order to prevent fields which have an error from being hidden on page load.

Devin Carlson’s picture

An updated version of #10 which addresses an issue where the group form item was never hidden with translation enabled and makes the display of expanded forms which have an error more consistent with standard expanded forms.

Devin Carlson’s picture

An updated patch to change the error message from

Please enter one more groups

to

Please enter one or more groups

Devin Carlson’s picture

Status: Needs review » Fixed

This was committed to Commons 7.x-3.x with http://drupalcode.org/project/commons.git/commit/1b26b13

japerry’s picture

ezra-g’s picture

We're working on a more robust followup fix at #2020061: Allow users to create content outside of groups.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.