How To Build a Drupal List Page With All Users

| Drupal Development | 3 seen

In today's Drupal tutorial series I'm going to show a simple way how to build an authors page listing all users with their profile information + some other neat features.

A few years ago I was working on a Drupal project for large media organization and I was required to build an extended user profile system on Drupal. Recently I hired few freelance writers for my own blog / website and idea of having a nice author overview page sounded a must have.  

The further written can be applied to some micro social websites powered by Drupal, but for the ease of this tutorial I will stick with an user / author overview page for multi user blogs or media organizations.

Here is the final result:

Authors overview page on Drupal

Authors overview page on Drupal

You can see a live view here: Authors

In above view I have displayed info for authors taking info from profile field, which are following:  author picture, author bio and categories author writes articles about, as well displaying total article count for each author and sorting authors on page by total article count. (No surprise seeing myself as the most productive writer, after about 3 and half years I've written more than 1,600 articles already)

Granting permission to view user profiles

I'm not going in details on how to build custom user roles, for the ease of this tutorial let's stick with authenticated users

  • Make sure to enable view user profiles under People - > Permissions

Creating custom Authors view page

Now, once permissions are set,let's create a new views page displaying User, here are some highlights to adjust for your needs:

Page settings

  • Path: /authors

Relationships

We are using relationships to make total article (node) count to work for each user / author. If you are not going to show total article count, skip relationships and aggregation part

  • Relationships: User: Content authored

Other

See above

  • Use aggregation: Yes

Fields:

  • User name
  • Nid (use County for aggregation settings)
  • User Bio (custom field from user profile page)
  • User Profile Image
  • Field:Category (custom field from user profile page)
  • Global:Custom text (I'm using custom text field to style and order final view result, that's optional)

Sort:

  • User: Created date

Save your view and check your  custom authors overview page, which should display info from user profile fields as well using aggregation and COUNT feature you are displaying how many articles each user / author have written. 

Add new comment