BuddyPress Group-O-Matic: Adding members to groups based on profile fields!
I think it’s safe to say that the Groups Component in BuddyPress is the most powerful component within BuddyPress. There are countless plugins available that extend the groups component, and I use Groups for pretty much every BuddyPress project I do. What has been missing though, is a flexible and powerful solution for BuddyPress site owners to streamline the group joining process.
For lots of communities you want to add your members to groups as soon as they sign-up for your site. Or maybe you want to put extra focus on certain groups because they are crucial to your community. BuddyPress Group-O-Matic is the newest plugin we (PressCrew) developed for BuddyPress communities and offers site administrators some really powerful ways to achieve exactly this.
So what does the BuddyPress Group-O-Matic Plugin do?
In a nutshell it adds a new set of options to the BuddyPress Profile Fields screen that allows you to put your members in groups based on the selection or answer they have given for that field.
Sounds cool… How do I set it up?
Good question! Let’s start with the basics!
1: Create your super duper xProfile field
For this example we’ll pretend that we have a community based around the movie director Guy Ritchie, and we want to put our members into the group that corresponds to their favorite Guy Ritchie movie.
So we’ll create a new xprofile field in the BuddyPress profile field screen in our WP Admin.
Choose your favorite movie using the Dropdown field below
* Sherlock Holmes
You’ll probably already notice the new BuddyPress Group-O-Matic box below, but don’t touch that yet. We’ll get to that later! You should have something like this (click the image for full size)
2: Create your super duper Groups
Now that we’ve created our possible selections, we’ll create the groups using the exact name* as we’ve named our profile field selection options. For our example we’ll create a group called “Sherlock Holmes” and a group called “Snatch”. Like this:
As stated before, make sure your group name matches exactly.
3: Use Group-O-Matic magic to link them together
Go back to your “Favorite Movie” profile field you created in step 1. It’s time to set up the Group-O-Matic box at the bottom of the screen. Here’s all you need to do:
So what does this stuff mean? In plain English this is what we’ve done:
“See if the Group Name (Attribute) has the exact name as the answer that has been given by your members (Pattern). Then automatically join the user to this group.”
If you’ve ever looked at your WordPress Permalinks or the WordPress SEO plugin by Yoast, you’ll see that Group-O-Matic lets you put in some funny looking code in the “Pattern” box. Don’t get confused, the
%answer% input just lets Group-O-Matic know you want to use to the exact answer given by your users, and let Group-O-Matic put the user in the group with that name. Because we’ve given our profile dropdown options and our group names exactly the same name, this works great.
Marshall (the plugin author) has also made a quick video guiding you through this process.
Note: The Premium version of Group-O-Matic gives you much more flexibility in this aspect. You can use wildcard matching so your profile fields and groups names do not have to match exactly. This is great for when you have groups with weird names or slugs. For example your group could be named “Snatch Movie Fan Club” and your profile field option could just be called “Snatch”.
Check out the brilliantly designed screenshot mock-up below (ahem!)
Awesome right?! You’ve now mapped a profile field to a BuddyPress Group. Every member that goes through the registration process will now automatically be put in the group based on that xProfile field selection. You can do this for multiple profile fields and have fine grained control over your community. Some ideas for profile/group mapping;
- Age range
- Skill Level
Stay tuned for another tutorial related to BuddyPress Group-O-Matic Pro
In the next tutorial we’ll take a look at how you can force your users to select a certain group after they’ve registered for your community, and how you can add the Group activity as a main Activity Stream Tab. This is all done with the Pro version of the plugin which is available in the PressCrew shop. Check out the screenshot below for a preview of showing Group Activity under a Activity Stream tab: