How to create a view that lists all groups and their respective contents? I have used organic groups to implement the 'group' &amp; 'group content' functionality.

I have a group content type.
And, I have a group content content type.

How can I create a view that lists all groups' titles and their respective contents' titles clubbed together with that group?

For eg. 

If,

Group 1 has 2 content types: C1 &amp; C2,

Group 2 has 2 content types: C3, C4 &amp; C5,

Group 3 has 2 content types: C6,

Group 4 has 2 content types: C7 &amp; C8,

Then expected result is:


Group 1: C1, C2
Group 1: C3, C4 &amp; C5
Group 1: C6
Group 1: C7, C8
Create a view that lists all content of type "Group Content"
Add a relationship OG membership: Group Node from OG membership and make it mandatory



 - Add field Group Title and exclude it from display choose relationship above




Use Group By Option in Display settings and group by Group Title




And the output will be



Find view export below.. Content type names are group and group_content

$view = new view();
$view-&gt;name = 'group_group_content';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'node';
$view-&gt;human_name = 'Group - Group Content';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['title'] = 'Group - Group Content';
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
$handler-&gt;display-&gt;display_options['pager']['options']['items_per_page'] = '10';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['style_options']['grouping'] = array(
  0 =&gt; array(
    'field' =&gt; 'title_1',
    'rendered' =&gt; 1,
    'rendered_strip' =&gt; 0,
  ),
);
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
/* Relationship: OG membership: Group Node from OG membership */
$handler-&gt;display-&gt;display_options['relationships']['og_membership_related_node_group']['id'] = 'og_membership_related_node_group';
$handler-&gt;display-&gt;display_options['relationships']['og_membership_related_node_group']['table'] = 'og_membership';
$handler-&gt;display-&gt;display_options['relationships']['og_membership_related_node_group']['field'] = 'og_membership_related_node_group';
$handler-&gt;display-&gt;display_options['relationships']['og_membership_related_node_group']['required'] = TRUE;
/* Field: Content: Title */
$handler-&gt;display-&gt;display_options['fields']['title']['id'] = 'title';
$handler-&gt;display-&gt;display_options['fields']['title']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['title']['field'] = 'title';
$handler-&gt;display-&gt;display_options['fields']['title']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content: Title */
$handler-&gt;display-&gt;display_options['fields']['title_1']['id'] = 'title_1';
$handler-&gt;display-&gt;display_options['fields']['title_1']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['title_1']['field'] = 'title';
$handler-&gt;display-&gt;display_options['fields']['title_1']['relationship'] = 'og_membership_related_node_group';
$handler-&gt;display-&gt;display_options['fields']['title_1']['label'] = 'Group';
$handler-&gt;display-&gt;display_options['fields']['title_1']['exclude'] = TRUE;
/* Sort criterion: Content: Post date */
$handler-&gt;display-&gt;display_options['sorts']['created']['id'] = 'created';
$handler-&gt;display-&gt;display_options['sorts']['created']['table'] = 'node';
$handler-&gt;display-&gt;display_options['sorts']['created']['field'] = 'created';
$handler-&gt;display-&gt;display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler-&gt;display-&gt;display_options['filters']['status']['id'] = 'status';
$handler-&gt;display-&gt;display_options['filters']['status']['table'] = 'node';
$handler-&gt;display-&gt;display_options['filters']['status']['field'] = 'status';
$handler-&gt;display-&gt;display_options['filters']['status']['value'] = 1;
$handler-&gt;display-&gt;display_options['filters']['status']['group'] = 1;
$handler-&gt;display-&gt;display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler-&gt;display-&gt;display_options['filters']['type']['id'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['table'] = 'node';
$handler-&gt;display-&gt;display_options['filters']['type']['field'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['value'] = array(
  'group_content' =&gt; 'group_content',
);

/* Display: Page */
$handler = $view-&gt;new_display('page', 'Page', 'page');
$handler-&gt;display-&gt;display_options['path'] = 'group---group-content';