0

I have a rather complicated profile completion process on my site. As users create their profiles, they are awarded more roles.

For my own information, I'd like to be able to quickly check the number of users with role ABC. I'd also like to be able to quickly know how many users have role ABC and role XYZ, as well as how many users have role ABC and role EFG.

Is there a quick way to do this in Views or some other module? I don't want to see a list of all users; I just want to know how many have a given role (or combination of roles).

1 Answer 1

2

You should create a view with filter criteria "role" then you expose it and allow multiple selection.

Then you can create an header or footer (always in view) and add this piece of code

<?php
  $view = views_get_current_view();
  print $view->total_rows; 
?>

You should have the php filter enabled. This works for me.

2
  • Thanks for this, but it still shows all the users in the pager. I am trying to find a solution that does not show the users as well, because I want to create a page that shows several different views with several different combinations of user roles, and having a list of the users with each view would make the page extremely hard to read. Commented Aug 15, 2012 at 22:59
  • 1
    Ok, the view should be based on field. You can try a php view field (drupal.org/project/views_php) so it's going to show just the number of people. if you cannot use the php view field you can just add the user id and hide from display. Commented Aug 16, 2012 at 8:19

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.