By toniher on
I'VE JUST FOUND THAT THE PROBLEM IS ACTUALLY A PERMISSION ISSUE/FEATURE IN OG.
Hello,
I'm creating a template for a group node (node-og-group.tpl.php) and I'm inserting a views for listing group members and their profile pictures.
However, only group members appear to be able to see this, but not non-members.
That's the code I'm using in the template:
<?php print views_embed_view('og_members_faces', array('display_id' => 'default', 'check_access' => FALSE), $node->nid); ?>
Any idea how to make this view visible for all visitors (included anonymous ones).
The actual view below:
$view = new view;
$view->name = 'og_members_faces';
$view->description = 'Member listing in grid with user pictures';
$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('fields', array(
'picture' => array(
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
'label' => '',
'relationship' => 'none',
),
'name' => array(
'id' => 'name',
'table' => 'users',
'field' => 'name',
'label' => '',
'link_to_user' => 1,
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'is_admin' => array(
'id' => 'is_admin',
'table' => 'og_uid',
'field' => 'is_admin',
'order' => 'DESC',
'relationship' => 'none',
),
'name' => array(
'id' => 'name',
'table' => 'users',
'field' => 'name',
'order' => 'ASC',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'id' => 'nid',
'table' => 'og_uid',
'field' => 'nid',
'default_action' => 'not found',
'style_plugin' => 'default_summary',
'style_options' => array(
'count' => TRUE,
'override' => FALSE,
'items_per_page' => 25,
),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => 'Members of %1',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'og_group_types',
'validate_fail' => 'not found',
'break_phrase' => 0,
'add_table' => 0,
'relationship' => 'none',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'blog' => 0,
'poll' => 0,
'book' => 0,
'group1' => 0,
'group2' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
'3' => 0,
'4' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
'require_value' => 0,
'reduce_duplicates' => 0,
'validate_argument_is_member' => 1,
'not' => 0,
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'users',
'field' => 'status',
'relationship' => 'none',
),
'is_active' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'is_active',
'table' => 'og_uid',
'field' => 'is_active',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'access all views',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Group faces');
$handler->override_option('empty_format', '1');
$handler->override_option('use_ajax', '1');
$handler->override_option('items_per_page', 25);
$handler->override_option('use_pager', '1');
$handler->override_option('use_more', 0);
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
'columns' => '5',
'alignment' => 'horizontal',
));
$handler->override_option('row_options', array(
'inline' => array(
'name' => 'name',
'is_manager' => 'is_manager',
'is_admin' => 'is_admin',
),
'separator' => '',
));
Comments
Solved
As answered here, it was my fault:
"Organic groups: Group node". In "Validator options" section, disable "Validate current user is a member of a specified group".