This tutorial describes how to configure the Calendar View to have an individual calendar of events for each Organic Group.

Standard Calendar and Date configuration first:

1. Install Calendar and Date modules (copy the files to the server and enable modules, setup Date default settings under Site Configure)
2. Create new CCK content type (Content Management -> Content Types -> Create new content type) and title it, for example, Event.
3. Add to this Event a new field "Event Date" (of course, you can name that field however you want) and pick the display settings for it.
4. Change the view that displays the calendar - I recommend to enable the default view "calendar" and clone it, giving it a new name, for example "calendar_custom". After that, you can disable the original "calendar" view. We will be editing the new "calendar_custom" and the original view is our fallback, in case we mess things up so badly that we need to start from scratch.
5. Edit the "calendar_custom" view:
5a. Change the Filters: add "Node - Type: Event" because we only want the Events to be displayed on the calendar.
5b. Change the Fields: add your "Event Date".
5c. Change the Arguments: edit default "Date: Date (node)", scroll down to the "Date field(s):" and pick your Event Date (Content: Event Date (field_event_date)) instead of the default "Node: Updated date".
5d. Change the Fields: now you can hide or remove the default field "Node: Updated date".

6. Enable Calendar block. You may also want to enable it only to be displayed on the group pages.

Save the settings. At this point we should have a calendar and the Event type content.
When we create an Event, it shows up on calendar in every group, no matter to which group we assigned the Event. That's why we need to modify the view to fix that.

Edit the View to show Events related to the current group only:

Edit the "calendar_custom" view we created earlier.
Add new Argument "Organic groups: Groups" (for posts) and click Add. Change:
- Action to take if argument is not present: Provide default argument
- Default argument type: Node ID from URL
You can also add:
- Validator = Group nodes

That's it!

Comments

HMahoney’s picture

I have followed this tutorial and have the Calendar showing events specific to each OG and a block which shows "Upcoming Events" specific to each OG. The Upcoming Events block ONLY shows on the OG "home page". What I haven't been able to figure out is how to get the block to display the Upcoming Events on the other OG-related pages. By modifying the view, I have been able to get the block to show ALL events, but not the events specific to the OG as it does on each OG home page.

Any suggestions?

arlinsandbulte’s picture

HMahoney: I think for your case above, you will need to add a views relationship.

HMahoney’s picture

Thanks for your quick reply.

I had tried a relationship with no luck. This is what worked for me:

In order to get the Event Block to show on OG “subpages”:

Edit the Argument "Organic groups: Groups" (for posts) Change:
- Action to take if argument is not present: Provide default argument

Click PHP Code radio button
Add the following code in PHP Argument Code

if ($node = og_get_group_context()) {
$args[0] = $node->nid;
return $args[0];
}
else {
  return NULL;
}

It worked for other blocks as well.

saveriuccio’s picture

Everything works fine except:
I hve 3 group each with its own calendar. When I select a group I correct view only the group calendar. When I add event using the "create event" link from the group detail block it works fine: the event is created and the correct audience is selected with the current group.
The problem is: I added the "add event" link in the calendar page view. And when, in the specific group, I add an avent using that link no group is selected in the audience checkox.

Adding event from the "create event" link give me this url: node/add/event?gids[]=14 , where 14 is the nodeId of the group
Adding event from the "add event" from the calendar page give me this url: calendar/2010-02-04/14

Any advice?

jvieille’s picture

Same problem. The group context seems to be lost when using the "Add" link of the Calendar view.

JV

foredoc’s picture

wilsakov’s picture

Thank you!
I had spent 2 weeks searching for something like this. Your post hep me resolve my issue.

jvieille’s picture

You can also use the "Calendar page".
You have to adjust the page settings for this display:
- Path = node/%/calendar
- Menu type = Menu tab + provide a title i.e. "Calendar" and weight to make it appearing properly on the Group homepage as an additional tab

JV

ailgm’s picture

Thanks for those suggestions.

I am having problems with the links from the week numbers shown in the left column of the calendar page. When using a path of node/%/calendar, those links become, for example: "node/%/calendar/2011-W13", whereas the link above to switch to the Week view gets converted correctly to, for example: "content/calendar-name/calendar/2011-W10".

Do you know any way to fix the links for the week numbers, or is this a bug?

jsimonis’s picture

If you are having trouble with the tutorial, try this:

1. Make sure CCK (Content, Content Copy), Date/Time (Calendar, Date, Data API, Date Popup, Date Repeat API, Date Timezone, Date Tools), and Views (Views, Views Exporter, Views UI) modules are turned on. These are the ones I have turned on and will be needed for the imports to work.

2. Import this content type (Content >> Content Types >> Import)

$content['type']  = array (
  'name' => 'Event',
  'type' => 'event',
  'description' => 'Add an event to the web site.',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'revision' => true,
    'promote' => false,
    'sticky' => false,
  ),
  'language_content_type' => 0,
  'scheduler' => 0,
  'scheduler_touch' => 0,
  'old_type' => 'event',
  'orig_type' => 'event',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'og_content_type_usage' => 'group_post_standard',
  'nodewords_edit_metatags' => true,
  'nodewords_metatags_generation_method' => 0,
  'nodewords_metatags_generation_source' => 2,
  'nodewords_use_alt_attribute' => true,
  'nodewords_filter_modules_output' => 
  array (
    'imagebrowser' => false,
    'img_assist' => false,
  ),
  'nodewords_filter_regexp' => '',
  'bbb_content_type_usage' => false,
  'bbb_content_type_show_links' => false,
  'bbb_content_type_show_status' => false,
  'comment' => '0',
  'comment_default_mode' => '4',
  'comment_default_order' => '1',
  'comment_default_per_page' => '50',
  'comment_controls' => '3',
  'comment_anonymous' => 0,
  'comment_subject_field' => '1',
  'comment_preview' => '1',
  'comment_form_location' => '0',
  'print_display' => 1,
  'print_display_comment' => 0,
  'print_display_urllist' => 1,
);
$content['fields']  = array (
  0 => 
  array (
    'label' => 'Date and Time',
    'field_name' => 'field_eventdate',
    'type' => 'date',
    'widget_type' => 'date_popup_repeat',
    'change' => 'Change basic information',
    'weight' => '-2',
    'default_value' => 'blank',
    'default_value2' => 'blank',
    'default_value_code' => '',
    'default_value_code2' => '',
    'input_format' => 'M j Y - g:i:sa',
    'input_format_custom' => '',
    'year_range' => '0:+3',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'label_position' => 'above',
    'text_parts' => 
    array (
    ),
    'description' => '',
    'required' => 0,
    'multiple' => 1,
    'repeat' => 1,
    'todate' => 'optional',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'default_format' => 'medium',
    'tz_handling' => 'none',
    'timezone_db' => '',
    'repeat_collapsed' => '0',
    'op' => 'Save field settings',
    'module' => 'date',
    'widget_module' => 'date',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'varchar',
        'length' => 20,
        'not null' => false,
        'sortable' => true,
        'views' => true,
      ),
      'value2' => 
      array (
        'type' => 'varchar',
        'length' => 20,
        'not null' => false,
        'sortable' => true,
        'views' => false,
      ),
      'rrule' => 
      array (
        'type' => 'text',
        'not null' => false,
        'sortable' => false,
        'views' => false,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
        'exclude' => 0,
      ),
      5 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'teaser' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      2 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      3 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
);
$content['extra']  = array (
  'title' => '-5',
  'body_field' => '-1',
  'revision_information' => '4',
  'author' => '3',
  'options' => '5',
  'comment_settings' => '7',
  'menu' => '-4',
  'book' => '2',
  'path' => '8',
  'print' => '6',
  'og_nodeapi' => '-3',
  'nodewords' => '1',
);

You have now created the Event content type. Now we will create the view.

3. Go to Site Building >> Views >> Import

4. Import the following View:

$view = new view;
$view->name = 'calendar';
$view->description = 'A multi-dimensional calendar view with back/next navigation.';
$view->tag = 'Calendar';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'field' => 'title',
    'table' => 'node',
    'relationship' => 'none',
  ),
  'field_eventdate_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'short',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => 0,
    ),
    'repeat' => array(
      'show_repeat_rule' => 'hide',
    ),
    'fromto' => array(
      'fromto' => 'value',
    ),
    'exclude' => 0,
    'id' => 'field_eventdate_value',
    'table' => 'node_data_field_eventdate',
    'field' => 'field_eventdate_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'field_eventdate_value' => array(
    'order' => 'ASC',
    'delta' => '-1',
    'id' => 'field_eventdate_value',
    'table' => 'node_data_field_eventdate',
    'field' => 'field_eventdate_value',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'group_nid' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'node',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'group_nid',
    'table' => 'og_ancestry',
    'field' => 'group_nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '4' => 0,
      '26' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
      '12' => 0,
      '11' => 0,
      '13' => 0,
      '14' => 0,
      '15' => 0,
      '16' => 0,
      '17' => 0,
      '18' => 0,
      '19' => 0,
      '20' => 0,
      '21' => 0,
      '22' => 0,
      '23' => 0,
      '24' => 0,
      '25' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'blog' => 0,
      'chatroom' => 0,
      'chat' => 0,
      'forum' => 0,
      'bbb' => 0,
      'book' => 0,
      'event' => 0,
      'groups' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_is_member' => 0,
    'validate_argument_php' => '',
  ),
  'date_argument' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'date',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'date_fields' => array(
      'node_data_field_eventdate.field_eventdate_value' => 'node_data_field_eventdate.field_eventdate_value',
    ),
    'year_range' => '-3:+3',
    'date_method' => 'OR',
    'granularity' => 'month',
    'id' => 'date_argument',
    'table' => 'node',
    'field' => 'date_argument',
    'relationship' => 'none',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'blog' => 0,
      'chatroom' => 0,
      'chat' => 0,
      'forum' => 0,
      'bbb' => 0,
      'book' => 0,
      'event' => 0,
      'groups' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'override' => array(
      'button' => 'Override',
    ),
    'default_options_div_prefix' => '',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '4' => 0,
      '26' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
      '12' => 0,
      '11' => 0,
      '13' => 0,
      '14' => 0,
      '15' => 0,
      '16' => 0,
      '17' => 0,
      '18' => 0,
      '19' => 0,
      '20' => 0,
      '21' => 0,
      '22' => 0,
      '23' => 0,
      '24' => 0,
      '25' => 0,
    ),
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_is_member' => 0,
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'event' => 'event',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Calendar');
$handler->override_option('header_empty', 1);
$handler->override_option('items_per_page', 0);
$handler->override_option('use_more', 0);
$handler->override_option('style_plugin', 'calendar_nav');
$handler = $view->new_display('calendar', 'Calendar page', 'calendar_1');
$handler->override_option('path', 'node/%/calendar');
$handler->override_option('menu', array(
  'type' => 'tab',
  'title' => 'Calendar',
  'description' => '',
  'weight' => '0',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('calendar_colors', array(
  '0' => array(),
));
$handler->override_option('calendar_colors_vocabulary', array());
$handler->override_option('calendar_colors_taxonomy', array());
$handler->override_option('calendar_popup', 0);
$handler->override_option('calendar_date_link', '');
$handler = $view->new_display('calendar_block', 'Calendar block', 'calendar_block_1');
$handler->override_option('block_description', 'Calendar');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('calendar_period', 'Year view', 'calendar_period_1');
$handler->override_option('style_plugin', 'calendar_style');
$handler->override_option('style_options', array(
  'display_type' => 'year',
  'name_size' => 1,
  'max_items' => 0,
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', TRUE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'calendar_1' => 'calendar_1',
  'default' => 0,
  'calendar_block_1' => 0,
));
$handler->override_option('calendar_type', 'year');
$handler = $view->new_display('calendar_period', 'Month view', 'calendar_period_2');
$handler->override_option('style_plugin', 'calendar_style');
$handler->override_option('style_options', array(
  'display_type' => 'month',
  'name_size' => '99',
  'with_weekno' => '1',
  'date_fields' => NULL,
  'max_items' => 0,
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', TRUE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'calendar_1' => 'calendar_1',
  'default' => 0,
  'calendar_block_1' => 0,
));
$handler->override_option('calendar_type', 'month');
$handler = $view->new_display('calendar_period', 'Day view', 'calendar_period_3');
$handler->override_option('style_plugin', 'calendar_style');
$handler->override_option('style_options', array(
  'name_size' => '99',
  'with_weekno' => 0,
  'max_items' => 0,
  'max_items_behavior' => 'more',
  'groupby_times' => 'hour',
  'groupby_times_custom' => '',
  'groupby_field' => '',
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', TRUE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'calendar_1' => 'calendar_1',
  'default' => 0,
  'calendar_block_1' => 0,
));
$handler->override_option('calendar_type', 'day');
$handler = $view->new_display('calendar_period', 'Week view', 'calendar_period_4');
$handler->override_option('style_plugin', 'calendar_style');
$handler->override_option('style_options', array(
  'name_size' => '99',
  'with_weekno' => 0,
  'max_items' => 0,
  'max_items_behavior' => 'more',
  'groupby_times' => 'hour',
  'groupby_times_custom' => '',
  'groupby_field' => '',
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', TRUE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'calendar_1' => 'calendar_1',
  'default' => 0,
  'calendar_block_1' => 0,
));
$handler->override_option('calendar_type', 'week');
$handler = $view->new_display('calendar_period', 'Block view', 'calendar_period_5');
$handler->override_option('style_plugin', 'calendar_style');
$handler->override_option('style_options', array(
  'display_type' => 'month',
  'name_size' => '1',
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', TRUE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'calendar_1' => 0,
  'default' => 0,
  'calendar_block_1' => 'calendar_block_1',
));
$handler->override_option('calendar_type', 'month');
$handler = $view->new_display('block', 'Upcoming', 'block_1');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'field' => 'title',
    'table' => 'node',
    'relationship' => 'none',
    'format' => 'default',
  ),
  'field_eventdate_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => 0,
    ),
    'repeat' => array(
      'show_repeat_rule' => 'hide',
    ),
    'fromto' => array(
      'fromto' => 'value',
    ),
    'exclude' => 0,
    'id' => 'field_eventdate_value',
    'table' => 'node_data_field_eventdate',
    'field' => 'field_eventdate_value',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array());
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'date_filter' => array(
    'operator' => '>=',
    'value' => array(
      'value' => NULL,
      'min' => NULL,
      'max' => NULL,
      'default_date' => 'now',
      'default_to_date' => '',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'date_fields' => array(
      'node.changed' => 'node.changed',
    ),
    'granularity' => 'day',
    'form_type' => 'date_select',
    'default_date' => 'now',
    'default_to_date' => '',
    'id' => 'date_filter',
    'table' => 'node',
    'field' => 'date_filter',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'event' => 'event',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('title', 'Upcoming');
$handler->override_option('items_per_page', 5);
$handler->override_option('use_more', 1);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => '',
  'type' => 'ul',
));
$handler->override_option('block_description', 'Upcoming');
$handler->override_option('block_caching', -1);

Now you will have a tab that will show on each organic group that links to that group's calendar.

pixelsweatshop’s picture

This adds a calendar tab for every node on the site. How do isolate it to just organic groups?

Todd Zebert’s picture

I also have a global calendar for non-OG events in it. How do I get it to NOT show OG events?

I considered creating a new "Group Event" content type and restricting the views per content type, but thought there must be a better programmatic way instead of maintaining two content types.

UPDATE: I found a solution: Update the global calendar view Filters to include "Organic groups: Groups, Is Empty"

IT Sherpa: CTO, Founder, Full stack Dev, Drupal, Wordpress, more. Crushing on Angular, Node, JS & embedded C/C++.
Organizer for Drupal LA https://groups.drupal.org/la Meetup and 2016, 17, 18 LA Camps https://drupalcampla.com/

Todd Zebert’s picture

In arguments we have:
* Date: Date (node) Content: Date (field_date) - From date
* Organic groups: Groups

Changed the Calendar Page path to:
calendar/%/%

IT Sherpa: CTO, Founder, Full stack Dev, Drupal, Wordpress, more. Crushing on Angular, Node, JS & embedded C/C++.
Organizer for Drupal LA https://groups.drupal.org/la Meetup and 2016, 17, 18 LA Camps https://drupalcampla.com/

konrad_u’s picture

note that your first argument should be Organic Groups: Groups and second is Date (you have to rearrange them)

izmeez’s picture

Nice to see this written up simply and so well.

To create as a Menu Tab on group home pages we had to do 2 things:
1. On the Calendar page display make path node/%/calendar
2. On the Default display arguments change the order such that "Organic groups: Groups" is above "Date:"

It might be useful to add this to the tutorial.

Thanks,

izmeez’s picture

I also don't really understand why the new argument setting is changed

Change:
- Action to take if argument is not present: Provide default argument
- Default argument type: Node ID from URL

It seems to work just as well if the action to take is set to "Display empty text" and seems less confusing.

paul555’s picture

Hi all. I successfully created a calendar for each group. I want to ask how can i make a calendar for every user that it will show all the events from the groups the user is a member?

jvieille’s picture

Calendar outside of a group context (the main site page for example) will show all events for the user whatever the groups they are issued from.
Is it what you are looking for?

JV

paul555’s picture

Thanks for your comment. If i understand correctly you say that a calendar outside of groups will show to each user the events from all the groups of the site. My goal is a calendar that it will show to each user only the events from the groups he is a member of. Is that possible?

jvieille’s picture

No, the user will only see the events of the groups he is member of (if you properly set up OG for restricting access to non-members)

This works because the calendar view is configured as if no group argument is given (this happens if the user is not in the context of a group), all events are displayed.

JV

paul555’s picture

Thanks again for your reply. Well i am a little confused because this is my first time in views and calendar and i think i didn't clarify correctly what is my goal. i want to make the following :
A user is member in both groupA and groupB. GroupA has an eventA and groupB has an eventB. Now in user profile page i want to make a calendar which will display both eventA and eventB only. Is that possible?
Also i notice that while in the calendar page of every group the group events show up in the calendar block i added in the group homepage the events don't show up. I am sorry for the mess.

jvieille’s picture

So you already noticed that eventA and eventB correctly show up in the context of their group respectively and exclusively.
You want a calendar that shows a user all consolidated events from all the groups he is member of, correct? For example, if a user is member of both groups groupA and groupB, he will see and access eventA and eventB. He he was only member of groupA, he would ignore eventB, ect...

Using OG means that the user (with OG access enabled) can be in 2 basically different situation
- in the context of a given group (he is member of) - only one at a time of course - which is a bounded area where he can access the group stuff but not the stuff of other groups (regardless his other groups membership) unless a node has a shared audience for several groups
- outside the context of any group: this is the case when he browses the frontpage for example.

I am guessing that you might have used the same calendar in both situations - in which case the general calendar will not show any event because no context is provided in argument.

What was missing in the previous indications was the fact that you need 2 different calendars
- one for group context that you have to setup according these instructions
- one for the general context where you have to use the calendar view that comes with the Calendar module, working out of the box.
You may just want only one calendar showing at a time, so you can condition the general calendar block with the following code
return !(og_get_group_context());

JV

paul555’s picture

Thanks again for your heads up. You understood correctly what i am trying to do. So far i cloned the default calendar view and then in the defaults settings i made the settings listed in this howto so i have one calendar showing the events in every group context. Now for the calendar for general context do i have to clone again the calendar view that comes with the Calendar module? What arguments do i have to use? User idand organic groups : group?

jvieille’s picture

Correct, just enable the calendar that comes with the module and use it as is - no need to care about arguments, they are just right.

JV

paul555’s picture

Thanks again for your reply. I cloned again the calendar view. Now in the /calendar page there are displayed all the node types that are created in my site. So i added a filter for node : Type = Event . Now only the nodes that are from event content type are displayed. But when i test my site with a user that is only member of groupA in the /calendar page there are displayed not only the eventA but also eventB from the groupB which he isn't member of. What i miss?

jvieille’s picture

Turn on the "Organic groups access control" module and check in admin/og/og_access that Visibility of posts = " Visible only within the targeted groups".

JV

paul555’s picture

Thanks for your reply. Your suggestion is working. But i have two problems now. First how can i add a tab in the user profile page such as the howto does in the groups homepages? Second and most important to me but i think i am getting away from the scope of the conversation is that now private groups aren't showing in the /og page. How can i make private groups listed in this page with a join link so the group administrator can decide whenever a user could be a member of this group?

jvieille’s picture

1) I don't see well what you are looking for. Personally, I activate the "my groups" block, which tells the user about which groups he is member of, and from where he can get to the chosen group. Again, I condition this block to make it appearing when not in a group to clean up the UI

 return !(og_get_group_context());

2) That might be counterintuitive, but you should not set groups as "private" in order to get them listed on the /og page
- they will be still "private" in the sense that only member will have access to the group content
You only set groups to "Private" when you don't want anyone aware of the existence of these groups

JV

paul555’s picture

Well i come to a dead end. If i mark a group as private then a user who isn't member of the group can't see the group events in his calendar (my goal). On the other hand if i do this the group won't be listed in the /og page so other users can't join the group because the group is invisible.

jvieille’s picture

No, a non-private group won't show its events for non members - only the groups name is listed (I know, this is confusing). Look at the many options to parametrize a group and try them.

JV

paul555’s picture

Thanks again for your instructions. Well i put the posts private and the groups public and it the calendars is ok. Now i have to make the groups homepage not showing to non group members. Thanks again for your guidelines.

jvieille’s picture

This is not possible, a feature request is open for year, but never addressed.
Nevertheless, I don't think the offered behavior is so wrong
- if a group is "private", nobody will guess its existence, it is like a "secret group"
- if a group is not private, as you set yours, the content is not accessible to non-members, however the group is listed and its homepage can be reachable by anyone. This is quite logical as if someone wish to subscribe, he should be able to display the homepage describing what it is. The group owner would have to take this into account when describing his group.

Well, this is no longer an OG Calendar issue you might better ask your future questions in the context of the OG project by now...
http://drupal.org/project/og

JV

paul555’s picture

Well i find a workaround for my homepage issue. As i use a panel page to create the group homepages i added a selection rule to it :
User: OG membership Current user has "Member" membership status in "Organic Group from node" group.

jvieille’s picture

Great!

JV

yben’s picture

Does anyone know how to do this for Drupal 7?

yben’s picture

You can find the D7 tutorial here: http://drupal.org/node/1268156

yutaolife’s picture

OG calendar in D7 is available.

I am not sure which step you don't understand?

You can mail me. yutao.life@foxmail.com