The concept of member types was introduced in BuddyPress 2.2. We got a brand new API that opened a great opportunity for the community builders. It got another boost in BuddyPress 2.3 and I believe It is the right time that you start working with it.
What is BuddyPress Member Type:-
Member type provides a way to classify users into various categories (or types). Think of it as something similar to WordPress role (Like WordPress uses roles to separate users, you can use member types to separate social users). To be honest, that analogy to the role is not correct as it does not provide any extra capability to the users, but I hope you got the basic idea.
With the introduction of member types, now users can be easily categorized into various distinguishable categories.
Under the hood:-
BuddyPress uses the taxonomy “bp_member_type” and each member type is a term belonging to this taxonomy. The user to member type association is stored in the terms_relationship table. Checkout buddypress/bp-core/bp-core-taxonomy.php to see how it is implemented.
What is BuddyPress Member Type API:-
The Member type API provides a set of functions to register new member types, assign/change user’s member type and a few other things to make your job easier while building multi user type community. We will examine all API functions in part 3 of this series.
Why Use Member type:-
If you are building a social site and you need multiple profile type or account type, Use member type to make it easy.
Some examples are university network or dating site or photography website. Anywhere you need multiple profile types, member type API is your friend.
Since BP_User_Query and bp_has_members have builtin support for member type, You can use in in various interesting ways to manipulate the user listing. Also, with BuddyPress 2.3, you will get the member type specific directories without any extra effort.
About this series:-
Our member types tutorial is a four part series and we hope you will learn a lot while following this series. Make sure to stay with me and I promise to help you build better social site with BuddyPress.
This series consists of :-
- BuddyPress Member Types Introduction.
- Registering new member types and assigning member types to users.
- Getting deep into the member type API
- Practical use of the member type API (We will build a plugin to separate users based on gender)