Skip to:
Content

BuddyPress.org

Ticket #6188: 6188.2.diff

File 6188.2.diff, 1.3 KB (added by Mamaduka, 6 years ago)
  • src/bp-members/bp-members-functions.php

    diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
    index ef9d2f4..7fdaa38 100644
    function bp_set_member_type( $user_id, $member_type, $append = false ) { 
    26012601}
    26022602
    26032603/**
     2604 * Remove type for a member.
     2605 *
     2606 * @since  BuddyPress (2.3.0)
     2607 *
     2608 * @param int    $user_id     ID of the user.
     2609 * @param string $member_types Member Type.
     2610 *
     2611 * @return bool|WP_Error
     2612 */
     2613function bp_remove_member_type( $user_id, $member_type ) {
     2614        // Bail when no valid member type was passed
     2615        if ( empty( $member_type ) || ! bp_get_member_type_object( $member_type ) ) {
     2616                return false;
     2617        }
     2618
     2619        $deleted = wp_remove_object_terms( $user_id, $member_type, 'bp_member_type' );
     2620
     2621        // Bust the cache if the type has been removed.
     2622        if ( ! is_wp_error( $deleted ) ) {
     2623                wp_cache_delete( $user_id, 'bp_member_member_type' );
     2624
     2625                /**
     2626                 * Fires just after a user's member type has been removed.
     2627                 *
     2628                 * @since BuddyPress (2.3.0)
     2629                 *
     2630                 * @param int    $user_id     ID of the user whose member type has been updated.
     2631                 * @param string $member_type Member type.
     2632                 */
     2633                do_action( 'bp_remove_member_type', $user_id, $member_type );
     2634        }
     2635
     2636        return $deleted;
     2637}
     2638
     2639/**
    26042640 * Get type for a member.
    26052641 *
    26062642 * @since BuddyPress (2.2.0)