How to Use Wordpress as a Membership Directory

This article was written by Chris Cagle.
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 straight forward - just activate the plugin and add any new fields you want via it’s 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 screen shot is a function of the IWG Hide Dashboard plugin. It was an easy way to clean up the admin panel for my members.)


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-&gt;get_queried_object();

$key=&quot;wpum_&quot;.&quot;business_name&quot;;
$business_name = get_usermeta($curauth-&gt;ID, $key);

$key=&quot;wpum_&quot;.&quot;business_owner&quot;;
$business_owner = get_usermeta($curauth-&gt;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 echo $curauth->user_url; ?>"><?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 if ($business_owner != null) { echo "<p>The owner of this business is
".$business_owner."</p>"; }; ?>

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.


About the Author

Chris Cagle is a freelance web designer from Pittsburgh, PA, whose projects include Pittsburgh Designers and AdClustr.


This Articles Adapted from http://www.wpdesigner.com/archives/




0 comments:

Post a Comment

 

Labels

Adsense (1) Arsip (6) Blog (2) Blogger (18) Blogger Tutorial (4) Blooger (1) coba (1) Dollar (2) Donasi (1) Download (2) Facebook (2) IM Graphics (1) Info (1) Internet Tips (3) List (1) Motivasi (3) Pengobatan (1) Product (1) PTC (1) SEO (3) Software (18) Tutorial (11) Video (3) Wordpress (6) Youtube (1)

Followers