BuddyDev

BuddyPress Xprofile Member Type Field

Do you want more flexible and powerful member types manager and fields plugin? Checkout BuddyPress Member Types Pro

BuddyPress Xprofile Member Type Field plugin allows site admins to use BuddyPress member type as profile field. It lest user choose their member type and the updates user's member type based on their selection of the member type in the profile field.

Features:-

  • Uses Member Type As Xprofile Field
  • Updates & syncs user's member type with the xprofile field and vice versa
  • Works with Non Editable Profile field plugin if you don't want to allow users to modify their member type after registration.
  • Searchable Member type fields(added in 1.0.1) when using BP Profile Search plugin, thanks to Andrea.
  • Do you need a more powerful

The current version shows the registered member types as a select element(dropdown).

Screenshot:-

Add New Profile Field screen:-

Xprofile Add New Field

Registration page Member Type Field:-

Registration Page Member Type field

Edit profile page member type field ( If you are not using Non Editable Profile field plugin):-

Edit Profile Member Type field

Using as Radio Field:-

With version 1.0.2 and above, you can put the following code in your bp-custom.php to make it work as radio instead of the select box.

add_filter( 'bd_xprofile_field_type_membertype_as_radio', '__return_true');

Limit Allowed type to certain member types:-

/**
 * Filter and limit member types to the following.
 * 
 * @param array $allowed_options an array of member_type => Member type labels
 *
 * @param $registered_types array of member type objects as returned by bp_get_member_types()
 */
function buddydev_filter_allowed_xprofile_member_types( $allowed_options, $registered_types ) {
	// say we have 3 registered member types, 'student', 'teacher' and 'staff'
	// And we only want to allow users to select between 'student' or 'teacher'
	$allowed_options = array(
		'student'   =>  'Student',
		'teacher'   => 'Teacher'
	);

	return $allowed_options;
}
add_filter( 'bp_xprofile_member_type_field_allowed_types', 'buddydev_filter_allowed_xprofile_member_types', 10, 2 );

 

Checkout BuddyPress Member Types Pro for a super powerful complete solution for BuddyPress member types

Release History

  • Version: 1.0.8

    Monday, 28 June, 2021
    • Tested With: BuddyPress 8.0.0
    • Compatible With: BuddyPress 6.0+

    Add filter to allow electing default member type.

  • Version: 1.0.7

    Tuesday, 09 July, 2019
    • Tested With: BuddyPress 4.3
    • Compatible With: BuddyPress 2.7+

    Fix field description. Update markup to be more inline with current BuddyPress profile field markup.

  • Version: 1.0.6

    Tuesday, 19 March, 2019
    • Tested With: BuddyPress 4.2
    • Compatible With: BuddyPress 2.7+

    Added support for BP Profile Search 4.8+

  • Version: 1.0.5

    Thursday, 10 August, 2017
    • Tested With: BuddyPress 2.9.0
    • Compatible With: BuddyPress 2.5+

    - Fixed recursion on selecting empty field.
    - Allow filtering allowed member types in the field using 'bp_xprofile_member_type_field_allowed_types' filter.
    - Fix a bug where member type was not syncing to the profile field if the use's profile field was not set earlier.

  • Version: 1.0.4

    Monday, 04 July, 2016
    • Tested With: BuddyPress 2.6.1.1
    • Compatible With: BuddyPress 2.2+

    Fix the infinite loop on member deletion.

  • Version: 1.0.3

    Wednesday, 08 June, 2016
    • Tested With: BuddyPress 2.5.3
    • Compatible With: BuddyPress 2.2+

    Updated for 2 way synchronization of the membertype and profile fields.

  • Version: 1.0.2

    Sunday, 28 February, 2016
    • Tested With: BuddyPress 2.4.3
    • Compatible With: BuddyPress 2.0+

    Updated for allowing to use radio field using a filter

  • Version: 1.0.1

    Wednesday, 09 December, 2015
    • Tested With: BuddyPress 24.2
    • Compatible With: BuddyPress 2.3+

    Added compatibility with BP Profile Search plugin for searchable member type field

  • Version: 1.0.0

    Monday, 20 July, 2015
    • Tested With: BuddyPress 2.3.2.1
    • Compatible With: BuddyPress 2.3+

    Initial release