So I have an interesting request and I'm hoping some of you guys here might know a decent way to solve this. On one of our homepages we have a block that shows current authors posts. This was a simple view that just showed authors posts sorted by date. However now they want something a bit more specific detailed below.

In stead of just random posts, the first request is that is shows 5 post but of each post they should all be a specific author and NOT repeated in any way. For instance you have Author A, B, C, D , and E. The view would look like this.

A = His/her latest post

B = His/her latest post

C = His/her latest post

D = His/her latest post

E = His/her latest post

So each highlighted author shows their latest post and none of those authors repeat.

The next thing they want is an ability to pick and choose WHO those top 5 authors will be. So one week it might be A, B, C, D, and E; but they next week it could be F, A, H, J, and Y. This seems like a fairly complex view and not to mention the interfaced required for the UI portion. Thoughts?

2 Answers 2


If you're marking stuff to include in some front page view of recent stuff this way I would just make a Nodequeue and let staff pick the items in that listing by hand. When you say "i want to pick them ..." you basically are throwing automation out the window.

If you really wanted to you could make a SmartQueue with your sql SELECT statement to do the automated logic -- the nodequeue UI would still allow overriding of the automatic generated list by your site users.

  • I second the suggestion to use Nodequeue, unless the site has an overwhelming amount of content. Otherwise you will end up doing a lot of complicated coding for what should really be a simple task. And if they decide they want something different there later (ie: all 5 posts must be by one author) you won't have to change anything as they can curate the queue however they like.
    – R. Durham
    Commented Dec 17, 2013 at 2:34
  • Not a bad idea. I'll start with Nodequeue for now and move on from there.
    – doodirock
    Commented Dec 17, 2013 at 6:08

It looks like you might want to use views>advanced>other aggregation to make the posts distinct on the author field.


Create a view of nodes that displayed recent posts by selected authors, then ensure that each author did not repeat by making them distinct.

To allow the site administrators (or other users by role) to select authors I would suggest using a flag to indicate the top authors. You could then sort the view by the flag date (make sure you create a relationship to the flag) and limit the view to 5 results

Solution (updated)

To 'filter by distinct', install views_distinct module, and in your view of recent nodes by selected author, set a filter (in author uid field settings) based on the author uid field:

enter image description here

Here is an export of an example view of article nodes (does not include flag selection for portability):

$view = new view();
$view->name = 'drupal_answers_97449';
$view->description = 'http://goo.gl/gQLr2A';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'drupal answers 97449';
$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'] = 'Top 5 authors';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'name' => 'name',
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  'name' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
/* Relationship: Content: Author */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* Field: Content: Author uid */
$handler->display->display_options['fields']['uid']['id'] = 'uid';
$handler->display->display_options['fields']['uid']['table'] = 'node';
$handler->display->display_options['fields']['uid']['field'] = 'uid';
$handler->display->display_options['fields']['uid']['exclude'] = TRUE;
/* 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']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = 'author';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
/* 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'] = 'post title';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* 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;

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

  • Seems easy enough. I've turned on aggregation and done COUNT Distinct for the "Content: Author uid" but for some reason it still shows multiple posts from 1 author. :(
    – doodirock
    Commented Dec 17, 2013 at 1:14
  • my apologies, just tested and I couldn't get this to work as above either, needed views_distinct module. Will update answer Commented Dec 17, 2013 at 10:23
  • updated (and tested) revised answer above Commented Dec 17, 2013 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.