bp_has_member_type( int $user_id, string $member_type )

Check whether the given user has a certain member type.

Parameters Parameters


(int) (Required) $user_id ID of the user.


(string) (Required) Member Type.

Top ↑

Return Return

(bool) Whether the user has the given member type.

Source Source

File: bp-members/bp-members-functions.php

function bp_has_member_type( $user_id, $member_type ) {
	// Bail if no valid member type was passed.
	if ( empty( $member_type ) || ! bp_get_member_type_object( $member_type ) ) {
		return false;

	// Get all user's member types.
	$types = bp_get_member_type( $user_id, false );

	if ( ! is_array( $types ) ) {
		return false;

	return in_array( $member_type, $types );

Top ↑

Changelog Changelog

Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.