By plepot on
Hello,
I am pulling my hairs to to achieve the following:
I am building a website where users can belong to different organic groups. It is a local community website and it may happen that one single user belongs to two or more groups. I want such users to be presented with a page of all members for the groups they belong to.
Can anyone help me out on sorting this out?
Phil
Comments
Fixed
I fixed this through this view:
$view = new view;
$view->name = 'og_members_my_groups';
$view->description = 'Member listing for my groups';
$view->tag = 'og';
$view->view_php = '';
$view->base_table = 'users';
$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('relationships', array(
'nid' => array(
'id' => 'nid',
'table' => 'og_uid',
'field' => 'nid',
),
));
$handler->override_option('fields', array(
'name' => 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,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 0,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'is_admin' => array(
'id' => 'is_admin',
'table' => 'og_uid',
'field' => 'is_admin',
'order' => 'DESC',
'relationship' => 'none',
),
'is_active' => array(
'id' => 'is_active',
'table' => 'og_uid',
'field' => 'is_active',
'order' => 'ASC',
'relationship' => 'none',
),
'name' => array(
'id' => 'name',
'table' => 'users',
'field' => 'name',
'order' => 'ASC',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'status' => array(
'id' => 'status',
'table' => 'users',
'field' => 'status',
'operator' => '=',
'value' => 1,
'group' => 0,
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'relationship' => 'none',
'expose_button' => array(
'button' => 'Expose',
),
),
'uid' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'uid',
'table' => 'og_uid',
'field' => 'uid',
'relationship' => 'nid',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 90);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 1);
$handler->override_option('style_options', array(
'grouping' => '',
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'og/usersformygroups');
$handler->override_option('menu', array(
'type' => 'default tab',
'title' => 'List',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'normal',
'title' => 'List',
'description' => '',
'weight' => '0',
));
Thaks for sharing !
Many thanks for sharing your work !
You saved me from pulling all my hairs too ;)
Thank you ;)