-1

Following this tutorial https://drupal.stackexchange.com/questions/1709/using-views-how-to-list-users-and-have-the-number-of-nodes-created-by-them (the one of the most voted answer) I found an issue with the permissions of the view, I'm getting the list of users only when I'm logged in like super admin, any other role gets only the super admin listed.

I have reported it on the Views Issues Drupal page too ( http://drupal.org/node/1838796 ) because I think it's a bug on the Views coding. I have checked all the permissions and they are set to both anonymous and authenticated users to be allowed to view user profiles.

  • So Warmth What is the actual question? – Dinesh Kumar Sarangapani Nov 15 '12 at 5:44
  • How to display in a user list the authored content count beside each user, but as you can see in my comment below monymirza's answer I found how to do it be embedding a view inside a view and passing the uid as a contextual filter. Hopefully the bug will be fixed and soon this workaround will become useless. – warmth Nov 15 '12 at 13:12
0

If you are using D7 I think you will have to enable aggregation for you view, and then set the group by for you field (Content:nid for example) to Count.

0

Making a new view (master only) that receive the UID as contextual filter and the Views Field View module there is a good possibility of retrieving information about the contents of an specific user that using the normal relationships (the ones built-in Views) won't allow you to do or will give you issues with MySQL and sometimes Ajax request.

Example of embeddable view to retrieve count of authored content of an specific user:

$view = new view();
$view->name = 'ctn';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'ctn';
$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['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'más';
$handler->display->display_options['group_by'] = TRUE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Aplicar';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Reiniciar';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Ordenar por';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Ascendente';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
/* Campo: COUNT(Contenido: uid del autor) */
$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']['group_type'] = 'count';
$handler->display->display_options['fields']['uid']['label'] = '';
$handler->display->display_options['fields']['uid']['alter']['trim_whitespace'] = TRUE;
$handler->display->display_options['fields']['uid']['alter']['strip_tags'] = TRUE;
$handler->display->display_options['fields']['uid']['element_label_colon'] = FALSE;
/* Filtro contextual: Contenido: uid del autor */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'node';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['exception']['title'] = 'Todo(s)';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
/* Criterios de filtrado: Contenido: Publicado */
$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;
$translatables['ctn'] = array(
  t('Master'),
  t('más'),
  t('Aplicar'),
  t('Reiniciar'),
  t('Ordenar por'),
  t('Ascendente'),
  t('Desc'),
  t('Todo(s)'),
);

Nota: remember to check the content types and the translated strings.

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.