D7 Organic Group Calendars
There have been lots of questions about how to create a calendar for an Organic Group that is limited to displaying only events for a single group. This can be done by creating a calendar in the normal way. Then, once it is working correctly for all content, add an Organic Groups contextual filter to each display, right before the date contextual filter. It will not be immediately obvious how to do that, so here is how:
1) Be sure to enable the Organic Groups Context module (it comes as a part of the Organic Groups package). This is needed to provide a method we can use to deduce which group should be displayed.
2) Edit the calendar view. Add a relationship to the view for "Group membership: Node group membership ".
For 7.x-2.0:
Add a relationship to the view for "OG membership: Group Node from OG membership".(The Node group that is associated with the OG membership.)
3) Add a new contextual filter to each display. You will need "OG membership: Group gid ". Where it says "When the filter value is NOT in the URL" choose the option to add a default value and select the option "Current group from context".
For 7.x-2.0:
You will need "OG membership: Group ID" ("Og membership "gid" property"). Where it says "When the filter value is NOT available" choose the option "Provide default value" and select the option "Current OG group from context".
4) Re-arrange the contextual filters so that the OG filter is before the date filter.
5) To see the calendar as a 'Calendar' tab on the Group node, change the path to 'node/%/calendar' and set it up to be a Menu tab with the name of 'Calendar'. When you view the group node you should see the tab, which in turn should show you the calendar.
You can play around with other options for altering the path to inject the GID where it can be deduced from where you are on the site. If you want to test this in the preview by typing in a GID as the argument, note that we are looking for the GID, which in Drupal 7 is NOT the same as the group NID.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion