Skip to:
Content

BuddyPress.org

Changeset 9589


Ignore:
Timestamp:
03/03/2015 08:01:25 PM (6 years ago)
Author:
boonebgorges
Message:

Introduce bp_remove_object_terms() wrapper, and use in bp_remove_member_type().

Props Mamaduka.
Fixes #6188.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-taxonomy.php

    r9519 r9589  
    8080    return $retval;
    8181}
     82
     83/**
     84 * Remove taxonomy terms on a BuddyPress object.
     85 *
     86 * @since BuddyPress (2.3.0)
     87 *
     88 * @see wp_remove_object_terms() for a full description of function and parameters.
     89 *
     90 * @param int          $object_id Object ID.
     91 * @param string|array $terms     Term or terms to remove.
     92 * @param string       $taxonomy  Taxonomy name.
     93 * @return bool|WP_Error True on success, false or WP_Error on failure.
     94 */
     95function bp_remove_object_terms( $object_id, $terms, $taxonomy ) {
     96    $is_root_blog = bp_is_root_blog();
     97
     98    if ( ! $is_root_blog ) {
     99        switch_to_blog( bp_get_root_blog_id() );
     100    }
     101
     102    $retval = wp_remove_object_terms( $object_id, $terms, $taxonomy );
     103
     104    if ( ! $is_root_blog ) {
     105        restore_current_blog();
     106    }
     107
     108    return $retval;
     109}
  • trunk/src/bp-members/bp-members-functions.php

    r9575 r9589  
    26172617    }
    26182618
    2619     $deleted = wp_remove_object_terms( $user_id, $member_type, 'bp_member_type' );
     2619    $deleted = bp_remove_object_terms( $user_id, $member_type, 'bp_member_type' );
    26202620
    26212621    // Bust the cache if the type has been removed.
Note: See TracChangeset for help on using the changeset viewer.