Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/04/2014 02:19:11 AM (11 years ago)
Author:
boonebgorges
Message:

Add caching support for default xprofile field visibility settings

These settings rarely change, and so are good candidates for persistent caching

See #1332

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-cache.php

    r6342 r7781  
    1818    wp_cache_delete( 'xprofile_group_' . $group_obj->id, 'bp' );
    1919}
     20add_action( 'xprofile_groups_deleted_group', 'xprofile_clear_profile_groups_object_cache' );
     21add_action( 'xprofile_groups_saved_group',   'xprofile_clear_profile_groups_object_cache' );
    2022
    2123function xprofile_clear_profile_data_object_cache( $group_id ) {
    2224    wp_cache_delete( 'bp_user_fullname_' . bp_loggedin_user_id(), 'bp' );
    2325}
     26add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache'   );
    2427
    25 // List actions to clear object caches on
    26 add_action( 'xprofile_groups_deleted_group', 'xprofile_clear_profile_groups_object_cache' );
    27 add_action( 'xprofile_groups_saved_group',   'xprofile_clear_profile_groups_object_cache' );
    28 add_action( 'xprofile_updated_profile',      'xprofile_clear_profile_data_object_cache'   );
     28/**
     29 * Clear caches when a field object is modified.
     30 *
     31 * @since BuddyPress (2.0.0)
     32 *
     33 * @param BP_XProfile_Field
     34 */
     35function xprofile_clear_profile_field_object_cache( $field_obj ) {
     36    // Clear default visibility level cache
     37    wp_cache_delete( 'xprofile_default_visibility_levels', 'bp' );
     38}
     39add_action( 'xprofile_fields_saved_field', 'xprofile_clear_profile_field_object_cache' );
     40add_aciton( 'xprofile_fields_deleted_field', 'xprofile_clear_profile_field_object_cache' );
    2941
    3042// List actions to clear super cached pages on, if super cache is installed
Note: See TracChangeset for help on using the changeset viewer.