function og_views_default_views in Organic groups 5.7
Same name and namespace in other branches
- 5.8 og_views.inc \og_views_default_views()
- 5 og_views.inc \og_views_default_views()
- 5.2 og_views.inc \og_views_default_views()
- 5.3 og_views.inc \og_views_default_views()
- 6 modules/og_views/og_views.views_default.inc \og_views_default_views()
- 7.2 includes/views/og.views_default.inc \og_views_default_views()
- 7 includes/og.views_default.inc \og_views_default_views()
Provide a default view for getting new posts in a group
File
- ./
og_views.inc, line 422
Code
function og_views_default_views() {
// og_mytracker
$view = new stdClass();
$view->name = 'og_mytracker';
$view->description = t('Shows all activity in subscribed groups.');
$view->access = array(
0 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('Recent posts in my groups');
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = t('There are no posts in your subscribed groups.');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'group/mytracker';
$view->use_pager = TRUE;
$view->nodes_per_page = '25';
$view->menu = TRUE;
$view->menu_title = t('My recent');
$view->menu_tab = TRUE;
$view->menu_tab_weight = '0';
$view->menu_tab_default = FALSE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'tab';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->sort = array();
$view->argument = array(
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'og_node_data',
'field' => 'title',
'label' => 'Group',
),
array(
'tablename' => 'node',
'field' => 'type',
'label' => 'Type',
'sortable' => '1',
),
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Title'),
'handler' => 'views_handler_field_nodelink_with_mark',
'sortable' => '1',
'options' => 'link',
),
array(
'tablename' => 'users',
'field' => 'name',
'label' => t('Author'),
'sortable' => '1',
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => t('Replies'),
'handler' => 'views_handler_comments_with_new',
'sortable' => '1',
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'label' => t('Last post'),
'handler' => 'views_handler_field_since',
'sortable' => '1',
'defaultsort' => 'DESC',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'og_uid_node',
'field' => 'currentuid',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
);
$view->exposed_filter = array();
$view->requires = array(
'og_node_data',
'node',
'users',
'og_uid_node',
);
$views[$view->name] = $view;
// OG_UNREAD VIEW
$view = new stdClass();
$view->name = 'og_unread';
$view->description = t('Shows unread posts in subscribed groups.');
$view->access = array(
0 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('Unread posts in my groups');
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = t('There are no new posts in your subscribed groups.');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'group/myunread';
$view->use_pager = TRUE;
$view->nodes_per_page = '25';
$view->menu = TRUE;
$view->menu_title = t('My unread');
$view->menu_tab = TRUE;
$view->menu_tab_weight = '-5';
$view->menu_tab_default = TRUE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'normal';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->sort = array();
$view->argument = array(
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'og_node_data',
'field' => 'title',
'label' => t('Group'),
),
array(
'tablename' => 'node',
'field' => 'type',
'label' => t('Type'),
'sortable' => '1',
),
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Title'),
'handler' => 'views_handler_field_nodelink_with_mark',
'sortable' => '1',
'options' => 'link',
),
array(
'tablename' => 'users',
'field' => 'name',
'label' => t('Author'),
'sortable' => '1',
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => t('Replies'),
'handler' => 'views_handler_comments_with_new',
'sortable' => '1',
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'label' => t('Last post'),
'handler' => 'views_handler_field_since',
'sortable' => '1',
'defaultsort' => 'DESC',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'og_uid_node',
'field' => 'currentuid',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
array(
'tablename' => 'history',
'field' => 'timestamp',
'operator' => '0',
'options' => '',
'value' => array(
0 => '0',
),
),
);
$view->exposed_filter = array();
$view->requires = array(
'og_node_data',
'node',
'users',
'node_comment_statistics',
'og_uid_node',
'history',
);
$views[$view->name] = $view;
// Group home page: river of news
$view = new stdClass();
$view->name = 'og_ghp_ron';
$view->description = t('OG: Group home page - River of news. Default');
$view->page = TRUE;
$view->page_type = 'teaser';
$view->access = array();
$view->view_args_php = '';
$view->sort = array(
array(
'tablename' => 'node',
'field' => 'sticky',
'sortorder' => 'DESC',
'options' => '',
),
array(
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => '',
),
);
$view->argument = array(
array(
'type' => 'gid',
'argdefault' => '1',
'title' => '%1',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->use_pager = TRUE;
$view->nodes_per_page = '50';
$view->exposed_filter = array();
$view->requires = array(
node,
);
$views[$view->name] = $view;
// og/my
$view = new stdClass();
$view->name = 'og_my';
$view->description = t("List user's subscribed groups and provide link to manage subscription");
$view->access = array(
0 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('My groups');
$view->page_header = t('You may edit all your email subscriptions using this convenient page. Also, you might be interested in an <a href="!url" rel="nofollow">OPML feed containing feeds from all your subscribed groups</a>.', array(
'!url' => url('og/opml'),
));
$view->page_header_format = '1';
$view->page_footer = '<?php
$url = url("og/opml");
return theme(\'opml_icon\', $url);
?>';
$view->page_footer_format = '2';
$view->page_empty = t('No subscribed groups');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'og/my';
$view->use_pager = TRUE;
$view->nodes_per_page = '50';
$view->menu = TRUE;
$view->menu_title = '';
$view->menu_tab = TRUE;
$view->menu_tab_weight = '0';
$view->menu_tab_default = FALSE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'tab';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->sort = array(
array(
'tablename' => 'node',
'field' => 'title',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array(
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Group'),
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array(
'tablename' => 'users',
'field' => 'name',
'label' => t('Manager'),
),
array(
'tablename' => 'og',
'field' => 'count',
'label' => t('Members'),
),
array(
'tablename' => 'og_uid',
'field' => 'mail_type',
'label' => t('Email'),
),
array(
'tablename' => 'og_uid',
'field' => 'managelink',
'label' => t('Manage'),
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'og_uid',
'field' => 'currentuidsimple',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
array(
'tablename' => 'og_views',
'field' => 'og_type',
'operator' => '=',
'options' => '',
'value' => '0',
),
);
$view->exposed_filter = array();
$view->requires = array(
'node',
'users',
'og',
'og_uid',
'og_views',
);
$views[$view->name] = $view;
// og view
$view = new stdClass();
$view->name = 'og';
$view->description = 'groups directory';
$view->access = array();
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('Groups directory');
$view->page_header = '';
$view->page_header_format = '2';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = t('No groups');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'og/all';
$view->use_pager = TRUE;
$view->nodes_per_page = '90';
$view->menu = TRUE;
$view->menu_title = t('Groups');
$view->menu_tab = TRUE;
$view->menu_tab_weight = '-5';
$view->menu_tab_default = TRUE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'normal';
$view->menu_parent_tab_weight = '-5';
$view->menu_parent_title = '';
$view->sort = array();
$view->argument = array(
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Group'),
'handler' => 'views_handler_field_nodelink',
'sortable' => '1',
'options' => 'link',
),
array(
'tablename' => 'users',
'field' => 'name',
'label' => t('Manager'),
),
array(
'tablename' => 'og',
'field' => 'count',
'label' => t('Members'),
),
array(
'tablename' => 'og',
'field' => 'description',
'label' => t('Description'),
),
array(
'tablename' => 'og',
'field' => 'subscribe',
'label' => t('Join'),
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'og',
'field' => 'directory',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'node',
'field' => 'title',
'operator' => 'contains',
'options' => '',
'value' => '\'\'',
),
array(
'tablename' => 'og_views',
'field' => 'og_type',
'operator' => '=',
'options' => '',
'value' => '0',
),
);
$view->exposed_filter = array(
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Search for a group by name'),
'optional' => '1',
'is_default' => '0',
'operator' => '1',
'single' => '0',
),
);
$view->requires = array(
'node',
'users',
'og',
'og_views',
);
$views[$view->name] = $view;
// og_tracker
$view = new stdClass();
$view->name = 'og_tracker';
$view->description = t('Shows active posts across the whole site');
$view->access = array();
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('Recent posts across whole site');
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'group/tracker';
$view->use_pager = TRUE;
$view->nodes_per_page = '25';
$view->menu = TRUE;
$view->menu_title = t('Recent posts');
$view->menu_tab = TRUE;
$view->menu_tab_weight = '5';
$view->menu_tab_default = FALSE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'tab';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->sort = array(
array(
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array(
array(
'type' => 'uid',
'argdefault' => '2',
'title' => t('Recent posts for %1'),
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array(
'type' => 'rss_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'node',
'field' => 'type',
'label' => 'Type',
),
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Title'),
'handler' => 'views_handler_field_nodelink_with_mark',
'options' => 'link',
),
array(
'tablename' => 'users',
'field' => 'name',
'label' => t('Author'),
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => t('Replies'),
'handler' => 'views_handler_comments_with_new',
),
array(
'tablename' => 'og_node_data',
'field' => 'title',
'label' => t('Groups'),
),
array(
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'label' => t('Last post'),
'handler' => 'views_handler_field_since',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array();
$view->requires = array(
'node_comment_statistics',
'node',
'users',
'og_node_data',
);
$views[$view->name] = $view;
// in group search - og_search
$view = new stdClass();
$view->name = 'og_search';
$view->description = t('Search within a particular group');
$view->access = array();
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = t('Search');
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = t('No posts found.');
$view->page_empty_format = '1';
$view->page_type = 'teaser';
$view->url = 'og/search';
$view->use_pager = TRUE;
$view->nodes_per_page = '50';
$view->sort = array(
array(
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array(
array(
'type' => 'gid',
'argdefault' => '1',
'title' => t('Search results for %1'),
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array();
$view->filter = array(
array(
'tablename' => 'temp_search_results',
'field' => 'word',
'operator' => '=',
'options' => '',
'value' => '',
),
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array(
array(
'tablename' => 'temp_search_results',
'field' => 'word',
'label' => t('Enter keyword'),
'optional' => '1',
'is_default' => '0',
'operator' => '1',
'single' => '1',
),
);
$view->requires = array(
'node',
'temp_search_results',
);
$views[$view->name] = $view;
// group comments_recent. add a filter to comments_recent from views_comment.inc. also remove a Field: timestamp
$view = new stdClass();
$view->name = 'og_comments_recent';
$view->description = t('Display recent comments block in a group');
$view->access = array();
$view->view_args_php = '';
$view->block = TRUE;
$view->block_title = t('Recent comments');
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'list';
$view->nodes_per_block = '10';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array(
array(
'tablename' => 'comments',
'field' => 'timestamp',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array();
$view->field = array(
array(
'tablename' => 'comments',
'field' => 'subject',
'label' => '',
'handler' => 'views_handler_field_commentlink',
'options' => 'link',
),
array(
'tablename' => 'comments',
'field' => 'name',
'label' => '',
),
);
$view->filter = array(
array(
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'operator' => '>=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'comments',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => COMMENT_PUBLISHED,
),
array(
'tablename' => 'og_ancestry',
'field' => 'picg',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_GID***',
),
);
$view->exposed_filter = array();
$view->requires = array(
'comments',
'node_comment_statistics',
'og_ancestry',
);
$views[$view->name] = $view;
// og_recent_type_term. used for og_panels
$view = new stdClass();
$view->name = 'og_recent_type_term';
$view->description = t('Recent posts for current term filtered by node type and/or taxonomy term');
$view->access = array();
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'list';
$view->url = '';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array(
array(
'tablename' => 'node',
'field' => 'sticky',
'sortorder' => 'DESC',
'options' => '',
),
array(
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array(
array(
'type' => 'nodetype',
'argdefault' => '2',
'title' => '%1',
'options' => '',
'wildcard' => '*',
'wildcard_substitution' => 'all',
),
array(
'type' => 'taxletter',
'argdefault' => '2',
'title' => '%1 - %2',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array(
array(
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink_with_mark',
'options' => 'link',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array(
'tablename' => 'og_ancestry',
'field' => 'picg',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_GID***',
),
);
$view->exposed_filter = array();
$view->requires = array(
'node',
'og_ancestry',
);
$views[$view->name] = $view;
return $views;
}