Update

BuddyPress Member Type Manager is released

If you have Membership site based on WordPress, and you want to add community features, BuddyPress is perfect solution for you. BuddyPress release major update BuddyPress 2.4.0 yesterday and this is exciting for those who are planning to develop membership site based on BuddyPress. Why?

If you notice the release announcement, the featured change is profile and group cover image, but there is more potential is in member type specific profile field which is essential feature for a membership site. BuddyPress first introduced Member Types API is version 2.2.0 which is a very much-needed feature for all kind of community sites. Few years back, I tried to work on this developing BuddyPress User Account Type feeling lacking of this feature, but now BuddyPress has this feature in core, although it is still in background. There’s no interface yet for users to create and manage user types from backend, But this is something surely coming up very soon..

So, new addition in latest release is member specific profile field. BuddyPress member profile fields are mostly public tho you can control visibility in limited way, but now you have more control on profile fields.

A quick example, if you want a community for school,and you want have 3 types of users, Students, Teachers, Parents, Profile fields are likely very much different for these different type of users. Previously, there wasn’t any way to do it without using some custom development or plugin usage (BuddyPress User Account Type provides that feature!).
But From now, you can have it from BuddyPress by default! You just need to register member types at first to do that. Here is some instruction how you can have it.

Step 1: Register member types

You need to register member types at first using Member Types API, but as I mentioned before there’s no interfacing for that right now (I am planning to develop a quick plugin for that), we need to do it using theme’s functions.php file or using bp-custom.php file. For simplification, lets use theme’s functions.php file for now, in case you want to use bp-custom.php file, here is guide for you

So, According to our requirement, we need, 3 types of member to be registered, Student, Teacher, Parent. And Using Member Types API

 

function my_school_community_register_member_types() {
// Register Student Type member with directory
bp_register_member_type( 'student', array(
	'labels' => array(
		'name' => 'Students',
		'singular_name' => 'Student',
		),
	'has_directory' => 'student-directory'
));
// Register Parent type member with Directory
bp_register_member_type( 'parent', array(
	'labels' => array(
		'name' => 'Parents',
		'singular_name' => 'Parent',
		),
	'has_directory' => 'parent-directory'
));
// Register Teacher type member with Directory
bp_register_member_type( 'teacher', array(
	'labels' => array(
		'name' => 'Teachers',
		'singular_name' => 'Teacher',
	),
	'has_directory' => 'teacher-directory'
));
}
add_action( 'bp_init', 'my_school_community_register_member_types' );

You need to put those lines of code at theme’s functions.php file. And BuddyPress will register member types for you, After registering, if you go to edit user profile from dashboard, from extended profile tab, you can assign member type.

Member Type selection for user from dashboard

Member Type selection for user from dashboard

 

Step 2: Creating Profile Fields and Mapping that to member type

Now, we got our member types, lets create different profile fields now from dashboard > users > profile fields

You can either create different type of profile fields, and you’ll see you can map to that field to user types,

Mapping profile field to user type

Mapping profile field to user type

So, that’s it! you have user type specific profile field for you school community!