0

I have tried to achieve total og group members count and users count in a view. detail and complete information on this link user count and posts count in a og view in my case in above link comment number 62 working nicely.
But one strange problem I am facing which is only admin can view total numbers of users. But when I login as a site member my view display all the fields properly but total users counts fields shows 0 you can check output of my view on this link my view output I am attaching export of my view also any help will be great.

$view = new view();
$view->name = 'khola';
$view->description = 'All Public  Groups For site users ';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'All Public  Groups For Blind Stars';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'All Public Group For Blind Stars';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['group_by'] = TRUE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'title_1' => 'title_1',
  'uid' => 'uid',
  'group_group' => 'group_group',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'title_1' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'uid' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'group_group' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
$handler->display->display_options['style_options']['caption'] = 'All Public  Groups';
/* Relationship: OG membership: OG membership from Node group */
$handler->display->display_options['relationships']['og_membership_rel_group']['id'] = 'og_membership_rel_group';
$handler->display->display_options['relationships']['og_membership_rel_group']['table'] = 'node';
$handler->display->display_options['relationships']['og_membership_rel_group']['field'] = 'og_membership_rel_group';
/* Relationship: OG membership: User from OG membership */
$handler->display->display_options['relationships']['og_membership_related_user']['id'] = 'og_membership_related_user';
$handler->display->display_options['relationships']['og_membership_related_user']['table'] = 'og_membership';
$handler->display->display_options['relationships']['og_membership_related_user']['field'] = 'og_membership_related_user';
$handler->display->display_options['relationships']['og_membership_related_user']['relationship'] = 'og_membership_rel_group';
/* Relationship: OG membership: Node from OG membership */
$handler->display->display_options['relationships']['og_membership_related_node']['id'] = 'og_membership_related_node';
$handler->display->display_options['relationships']['og_membership_related_node']['table'] = 'og_membership';
$handler->display->display_options['relationships']['og_membership_related_node']['field'] = 'og_membership_related_node';
$handler->display->display_options['relationships']['og_membership_related_node']['relationship'] = 'og_membership_rel_group';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = 'Group Name';
/* Field: COUNT(Content: Title) */
$handler->display->display_options['fields']['title_1']['id'] = 'title_1';
$handler->display->display_options['fields']['title_1']['table'] = 'node';
$handler->display->display_options['fields']['title_1']['field'] = 'title';
$handler->display->display_options['fields']['title_1']['relationship'] = 'og_membership_related_node';
$handler->display->display_options['fields']['title_1']['group_type'] = 'count';
$handler->display->display_options['fields']['title_1']['label'] = 'Total Posts';
/* Field: COUNT(User: Uid) */
$handler->display->display_options['fields']['uid']['id'] = 'uid';
$handler->display->display_options['fields']['uid']['table'] = 'users';
$handler->display->display_options['fields']['uid']['field'] = 'uid';
$handler->display->display_options['fields']['uid']['relationship'] = 'og_membership_related_user';
$handler->display->display_options['fields']['uid']['group_type'] = 'count';
$handler->display->display_options['fields']['uid']['label'] = 'Total Members';
/* Field: Content: Group */
$handler->display->display_options['fields']['group_group']['id'] = 'group_group';
$handler->display->display_options['fields']['group_group']['table'] = 'field_data_group_group';
$handler->display->display_options['fields']['group_group']['field'] = 'group_group';
$handler->display->display_options['fields']['group_group']['label'] = 'Join Group';
$handler->display->display_options['fields']['group_group']['type'] = 'og_group_subscribe';
$handler->display->display_options['fields']['group_group']['settings'] = array(
  'field_name' => '0',
);
/* Contextual filter: COUNT(User: Uid) */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['group_type'] = 'count';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'group' => 'group',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'public-groups';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'khola';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_2');
$handler->display->display_options['path'] = 'khola';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.