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.
Comments
How does this fit in with Panels?
How would Panels fit in with this equation? Now that Organic Groups is pushed to Panels integration how would you display this calendar in the Group Panel Page?
I have been given the task to create a Group Event Calendar in Drupal 7. In Drupal 6 I would have accomplished this easily with OG, Context and Spaces modules.
But my attempts to create something similar in Drupal 7 ends up a ghastly abortion.
The above solution seems to work outside the Panels paradigm. Is there a way that the calendar could be displayed inside the panel page instead as a menu tab?
personxx, try using spaces_og
personxx, try using spaces_og and features to enable your calendar. You'll need the filter 'Spaces: Content in current space (True)' and maybe the Spaces Feature Page Access setting. Other than that I followed this tutorial. Your feature will appear in the features menu when enabled. You may also want to get og_create_perms and the patch in its issue queue for og that limits the OG Create Content Links block to only show content types which the user has permission to create.
OG calendar with panels
I finally had some success with this problem myself though still not exactly what I want yet, it at least works now. I followed steps 1-4 given by KarenS see (http://drupal.org/node/1268156) but instead of adding the tab for the calendar on step 5, in panels, I created content in the region I wanted and added the OG calendar view created previously. I changed the view from the default of master to month, I preferred the block view however I havent had success with that yet.
Og calendar with panels
Did you succeed in setting up Group calendar with panels? If you did could you share the howto? Thanks
Miro Marchi
Allow the user to filter groups
This is very helpful if you want to make sure the user can only see the groups they're allowed to, but what if you want them to be able to see all groups as well as a subset? We have a need for someone to use the exposed filters to show which events they wish to view for specific combinations of groups. The Better Exposed Filters module is very helpful, but I can't seem to get the group names/audience to show for the filtering. The only choices are the gid, the delta, and whether or not it's group content. Am I missing a relationship somewhere? How can I have it filter by user-chosen organic group name?
I've found other people asking the same question online (http://drupal.stackexchange.com/questions/18151/seo-view-page-using-og-d...), but no answers.
Help?
Bump. that includes a views
Bump.
that includes a views search option. I don't even see the og search block in views...
anyway, i'd like to be able to create a custom search for OG... I now managed to list all the nodes in a block, but I don't see the selection filters that I set up as exposed.
I just can't
Hi there, I followed every step but my view is filtering by nid not by gid, so the calendar shows the wrong content in the inadequate group calendar. I've been scratching my head for a day and a half but at the end, the only combination of relationship and contextual filter that makes sense is the one posted by Karen, so, what can it be happening here?
relationships: OG membership: OG membership from Node
contextual filters: (OG membership from node) OG membership: OG group gid
Thanks in advance, my project is only missing this calendar thing and is over :P
nico
THE VERY LITTLE AGENCY
I follow the steps exactly as
I follow the steps exactly as outlined above and everything goes fine until step 3 - when I try to save the Contextual Filter I get an error message in the top of the Contextual Filters window: "An illegal choice has been detected. Please contact the site administrator."
I then move this Contextual Filter above the Date Filter as specified, but then the calendar view vanishes completely.
I would be tremendously grateful for any help resolving this problem. Thanks!
The illegal choice issue I
The illegal choice issue I was getting was being caused by the beta version of the Flag module I had installed. See: drupal.org/node/1660646
However, even when I got this error message resolved, the contextual filter appears to be applied but all my events disappear. I thought this was supposed to filter to show just events that are in my group, but it makes everything disappear.
Dates from other Contents
Hello!
my calender shows only the dates that are posted in those groups that the user subscribed - perfekt!
But what is need to be done if i want to have dates from other contents (contents which are not in the groups) in the same calender?
I tried to rearrange the contextual filter, but it didn't make a difference.
Is it possible to show a second overlay on the Calender?
thanks for help
Displaying a calendar of content posted to an OG
The way I eventually got this to work was to create a bespoke views handler and filter by the result 1/0
This is really horrible and 'hacky' - but it worked
Worked Perfectly
I'd been wrestling with this for some time and the parent post by Karen S worked perfectly - Thank you, much appreciated & thanks for all you work on calendar - you're a pro
Bingo!
I was wondering how in the world to make a calendar with OG 7.2. Thanks!
(Now if I could only figure out how to add breadcrumbs to the mix...)
facing a issue about that og calendar
I am facing a issue about that og calendar. I reference the D7 og calendar(http://drupal.org/node/1268156). And now, the calendar display under the group is correctly. But, the data(or, we can say event not display in calendar). Would you please tell me that how to fixed it?
This method no longer works
This method no longer works as documented with the latest OG update. OG has changed contextual filters to be based on etid (entity id), instead of gid (group id), so it doesn't appear to be possible to do this any longer without writing code. The simplest fix I found was to make a small change to the query using hook_views_query_alter. To do this, follow the instructions above with two notable changes:
Next, create a file called MODULENAME.views.inc in an existing (or new) custom module directory. Add the following code:
This will force the view to filter by the id of the group instead of the id of an individual node belonging to the group.
Question
Does this still work? I tried using the code but was unsuccessful. I could be doing something wrong.
This didn't work for me
This didn't work for me either. I also could be doing something wrong. I see the calendar tab in the group and can view the calendar. It just doesn't show the events for the group.
Working
It is now working for me. I took another crack at the directions and it works like a charm. I believe that I initially did not set the GID (provide default settings) to the proper context that was needed.
This worked for me
Thank you, this was what I was looking for!!!
Menu tabs
I have set Month Path to be: /node/%/calendar
and Menu to be:
Type: Menu tab
Title: Calendar - Month
Menu: Navigation
But, I am getting the tabs on all nodes : View, Calendar - month
Not just on the Group nodes like I want?
Where is my error? In a Relationship?
Validation.
If anyone else has this problem: the answer is to set validation criteria on the GID contextual filter. Choose "Organic groups" and if the argument doesn't validate the response should be 404 - page not found. I did that for all of my OG calendar displays and the tab now only shows on group nodes (where said arg validates correctly as a GID).
Threading fail
I hit the right reply button, but after logging in apparently that doesn't count :/
Y U NO REDIRECT ME RIGHT?