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-cache.php

    r9486 r9533  
    1515 */
    1616function bp_members_prefetch_member_type( BP_User_Query $bp_user_query ) {
    17     $uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_type' );
     17    $uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_member_type' );
    1818
    1919    $member_types = bp_get_object_terms( $uncached_member_ids, 'bp_member_type', array(
     
    3333    $cached_member_ids = array();
    3434    foreach ( $keyed_member_types as $user_id => $user_member_types ) {
    35         wp_cache_set( $user_id, $user_member_types, 'bp_member_type' );
     35        wp_cache_set( $user_id, $user_member_types, 'bp_member_member_type' );
    3636        $cached_member_ids[] = $user_id;
    3737    }
     
    3939    // Cache an empty value for users with no type.
    4040    foreach ( array_diff( $uncached_member_ids, $cached_member_ids ) as $no_type_id ) {
    41         wp_cache_set( $no_type_id, '', 'bp_member_type' );
     41        wp_cache_set( $no_type_id, '', 'bp_member_member_type' );
    4242    }
    4343}
     
    5454 */
    5555function bp_members_clear_member_type_cache( $user_id ) {
    56     wp_cache_delete( $user_id, 'bp_member_type' );
     56    wp_cache_delete( $user_id, 'bp_member_member_type' );
    5757}
    5858add_action( 'wpmu_delete_user', 'bp_members_clear_member_type_cache' );
Note: See TracChangeset for help on using the changeset viewer.