Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/01/2015 11:14:16 PM (10 years ago)
Author:
johnjamesjacoby
Message:

XProfile: Introduce bp_xprofile_groups cache group, to replace bp cache group usage.

  • Reduces field group cache keys down to just their ID, using a unique cache group
  • Use all key instead of 'xprofile_groups_inc_empty`
  • Use default_visibility_levels key instead of xprofile_default_visibility_levels

See #6341, #5733.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r9515 r9676  
    881881 */
    882882function bp_profile_get_field_groups() {
    883     $groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' );
    884 
    885     if ( empty( $groups ) ) {
     883
     884    $groups = wp_cache_get( 'all', 'bp_xprofile_groups' );
     885    if ( false === $groups ) {
    886886        $groups = bp_xprofile_get_groups( array( 'fetch_fields' => true ) );
    887         wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' );
     887        wp_cache_set( 'all', $groups, 'bp_xprofile' );
    888888    }
    889889
     
    974974}
    975975    function bp_get_profile_group_name() {
    976         if ( !$group_id = bp_action_variable( 1 ) )
     976
     977        // Check action variable
     978        $group_id = bp_action_variable( 1 );
     979        if ( empty( $group_id ) || ! is_numeric( $group_id ) ) {
    977980            $group_id = 1;
    978 
    979         if ( !is_numeric( $group_id ) )
    980             $group_id = 1;
    981 
    982         if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) {
    983             $group = new BP_XProfile_Group($group_id);
    984             wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' );
    985         }
     981        }
     982
     983        // Check for cached group
     984        $group = new BP_XProfile_Group( $group_id );
    986985
    987986        /**
Note: See TracChangeset for help on using the changeset viewer.