Creating a Directory of Registered Users in WordPress

Thursday, August 27th 2009

First of all, create about 6 users under Users -> Add Users in WordPress, so we have some faces to work with. Then go ahead an install Members List. Quickest instructions for setting it up:

  1. Download and install the plugin
  2. Create a template in your theme called members.php. Put the following code in that template:
<?php
/**
 * @package WordPress
 * @subpackage Name_of_Your_Theme
 */
/* Template Name: Members */
get_header(); ?>

<div id="content" class="narrowcolumn" role="main">

<?php
$members = new tern_members;
$members->members(array('search'=>true,'pagination'=>true,'sort'=>true));
?>

</div>

<?php get_footer(); ?>

Finally, create a page in WordPress called "Members." Assign the "Members" template to that page and Publish.

Okay, great, now you should see your members list:

http://dev.dquinn.net/guest/members/

Of course, 2 problems remain:

  • When you click on individual users, you go to the Author archive for that user, instead of an individual profile for the user.
  • It's not yet integrated with the User Photo plugin.

Let's fix problem #1 first.

Next up, Creating an Author Template in WordPress »

Your Comments

Much Ado About Nothing

13 comments

rss feed

  1. Felipe Wednesday, September 23, 2009 at 6:26 pm

    Great Work!

    I'm still starting with Wordpress.. What a powerful tool!

    I've almost all the steps until here, but I'm having some messages from the server, like:
    Warning: Cannot modify header information - headers already sent by (output started at E:\vhosts\estrutural.blog.br\httpdocs\wordpress\wp-content\plugins\members-list\tern_wp_members.php:840) in E:\vhosts\estrutural.blog.br\httpdocs\wordpress\wp-login.php on line 299"

    Well... the blog is hosted in a server (shared, I think), so that I can't change the PHP.INI file to make it not show WARNINGS, only ERRORS.

    Any tip for that?

    Thanks, and congratulations for this work...

    Felipe

    • Daniel Quinn Wednesday, September 23, 2009 at 6:39 pm

      Hmm, that usually means there's a space or some other character at the beginning of the file indicated in the error. It could also have been borked when it was FTP'd to your server, since the errors are coming from within the Members List plugin.

      • Felipe Wednesday, September 23, 2009 at 6:50 pm

        Uow!

        *THIS* is a fast answer!!

        It's strange... It was all working before I went to lunch..

        The PHP-code ends on line 838 of the file, so.. I thought It could be some "}" missing, but it is not..

        Even some css-styles aren't working... look at this... =/
        http://www.estrutural.blog.br/?page_id=13

        Thanks in advance...

        • Felipe Wednesday, September 23, 2009 at 7:08 pm

          Well...

          I've just download you "tern_wp_members.php", and uploaded to the server, but now error starts at funcions.php ...

          I'll keep trying tomorow... Thanks for your support..

          Regards,
          Felipe

          • Felipe Wednesday, September 23, 2009 at 7:12 pm

            Well... Crazyness.... Everyting works fine...

            Sorry for the 'almost-spam' commentting...

            It was only some lines after "?>" .... and commented lines...

            Thanks again,
            Felipe

            • Daniel Quinn Wednesday, September 23, 2009 at 11:37 pm

              Glad you figured it out - sometimes we spend hours fighting with something, but it always ends up being something silly (like a missing semicolon!! Oh I remember that torture in my Flash days...)

  2. Alvin Crespo Tuesday, October 27, 2009 at 9:15 pm

    Thanks for this tutorial, been looking around for some helpful info. But it seems that the following error is given when I click to view the example on this page:

    Parse error: syntax error, unexpected $end in /nfs/c04/h01/mnt/58990/domains/dev.dquinn.net/html/guest/wp-content/plugins/usermeta/usermeta.php on line 98

    • Daniel Quinn Tuesday, October 27, 2009 at 9:18 pm

      Hi there, I was actually editing it at the exact moment you went to look at it. Try again :)

  3. Dwaynne Tuesday, August 17, 2010 at 2:50 am

    I tried the code, but I am not getting the alphabetical list nor the pagination features : (

    Test here:

    http://chooseavirb.com/bicl2/directory/

    Using WP 3.0

    • Daniel Quinn Tuesday, August 17, 2010 at 2:53 am

      Guys, stop using this method. WP 3.0 allows you to modify profiles extremely easily without the need for these plugins.

      • Dwaynne Tuesday, August 17, 2010 at 3:18 am

        Hi, Dan.

        Explain, since I am still not totally familiar with all that went under the hood with 3.0. How would we accomplish a members list in 3.0?

        What I am specifically trying to do is two-fold:

        1. List the members of my site in a directory (http://chooseavirb.com/bicl2/directory/)

        2. Sort the users by their respective groups (clueless with this one...trying to write a PHP query to aggregate based on user_meta...http://chooseavirb.com/bicl2/groups/...help if possible)

        Thanks for the clarification.

        • Dwaynne Tuesday, August 17, 2010 at 3:20 am

          Basically I want to say 'if the user's meta value (from Cumy Extra Fields) is = to Barbados, then display all users on this page'.

          A lil out of range of the original post, but after that I want to list the Barbados users in a Members' Directory.

          • Daniel Quinn Tuesday, August 17, 2010 at 8:55 am

            Justin Tadlock explains how to use core functions to insert new profile fields in this article: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

            You could just create a new profile field using the new methods, then create an author.php template (see the Codex) to list all the authors and sort them by that profile field.

            Cimy + Flutter and all those in-betweens are unnecessary now, since we can add meta boxes really easily to posts and custom post types as well as add profile fields with core functions.

Speak Your Mind

For Scathing Rebuttals

Enclose code in <code></code> brackets.