Hello,

I was trying to use og_register module, and in quite a couple of issues it is written make sure that the field group audience on user accounts is configured to show on the registration form. So I tried to do so in a clean install before enabling it in my production site.

When I did the clean install with DRUPAL + OG I noticed that in » Administration » Configuration » People » Account settings, there are now 2 fields which are added automatically:

  • Group membership og_user_group_ref
  • Other groups og_other_user_group_ref

When I look to the user account page, under "Group membership" the user's group are listed but "Others groups" doesn't display anything not even the label , even though "Other groups" field is not hidden and they are other groups in the site to which the user can suscribe.
Well this last comment would fit in another issue like "Other groups" field are not being displayed, but it might be related to the initial issue here so I don't want to flood the og issue queue...

On my production site, in the user account fields I only have:

  • My Groups og_group_ref

well, Iknow the label "My Groups" doesn't matter it correspond to the previous "Group membership" label.
And here when I look to the user account page I see the user's group under og_group_ref, then if I add "Other Groups" it comes as "og_group_ref_other_groups" field but nothing is diplayed in the user page.

Back to the clean install, after creating "Group" and "Group Content" content types, and add "group audience" field to the user account, I run the module devel_generate to create users and content, but when I create content I get the following error:

Warning: Invalid argument supplied for foreach() in _og_update_entity_fields() (line 1065 of /drupal/sites/all/modules/og/og.module).
Warning: Invalid argument supplied for foreach() in _og_update_entity_fields() (line 1065 of /drupal/sites/all/modules/og/og.module).
EntityMetadataWrapperException: Unknown data property og_user_group_ref. in EntityStructureWrapper->getPropertyInfo() (line 339 of /drupal/sites/all/modules/entity/includes/entity.wrapper.inc

So I am a bit confused, I wonder if it is a real bug or if og has changed it's way to manage membership.
Before, to see the user's group in the user's page, one would add "group audience" field" to "user" entity, which field is og_group_ref
and these past settings are working on my production site.

Now, as I noticed on a clean install, the user's group field are automatically added in the user's account when one enables OG, but now the field is og_user_group_ref. Which indeed lists the user's groups in the clean install.
And now the "Others group" field is og_other_user_group_ref, but like in the production site with og_group_ref_other_groups , nothing gets displayed under this field even though many other groups are available.

As I was willing to install og_register, I added the "Group Audience" to the user account fields list, and set it to be displayed on the registration page (together with og_register enabled and added to the "Group" entity). But no groups are displayed in the registration page.

To my opinion the OG fields name are conflicting.

If you could shed some light on this,

Thank you

Comments

drupalycious’s picture

Title: og_user_group_ref and og_user_group_ref conflict » og_group_ref and og_user_group_ref conflict

wrong title

drupalycious’s picture

If one deletes the field og_user_group_ref, then it is not anymore possible to add it bacj as it is not available in the" Add existing field" list,
while og_group_ref is always there.
As soon as one deletes og_user_group_ref field there seems to be no more option to display the user's groups list.
Adding og_group_ref doesn't bring the group's list back.

julianmancera’s picture

Hi,

If you delete and recreate the group field it will create the fields back again, but this creates field conflicts and exceptions while assigning group audience to the users

OgException: <em class="placeholder"></em> is not a valid group-audience field. in og_membership_create() (line 1401 of sites\all\modules\og\og.module).

Julian Mancera

julianmancera’s picture

Issue summary: View changes

cleaning some part of the text which was not need.

rv0’s picture

I manage to get around this same issue like this:

ran following query

UPDATE `og_membership` SET field_name = 'og_user_node' WHERE entity_type = 'user' 

then run following file with drush php-script command:

  $field_name = "og_user_node";
  $og_field = og_fields_info(OG_AUDIENCE_FIELD);
  $og_field['field']['settings']['target_type'] = 'node';
  $og_field['instance']['label'] = t('Group membership');
  $entity_info = entity_get_info('user');
  foreach (array_keys($entity_info['bundles']) as $user_bundle) {
    og_create_field($field_name, 'user', $user_bundle, $og_field);
  }

Then you will have an og_user_node field..

hansrossel’s picture

Had the same problem, solution #4 works, thanks!