bp_remove_member_type( int $user_id, string $member_type )

Remove type for a member.

Description

Parameters

$user_id

(Required) ID of the user.

$member_type

(Required) profile type.

Return

(bool|WP_Error)

Source

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

2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
function bp_remove_member_type( $user_id, $member_type ) {
    // Bail if no valid profile type was passed.
    if ( empty( $member_type ) || ! bp_get_member_type_object( $member_type ) ) {
        return false;
    }
 
    $deleted = bp_remove_object_terms( $user_id, $member_type, bp_get_member_type_tax_name() );
 
    // Bust the cache if the type has been removed.
    if ( ! is_wp_error( $deleted ) ) {
        wp_cache_delete( $user_id, 'bp_member_member_type' );
 
        /**
         * Fires just after a user's profile type has been removed.
         *
         * @since BuddyPress 2.3.0
         *
         * @param int    $user_id     ID of the user whose profile type has been updated.
         * @param string $member_type profile type.
         */
        do_action( 'bp_remove_member_type', $user_id, $member_type );
    }
 
    return $deleted;
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.