To display the group's name on the respective group content pages follow these steps:

  1. Set up new View at admin/structure/views and create a Block display of Format Fields and leave the default at Content: Title
  2. Under Relationships add:
    • OG membership: OG membership from Content group (no need to require relationship)
  3. Under Contextual Fiters add:
    • OG membership: Group ID - select OG membership from node group for relationship
      • When filter is not available - Provide default value () and select Current OG group from context
  4. Under Pager select Display a specified number of items
    • Set 1 item to display
    • Set 0 as Offset
  5. Under Fields select the Content:Title field
    • Select Group node from OG membership
  6. Save your view and go to your blocks page and place the block where you would like it to display on the OG group content pages.

What this does is display the OG Group's name for the content title and loads according to the page the group belongs to. Won't display on non-group pages.

Comments

legovaer’s picture

Isabug,

I've edited this page. The solution you gave wasn't working when there was no content in the OG.

abutze’s picture

A little remark to step 3:

3. Under Contextual Fiters add:
OG membership: Group ID - select OG membership from node group for relationship
When filter is not available - Provide default value () and select Current OG group from context

If you want to display the group name on non-group pages, instead of selecting "Current OG group from context" in the contextual filter, select "The OG groups of the logged in user".

fadgadget’s picture

does anyone know the new relationship thats required to get this working? Not having much luck with ny relationship. Ihave achieved it before.

thanks

liusashmily’s picture

The new relationship in step 2 is: OG membership from node group (no need to require relationship).

That is the only difference from the above steps.

Good Luck

bobgeier’s picture

Some folks (like me) might find this page while looking for the method to add a group's name to a page without a group context. For example, creating an overall list of events on a site, and wanting the sponsoring group's name (if any) listed with each event. Since OG relationship names are not at all intuitive, here's the formula.

  1. Set up the view as normal.
  2. Under Relationships add OG Membership: OG Membership from Node (make it not required or required depending on your use case).
  3. Under Relationships add OG Membership: Group Node from OG Membership. In the settings dialog Relationship dropdown select "OG membership from Node".
  4. Under Fields add Content:Title. In the settings dialog Relationship dropdown select "Group Node from OG Membership".

You should be all set.

TravisJohnston’s picture

Current setup does not allow me to assign a relationship to Content Title.

UPDATE:
Actually not assigning the relationship to the content title worked.

Thank you kindly,

Travis Johnston

Creo Coding - Let's Start Our Journey!
Owner and Web Developer
http://www.creocoding.com

Facebook - Facebook.com/CreoCoding
LinkedIn - http://lnkd.in/rQrdS7

tammo’s picture

In step 4 you mention that you should only display 1 value. But what when the current content belongs to multiple groups?

I hope you can help me with that!

Tools for Research
http://www.toolsforresearch.com (international)
http://www.kleinestappen.nl (NL)

All using open source software: Drupal, Limesurvey

TLWatson’s picture

It took me a while but I finally figured this out. Here is how to make a view for one piece of group content that shows ALL the groups it is in:

Contextual filter: (if this is supposed to be on the group content's node page.)
Node ID - default value: Content ID from URL (do not use relationship)

Relationships:
OG membership: OG membership from Content
OG membership: Group Content from OG membership (link first relationship)

Fields:
If referring to group, link second relationship (called 'Group node from OG membership' by default)