Did you know that Formidable can work as a WordPress user directory plugin? Harness the power and flexibility of Formidable to create your own WordPress User directory (Or membership directory) today!
In this tutorial, we'll show you how to use Formidable Forms to create your own WordPress user directory. No additional member directory plugins required.
Core components of a WordPress user directory
At its very core a user directory (or membership directory) needs to be a system where each user can view a list of all other users, where new users can register, and existing users can easily update their profile. The ability to search for specific users by name, age, or location is also a great bonus.
A WordPress user directory has four main parts:
- A form to add new users and update profiles
- The view to display all users in the directory
- A search form to find users
- A form to contact each user from their profile
Step 1: A form to add new users
If you've built forms using Formidable before, then this bit should be child's play for you. Build a registration form and add fields for Email, Name, Gender, Age, Country, City, State and any other fields that you need. Add a file upload field for users profile photos.
Your exact fields will vary depending on your specific needs. Make sure to think ahead to the search form, and include the essential fields that people would like to use to search and filter (like location and age). Don't forget to add a User ID field to your form, and a User Registration form action.
Our User Registration add-on creates a link between each entry and the user who created it. This is essential when it comes to editing a user profile, and ensures that each user can only see their own data.
On your Form settings page, there are some options to configure under the Form Permissions tab. First, check the box to limit the number of entries to one per logged in user. Next, check the Allow front-end editing of entries box and ensure permissions are configured so that your users can edit their own entries.
Now when a logged-in user returns to the registration form, they will see their details pre-filled. Editing these details and clicking Update will update their profile listing.
Step 2: The main user directory view
To create a directory we'll be using the Formidable Views feature.
If you're new to Formidable there is one small trick that makes understanding Views much simpler. The rule? Everything in the "Before Content" and "After Content" sections is used only once on the page. The main Content box in the middle is repeated for every entry. This allows you to setup your table/layout structure in the Before section, add the content you want to display in each row in the Content section, and close your tags in the After section.
To build your directory listings, use the Dynamic View format. This will give you BOTH the listing View that displays the overview of each user, with links for an in-depth look at each individual profile.
First build your main listing View. This is the listing page that will display all profiles. You don't need to add every field to this View, just the essentials. Then insert the detaillink shortcode which will take users to the more detailed individual user profile.
Next build the individual profile listings. To achieve this, we'll use the detail page box to define what details are visible in the individual user profiles. Because the detail view is a single user profile and not a list, there are no Before or After content boxes.
At this point, add a few entries so you can double check that your view is displaying the way you would like.
Want a detailed explanation on how to setup a view?
Step 3: Search user profiles
The ability to search directory listings is essential in any large user directory. Formidable has custom search functionality built-in!
You don't need to include every field in your search form. Use only the most relevant fields in the search form, like Name, City and Age. Try a variety of field options to see which returns the most relevant results. It's worth spending a little time on this, as it's a big factor in how user-friendly your user directory will be.
TIP: Use dropdown fields in your application form and corresponding fields in your search form to allow users to effectively filter results. This often returns more relevant results the first time when compared to results from a text search.
A full tutorial on building search forms would be too much to include here. If you need more information on Formidable search forms, check out our documentation on how to create a search form.
Step 4: The "Contact this user" form
The Contact this user form is the final part of the puzzle. This displays on the individual user listings. Build your contact form as you would any normal contact form. Add the shortcode for this form to the detail Page content of your View so that the Contact Me button is visible in each user profile.
Formidable's smart default values allow you to route the email to the correct user. The TO address on the forms email action can be pre-populated with the users email address, and form fields can be pre-populated with the name and other relevant details using the [get param=whatever] shortcode. This shortcode can pre-fill form fields by capturing data in the URL.
Watch a video guide on how to configure dynamic email routing for your form.
And that's it. In just an hour or two you can build a fully functional WordPress user directory and integrate it into your website!
Not using Formidable yet? Take a look at all the great form builder features to see how Formidable Forms can help you build an amazing WordPress user directory.