Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/23/2015 01:39:05 AM (9 years ago)
Author:
boonebgorges
Message:

Use 'bp_member_member_type' as the member type cache bucket name.

Using 'bp_member_type' was creating the potential for collisions between WP's
taxonomy cache (which uses the taxonomy name 'bp_member_type' and term IDs as
cache keys) and BP's per-member member type cache (which uses the bucket
'bp_member_type' and user IDs as cache keys). The collisions take place only
when there is a 'bp_member_type' term ID that overlaps with a user ID.

The new cache group 'bp_member_member_type' is chosen to underscore that what's
being cached is the relationship between individual members and the user types
to which they belong.

Props imath, johnjamesjacoby.
Fixes #6242.

File:
1 edited

Legend:

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

    r9471 r9533  
    25842584    // Bust the cache if the type has been updated.
    25852585    if ( ! is_wp_error( $retval ) ) {
    2586         wp_cache_delete( $user_id, 'bp_member_type' );
     2586        wp_cache_delete( $user_id, 'bp_member_member_type' );
    25872587
    25882588        /**
     
    26132613 */
    26142614function bp_get_member_type( $user_id, $single = true ) {
    2615     $types = wp_cache_get( $user_id, 'bp_member_type' );
     2615    $types = wp_cache_get( $user_id, 'bp_member_member_type' );
    26162616
    26172617    if ( false === $types ) {
    2618         $types = bp_get_object_terms( $user_id, 'bp_member_type'  );
     2618        $types = bp_get_object_terms( $user_id, 'bp_member_type' );
    26192619
    26202620        if ( ! is_wp_error( $types ) ) {
    26212621            $types = wp_list_pluck( $types, 'name' );
    2622             wp_cache_set( $user_id, $types, 'bp_member_type' );
     2622            wp_cache_set( $user_id, $types, 'bp_member_member_type' );
    26232623        }
    26242624    }
Note: See TracChangeset for help on using the changeset viewer.