Skip to:
Content

Opened 4 years ago

Closed 4 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)

comment:1 erich734 years ago

the system should say:

Dear User "B",
please be informed that your friend "User A" is not a member of this website anymore.

comment:2 jcandothers4 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 );

comment:3 johnjamesjacoby4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2976]) Fixes #2341

comment:4 linusf4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Applied the changes presented in the fix, and also downloaded the complete file from the trunk. It's still showing wrong number in the friends counter.

comment:5 apeatling4 years ago

  • Milestone changed from 1.2.4 to 1.3

comment:6 johnjamesjacoby4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [3044]) Fixes #2411, #2341

Note: See TracTickets for help on using tickets.