Ticket #5018: 5018.01.patch
File 5018.01.patch, 2.7 KB (added by , 12 years ago) |
---|
-
bp-groups/bp-groups-cache.php
add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10 94 94 function groups_clear_group_user_object_cache( $group_id, $user_id ) { 95 95 wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' ); 96 96 } 97 add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 ); 98 add_action( 'groups_leave_group', 'groups_clear_group_user_object_cache', 10, 2 ); 99 add_action( 'groups_ban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 100 add_action( 'groups_unban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 97 add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 ); 98 add_action( 'groups_leave_group', 'groups_clear_group_user_object_cache', 10, 2 ); 99 add_action( 'groups_ban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 100 add_action( 'groups_unban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 101 add_action( 'groups_uninvite_user', 'groups_clear_group_user_object_cache', 10, 2 ); 102 add_action( 'groups_remove_member', 'groups_clear_group_user_object_cache', 10, 2 ); 101 103 102 104 /* List actions to clear super cached pages on, if super cache is installed */ 103 105 add_action( 'groups_join_group', 'bp_core_clear_cache' ); -
bp-groups/bp-groups-functions.php
function groups_leave_group( $group_id, $user_id = 0 ) { 299 299 // Modify group member count 300 300 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 ); 301 301 302 // Modify user's group member hip count303 bp_update_user_meta( $user_id, 'total_group_count', (int) bp_get_user_meta( $user_id, 'total_group_count', true ) - 1);302 // Modify user's group membership count 303 bp_update_user_meta( $user_id, 'total_group_count', (int) groups_total_groups_for_user( $user_id ) ); 304 304 305 305 /** 306 306 * If the user joined this group less than five minutes ago, remove the … … function groups_join_group( $group_id, $user_id = 0 ) { 364 364 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 ); 365 365 groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() ); 366 366 367 // Modify user's group membership count 368 bp_update_user_meta( $user_id, 'total_group_count', (int) groups_total_groups_for_user( $user_id ) ); 369 367 370 do_action( 'groups_join_group', $group_id, $user_id ); 368 371 369 372 return true;