Home Tutorials How to Use WordPress as a Membership Directory

How to Use WordPress as a Membership Directory

Author

Date

Updated on

Category

Do you want to create a moderated membership directory that showcases your member’s information? Do you want it to be flexible, be very little work after initial setup, and use a world-class open source platform that you are already familiar with?

Your first thought might not be to use WordPress for such a project, but since it already has an extremely easy way to accept, moderate and update registrations – it’s a perfect candidate.

In this tutorial, I will show you how I built a successful membership directory using nothing more than a standard WordPress 2.3+ install and 2 very powerful plugins.

The Plugin Installs

The heart of the site is powered by two plugins.

First, use the WP User Manager plugin from Dealsway to add new fields to the user profiles. The install and setup is pretty straightforward – just activate the plugin and add any new fields you want via its own admin section. The information entered in these fields will become the information that will create the member’s “homepage.”

Secondly, we use the famous Role Manager plugin which restricts what your members can do once they are logged into your site. This is important because in order for a member to be granted their own author page, he or she needs to have made at least one post.

In my case, I didn’t want my members to have the ability to post anything, just to only fill out their profile information. To get around this, I used the Role Manager plugin as-is, but changed the Author role to only have the rights Publish Posts and Read. (The Hide Dashboard capability you see in the screenshot is a function of the IWG Hide Dashboard plugin. It was an easy way to clean up the admin panel for my members.)

changerole

Setting WordPress Options

After you have installed all the plugins, we need to get WordPress ready for your new registrations.

In your Admin panel, under options, set your New User Default Role to Subscriber. This ensures that a member won’t be given an author page until you “approve” and manually move them to the Author role. (A Subscriber can’t make posts, an Author can.)

 

Once a member has registered and filled out all the appropriate profile information, we need to “approve” that member. We do this by simply moving that member into the Author role and making a post on his or her behalf. I want each approved member to have made a post in order to create the New Member Feed [example]. To post on behalf of that member, choose that member’s name out of the dropdown list in the Post Author section in the sidebar before publishing their post.

 

This post doesn’t need to be anything spectacular. On Pittsburgh Designers, I simply write “This business has been added as a member. Please visit their Design Profile.”

There are other ways of doing this to make it slightly simpler, but I do it this way because I want to use WordPress’s default feed as a New Member Feed.

Your membership management duties are now done.

Creating the Author Page

All that’s left now is the need to create the author.php template to display all this new member profile information that the WP User Manager plugin allowed us to accept.

For the sake of this tutorial, we only added 2 new fields to the member profile page: business_name and business_owner.At the top of the author.php template, we will add this code. Hint: Each new field you add will need to be declared here.

<?php
/*
Template Name: Author Template
*/
global $wp_query;
$curauth = $wp_query->get_queried_object();
$key="wpum_"."business_name";
$business_name = get_usermeta($curauth->ID, $key);
$key="wpum_"."business_owner";
$business_owner = get_usermeta($curauth->ID, $key);
?>

Now right below that, in the body section of your template, we are going to add this data and markup to display it in a structured way:

<?php get_header(); ?>
<div id="bodycontent" >
<div class="bodytext" >
<h2><?php echo $business_name; ?></h2>
<p>The owner of this business is <?php echo $business_owner; ?></p>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

The next step is to also show some of the default fields that the member entered within their profile. I only want to show the member’s website address and About the user section, so we modify our template to look like this:

<?php get_header(); ?>
<div id="bodycontent" >
<div class="bodytext" >
<h2><?php echo $business_name; ?></h2>
<p>The owner of this business is <?php echo $business_owner; ?></p>
<p>Website: <a href="<?php%20echo%20$curauth->user_url;%20?>"><?php echo $curauth->user_url;
?></a></p>
<p>About the Business: <?php echo $curauth->description; ?></p>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Hint: A full list of $curauth-> calls can be viewed in the WordPress Codex.

Lastly, we want to do some basic error checking.

What would happen if the member didn’t put anything in the business_owner field? In this case, we can just wrap that line in an if statement (…or any variable we want to protect against being blank):

<?php if ($business_owner != null) { echo "<p>The owner of this business is
".$business_owner."</p>"; }; ?>

Listing your Members

So how do you list all of your approved members? It is as simple as adding the wp_list_authors to any template file. This is the customized version of that function I use:

<?php wp_list_authors(‘hide_empty=1&show_fullname=0&optioncount=0&exclude_admin=0′);
?>

Tutorial Wrapup

This tutorial was based on my experiences in building the Pittsburgh Designers community into a thriving, local membership directory for creative types. Mosey on over to the site and take a peek for yourself how what a finished project like this can look like.

You can download the complete finished author.php template here.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent posts

10 Ways To Speed Up Post-Building Process With WordPress Gutenberg Themes

There’s no need to explain why I decided to start with Gutenberg-supporting products. All in all, Gutenberg is a well-known and long-awaited product. It is more...

HostPapa Linux Hosting: Reliable, robust and fast

As a small business owner, it can be challenging to find the right hosting provider for your website. HostPapa distinguishes itself from other web...

Are You Making These Costly Mistakes When Outsourcing?

In today’s world, it is almost impossible to find a small business where everything about the business process is done in-house. For most small...

Flat Design for Your WordPress Site: What Is It + 4 WordPress Flat Design Themes

Web designers in the past mostly used 3D styles for buttons that made the button seem more realistic. That all changed when flat design...

LawBlog WP Theme Review

Regardless of which area of law you practice, it’s imperative that you have proper online representation. You need to give your customers a feeling...

Recent comments