Changeset 10794 for trunk/src/bp-groups/bp-groups-cache.php
- Timestamp:
- 05/21/2016 02:16:38 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-cache.php
r10766 r10794 226 226 } 227 227 add_action( 'groups_delete_group', 'groups_clear_group_type_cache' ); 228 229 /** 230 * Clear caches on membership save. 231 * 232 * @since 2.6.0 233 */ 234 function bp_groups_clear_user_group_cache_on_membership_save( BP_Groups_Member $member ) { 235 wp_cache_delete( $member->user_id, 'bp_groups_memberships_for_user' ); 236 wp_cache_delete( $member->id, 'bp_groups_memberships' ); 237 } 238 add_action( 'groups_member_before_save', 'bp_groups_clear_user_group_cache_on_membership_save' ); 239 add_action( 'groups_member_before_remove', 'bp_groups_clear_user_group_cache_on_membership_save' ); 240 241 /** 242 * Clear group memberships cache on miscellaneous actions not covered by the 'after_save' hook. 243 * 244 * @since 2.6.0 245 */ 246 function bp_groups_clear_user_group_cache_on_other_events( $user_id, $group_id ) { 247 wp_cache_delete( $user_id, 'bp_groups_memberships_for_user' ); 248 249 $membership = new BP_Groups_Member( $user_id, $group_id ); 250 wp_cache_delete( $membership->id, 'bp_groups_memberships' ); 251 } 252 add_action( 'bp_groups_member_before_delete', 'bp_groups_clear_user_group_cache_on_other_events', 10, 2 ); 253 add_action( 'bp_groups_member_before_delete_invite', 'bp_groups_clear_user_group_cache_on_other_events', 10, 2 ); 228 254 229 255 /* List actions to clear super cached pages on, if super cache is installed */
Note: See TracChangeset
for help on using the changeset viewer.