Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/30/2016 06:39:57 PM (8 years ago)
Author:
dcavins
Message:

Return active types only in bp_get_member_type().

When compiling the array of types for the member in
bp_get_member_type(), only include those types that are currently
registered.

Fixes #7225.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-functions.php

    r10938 r11045  
    27482748
    27492749    if ( false === $types ) {
    2750         $types = bp_get_object_terms( $user_id, 'bp_member_type' );
    2751 
    2752         if ( ! is_wp_error( $types ) ) {
    2753             $types = wp_list_pluck( $types, 'name' );
     2750        $raw_types = bp_get_object_terms( $user_id, 'bp_member_type' );
     2751
     2752        if ( ! is_wp_error( $raw_types ) ) {
     2753            $types =  array();
     2754
     2755            // Only include currently registered group types.
     2756            foreach ( $raw_types as $mtype ) {
     2757                if ( bp_get_member_type_object( $mtype->name ) ) {
     2758                    $types[] = $mtype->name;
     2759                }
     2760            }
     2761
    27542762            wp_cache_set( $user_id, $types, 'bp_member_member_type' );
    27552763        }
Note: See TracChangeset for help on using the changeset viewer.