Changeset 6100 for trunk/bp-groups/bp-groups-cache.php
- Timestamp:
- 06/14/2012 08:12:59 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-cache.php
r6093 r6100 50 50 add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' ); 51 51 52 /** 53 * Clears caches for the group creator when a group is created 54 * 55 * @param int $group_id 56 * @param BP_Groups_Group $group_obj 57 * @since BuddyPress (1.6) 58 */ 59 function bp_groups_clear_group_creator_cache( $group_id, $group_obj ) { 60 // Clears the 'total groups' for this user 61 groups_clear_group_user_object_cache( $group_obj->id, $group_obj->creator_id ); 62 } 63 add_action( 'groups_created_group', 'bp_groups_clear_group_creator_cache', 10, 2 ); 64 65 /** 66 * Clears caches for all members in a group when a group is deleted 67 * 68 * @param BP_Groups_Group $group_obj 69 * @param array User IDs who were in this group 70 * @since BuddyPress (1.6) 71 */ 72 function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) { 73 // Clears the 'total groups' cache for each member in a group 74 foreach ( (array) $user_ids as $user_id ) 75 groups_clear_group_user_object_cache( $group_obj->id, $user_id ); 76 } 77 add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10, 2 ); 78 52 79 function groups_clear_group_user_object_cache( $group_id, $user_id ) { 53 wp_cache_delete( 'bp_total_groups_for_user_' . $user_id );80 wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' ); 54 81 } 55 82 add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.