Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.5
Component:
node data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Apr 2009 at 03:50 UTC
Updated:
5 May 2009 at 04:00 UTC
So I'm building a view to show all currently logged in users (picture, user name, aim, hometown, ect...) and all my permissions are set open for this test, but I keep getting only duplicate entries. The currently logged in user appears in every column or every grid box rather than showing each individual and distinct user.
Using the is distinct option throws back a huge sql error, but i'm guessing that's because things like hometown aren't distinct.
The "node: distinct" filter from Views 1 would normally solve this, any ideas on how to do it in Views 2 ?
Comments
Comment #1
shrike202 commentedHERES MY (not working) EXPORTED VIEW:
$view = new view;
$view->name = 'logged_in_users';
$view->description = 'Logged In Users';
$view->tag = 'user';
$view->view_php = '';
$view->base_table = 'node';
$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(
'value_2' => array(
'id' => 'value_2',
'table' => 'profile_values_profile_realname',
'field' => 'value',
),
'picture' => array(
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
),
'login' => array(
'label' => 'Last login',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'date_format' => 'time ago',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'login',
'table' => 'users',
'field' => 'login',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'value_1' => array(
'id' => 'value_1',
'table' => 'profile_values_profile_livingnow',
'field' => 'value',
),
'value' => array(
'id' => 'value',
'table' => 'profile_values_profile_aim',
'field' => 'value',
),
'value_3' => array(
'id' => 'value_3',
'table' => 'profile_values_profile_skills1',
'field' => 'value',
),
'rid' => array(
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
),
));
$handler->override_option('filters', array(
'uid_current' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'uid_current',
'table' => 'users',
'field' => 'uid_current',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('header', '
Currently Logged In Users
');
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 1);
$handler->override_option('items_per_page', 24);
$handler->override_option('use_more', 1);
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'value_2' => 'value_2',
'login' => 'login',
'picture' => 'picture',
'value_1' => 'value_1',
'value' => 'value',
'value_3' => 'value_3',
'rid' => 'rid',
),
'info' => array(
'value_2' => array(
'sortable' => 1,
'separator' => '',
),
'login' => array(
'sortable' => 1,
'separator' => '',
),
'picture' => array(
'sortable' => 0,
'separator' => '',
),
'value_1' => array(
'sortable' => 1,
'separator' => '',
),
'value' => array(
'sortable' => 0,
'separator' => '',
),
'value_3' => array(
'sortable' => 0,
'separator' => '',
),
'rid' => array(
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('items_per_page', 18);
$handler->override_option('path', 'users/logged_in');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comment #2
merlinofchaos commentedYou are listing users. Your view is listing nodes. Nodes are not users. Create a view to list users and it will work much better.