[buddypress-trac] [BuddyPress] #2341: delete user account / friend-numbering still visible

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Apr 27 13:20:33 UTC 2010


#2341: delete user account / friend-numbering still visible
---------------------+------------------------------------------------------
 Reporter:  erich73  |       Owner:       
     Type:  defect   |      Status:  new  
 Priority:  minor    |   Milestone:  1.2.4
Component:  Friends  |    Keywords:       
---------------------+------------------------------------------------------

Comment(by jcandothers):

 Here is a fix for bp-custom.php

 function update_friends_count( $user_id ) {
 global $wpdb, $bp;
 if ($friend_ids = BP_Friends_Friendship::search_friends( ”, $user_id )) {
 foreach ($friend_ids['friends'] AS $fid) {
 $total_sql = “SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE
 initiator_user_id = $fid OR friend_user_id = $fid”;
 $total_friend_ids = $wpdb->get_var($total_sql);
 update_usermeta($fid, ‘total_friend_count’, (int)($total_friend_ids) – 1);
 }
 }
 do_action( ‘update_friends_count’, $user_id );
 }
 add_action( ‘wpmu_delete_user’, ‘update_friends_count’, 1 );
 add_action( ‘delete_user’, ‘update_friends_count’, 1 );
 add_action( ‘make_spam_user’, ‘update_friends_count’, 1 );

-- 
Ticket URL: <http://trac.buddypress.org/ticket/2341#comment:2>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list