Getting these unexpected errors when using an Organic Group Widget on an Entity Reference field and trying to add a node.

Notice: Undefined index: membership_type in og_membership_create() (line 1225 of /var/www/client/docroot/sites/all/modules/contrib/og/og.module).
EntityMalformedException: Missing bundle property on entity of type og_membership. in entity_extract_ids() (line 7778 of /var/www/client/docroot/includes/common.inc).
The website encountered an unexpected error. Please try again later.

Getting a lot of 'line 236' notices (shown below) when running update.php and in various situations when editting a content type relating to entityreference.
(in my case a Drupal Commerce Product Display Page references a product that has an entityreference field referencing an Organic Group (Group) node)

Notice: Undefined index: membership_type in og_entity_property_info() (line 236 of /var/www/client/docroot/sites/all/modules/contrib/og/og.module).

Not sure if this 'line 236' notice is a different issue.
Also not sure if these are pure og bugs or if they are entityreference related.

Tested with
Drupal 7.20
OG 2.0 and dev 2.x (2013-Mar-08)
Entityreference 1.0
Commerce Kickstart 2.4
I use 'Organic groups access control'.

Temporary Workaround

Don't use the OG Reference widget for the Entity Reference field. Using the Select List widget works fine.

Comments

silkogelman’s picture

Title: Undefined index: membership_type in og_membership_create() (line 1225 » Organic Group Widget on an Entity Reference field not working properly
Robin van Emden’s picture

The workaround is still needed for me to be able to edit an existing group content node. If I do not use the Select List it doesn't remember which group you are in.

WebSinPat’s picture

I am getting the 'line 236' error in my Commons 3 installation. I am not getting the other errors in the original post, I'm not sure if my issue is related or not.

I attempted the workaround suggested to switch from OG Reference widget to select list, but that did not seem to get rid of the line 236 errors. (If I understood the workaround suggestion correctly: what I did was in all my content types that have group reference fields [which in commons includes post, poll, wiki, question, etc], I switched the widget from OG to select list.) But I still see the line 236 errors.

And in fact, changing the widget seems to have generated a new error:
Trying to get property of non-object in OgSelectionHandler->getReferencableEntities() (line 40 of /usr/www/users/incite/incite7/profiles/commons/modules/contrib/og/plugins/entityreference/selection/OgSelectionHandler.class.php).

I have little idea how OG fields function. any help would be appreciated.

WebSinPat’s picture

Issue summary: View changes

clarified the line 236 notice a bit