0

Is it possible to create a list of all the user that didn't create a certain kind of content? I'm making a school graduated student album and each student have to creates a personnel node about there final projet and I need to verify who didn't create is node.

I try to create a list of all user of the student role but when I create a link whit the node with "Content authored" and I add the node Title the users without a Final Project Node hare removed from the list and this is excly the opposite that I need.

Thanks for you help.

1
  1. Create a view showing Users
  2. In Relationships add:
    • User: Content authored
  3. In Filter criteria add:
    • User: The user ID:
      • operator: is not equal to value: 0 (it excludes the anonymous user)
    • Content: Nid:
      • operator: Is empty (NULL) [this gives you a list of users who have authored any content (excluding the anonymous user as mentioned above])

The exported view:

$view = new view();
$view->name = 'users_with_no_content';
$view->description = 'Displays a list of users who have added any content yet.';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'Users with no content';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = TRUE; /* Edit this to false to make a default view enabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'access user profiles';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['style_options']['row_class'] = 'user';
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['style_options']['type'] = 'ol';
$handler->display->display_options['style_options']['class'] = 'user-with-no-content';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: User: Content authored */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'users';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* 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']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['name']['element_type'] = '0';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['element_wrapper_type'] = '0';
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
/* Filter criterion: User: The user ID */
$handler->display->display_options['filters']['uid_raw']['id'] = 'uid_raw';
$handler->display->display_options['filters']['uid_raw']['table'] = 'users';
$handler->display->display_options['filters']['uid_raw']['field'] = 'uid_raw';
$handler->display->display_options['filters']['uid_raw']['operator'] = '!=';
$handler->display->display_options['filters']['uid_raw']['value']['value'] = '0';
$handler->display->display_options['filters']['uid_raw']['group'] = 1;
/* Filter criterion: Content: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['relationship'] = 'uid';
$handler->display->display_options['filters']['nid']['operator'] = 'empty';
$handler->display->display_options['filters']['nid']['group'] = 1;
$translatables['users_with_no_content'] = array(
  t('Master'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('« first'),
  t('‹ previous'),
  t('next ›'),
  t('last »'),
  t('nodes'),
);
| improve this answer | |
  • That work, that give a list of user who didn't publish anything. But in my case, I need to list user who didn't publish a particular Content type. Exemple I need to list user who didn't created a node of content type A regardless if they already publish a content type B – Marc-André Landreville Mar 31 '15 at 23:57
  • There is a problem with the that relationship: "User: Content authored". Only admin can view the results. Issue submitted here drupal.org/node/1838796 – Mouneer Mar 17 '16 at 19:15
0

If there is any required field in the content, then you add that field in filter criteria and choose Operator as Is empty'. Do not forget to `add a relationship of 'user:content authored'.

Hope this will help you.

| improve this answer | |
  • When I test that it didn't work. The user who didn't publish the content type A are removed from the list. – Marc-André Landreville Apr 1 '15 at 0:04
  • then remove content:published field from the filter criteria. it will show all the user who has created any content. If you want to list user based on particular content type, then add content:type field in filter criteria and select your content type. – bisw Apr 1 '15 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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