Last updated 13 March 2016. Created on 7 June 2013.
Edited by kari.kaariainen, Jaypan, aaronschachter, clemens.tolboom. Log in to edit this page.

Once a group type has been created, a content type needs to be designated as group content. This can be achieved by either editing an existing content type like Article or Basic Page or creating a new content type as illustrated below.

Navigate to /admin/structure/types/add and give the new content type a name and description. Set the defaults according to your content management needs. On the Organic Groups tab the Group content checkbox should be selected.

Save the Group Post content type and return to the content types page.

If you go the Manage Fields tab for the Group Post content type, you will see a new field labelled Group audience with a machine name og_group_ref and an Entity Reference field type. This field is used to provide a link between a group content node and the group node to which it is associated. Other fields can be added to group content entities to control the visibility of the group content.

Setting up group content for multiple group types

With the above method, multiple content types can be set up as group content for a single group type. However, the group that og_group_ref refers to is shared across all content types that have the og_group_ref field. This means that if you have two group types, Group A and Group B, all group audience content types with og_group_ref can only point to either Group A or Group B, and changing the value in the og_group_ref field on any content type, will change it for all other content types.

To have multiple group types, and have different group audience content for each group type, you need to set up multiple group ref fields. You can do that as follows:

  1. Set up group audience for Group A as described above.
  2. Create your group audience content type(s) for Group B, but do not set them as group content. If you have already created these content types as group content, go to the Manage Fields tab, and delete the og_group_ref field. (Note that you will lose all values stored in this field, but there is no way around this).
  3. Go to admin/config/group/fields
  4. Select the the content type you created to be a group audience.
  5. Under Fields, choose "Group Audience" if it's not already selected
  6. Under Field name, enter a unique field name, replacing the default og_group_ref (example: og_group_client_ref)
  7. Click the Add field button at the bottom of the page
  8. Go to the "Manage fields" page for your content type (example: admin/structure/types/manage/client/fields). Your new field should be visible in the list. Edit the field, and choose Group B as the Target Bundle for the field.

Note, however, that your new field will not be listed on admin/config/group/fields due to a long standing bug (see https://www.drupal.org/node/1674078
). The field itself should be totally functional and configurable though at admin/structure/types/manage/client/fields.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

ranjeesh’s picture

With the above method, multiple content types can be set up as group content for a single group type. However, the group that og_group_ref refers to is shared across all content types that have the og_group_ref field. This means that if you have two group types, Group A and Group B, all group audience content types with og_group_ref can only point to either Group A or Group B, and changing the value in the og_group_ref field on any content type, will change it for all other content types.

Is it still true with the latest version of organic groups that we have to rename and add the fields instead of sharing the same name "og_group_ref"?