Opened 14 years ago
Closed 14 years ago
#2341 closed defect (bug) (fixed)
delete user account / friend-numbering still visible
Reported by: | erich73 | Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | minor |
Severity: | Version: | ||
Component: | Friends | Keywords: | |
Cc: |
Description
when 2 users are friends. Lets call them User "A" and User "B".
Then user "A" is deleting his user-account from the system.
User "B" still is seeing this user in the Tab "My Friends (1)".
User "A" has been completely deleted, which is correct, but user "B" who had actually 1 friend only, still sees 1 friend (at least the number-count of having one friend).
Although this 1 friend is not a member of the website anymore.
Change History (6)
#2
@
14 years ago
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_idsfriends? 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 );
the system should say:
Dear User "B",
please be informed that your friend "User A" is not a member of this website anymore.