AB Member Categories lets you link custom member fields to category groups. It's a simple concept - but also a very powerful one. If you think about it a category group is just a list ... it can be a list of member groups, a list of teams or any other kind of category you'd like to put your members in. You can link as many member fields to as many category groups you want. For each linked field, members can be put in either one or multiple categories.
A category group in EE is a collection of categories. From the Member Categories settings page you can connect any of your existing custom member fields to a category group. For each field you also have the option to specify that multiple categories may be selected.
Once a Custom Member Field -> Category Group link has been made the categories from that category group will show up in a dropdown list on the member's Edit Profile page.
Here's an example of editing a member with two fields linked with Member Categories (the Member Category and the Team field). As seen above the Member Category field allows multiple, while the Team dropdown is for selecting a single team.
Please note that the dropdowns shown in these images use a third-party library called Chosen. This has now been disabled by default as it had a bug where the dropdowns would be cut off if it was at the bottom of the edit member page. It might work with your setup though - you can enable it by editing config/member_categories.php (and setting the chosen_enabled flag to TRUE)
Here's how a single select looks:
And here's how it will look if you tick the "Allow multiple" checkbox when linking the field:
Of course, the power of this addon is in the tags and the things you can build with them.
This tag is used to check if a member belongs in specific categories. You specify the custom member field name, the categories to check for and the member_id.
The tag can be used for to check for team memberships, advanced access control, etc.
Parameters:
Available tags
This tag will make the mc:belongs_in_all, mc:belongs_in_any and mc:belongs_in_none conditionals available. Here's an example of a template which checks for user access:
{if logged_in}
<h1>Hi {screen_name}</h1>
{exp:member_categories:check field="member_category" category="super_admins|priority_members"}
{if mc:belongs_in_all}
<p>You're both a super admin AND a priority member - how is that even possible?</p>
{embed="embeds/.priority_users"}
{/if}
{if mc:belongs_in_any}
<p>Wow, seems you're either a super admin or a priority member! We'll embed some goodies for you:</p>
{embed="embeds/.priority_users"}
{/if}
{if mc:belongs_in_none}
<p>Doh, you're just a regular member aren't you?</p>
{embed="embeds/.please_upgrade"}
{/if}
{/exp:member_categories:check}
{/if}
Use this tag to list the members of a specific category.
Parameters
Available Tags
{exp:member_categories:members field="team_id" category="{segment_3}"}
<h2>Total members: {mc:total_results}</h2>
{if mc:has_results}
<ul>
{mc:results}
<li>{mc:member_id}: {mc:screen_name}</li>
{!-- // this can also be used btw:
{exp:member:custom_profile_data member_id="{mc:member_id}"}
{screen_name}..
{/exp:member:custom_profile_data}
--}
{/mc:results}
</ul>
{if:else}
No members, yet.
{/if}
{/exp:member_categories:members}
Use this tag to list the categories available for a specific member field.
Parameters
Available Tags
{exp:member_categories:categories field="team_id"}
{if mc:has_results}
<h1>Teams ({mc:total_results})</h1>
<ul>
{mc:results}
<li><a href="{path=mc/teamlist}/{mc:cat_url_title}">{mc:cat_name}</a></li>
{/mc:results}
</ul>
{if:else}
<h1>No Teams</h1>
{/if}
{/exp:member_categories:categories}