It's been a fairly common issue on this queue about the end-all-be-all effectiveness of node: distinct within views 1 and 2, and I guess the consensus after searching is its something of a drupal/views/mysql glitch with no clear explanation. However, I'm wondering if this can be applied to USERS within user views. Can we force a way to make sure that no UID is shown twice? (although, I suppose if it were that simple, no NID would be shown twice, thus making all of the distinct functionality irrelevant). I'm having issues preventing distinct issues in views with users, although since I understand that distinct is a mysql-specific function, it would work equally for both nodes and users?

Any help clearing up the functionality in this department would be great!

Thanks...

Comments

dawehner’s picture

You can try to set the distinct setting see

$view = new view;
$view->name = 'users_distinct';
$view->description = '';
$view->tag = '';
$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 */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['distinct'] = TRUE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['link_to_user'] = 1;
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;

But the problem is that you cannot be sure, that this reallly helps. Mysql Distinct is not the real holy grail.

If you have duplicate issues ofter you have misconfigured your view, or a certain join is not the right one.

esmerel’s picture

Status: Active » Closed (fixed)

Solution suggested, no response.

ridefree’s picture

Having a similar issue.

Trying to create a block of the 50 most recent posters (by content type).
Just displaying the user picture, but have tried using UID as well to find something I could use the 'Distinct' on as I only want a user displayed once.

Been looking around quite a bit on a way to do this.
and appreciate the solution proposed by dereine above, but to be honest I'm not quite sure what to do with that.

maybe it's just not something one should expect to do if they don't have great php/mysql skills, but am hoping there's a way to build a view I just haven't figured yet.

thanks for continued help on this tho.

ridefree’s picture

fyi ...
I'm currently using a view of the User type, which kinda works.
and I suppose is how I should be using this, but I don't have access to node info (like sorting by last blog posted)

instead am sorting by last user access, and displaying all users with role blogger.

still a ways to go, but getting there.

antonio.torres’s picture

^ Having the same issue, no dice yet