Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

#2341 closed defect (bug) (fixed)

delete user account / friend-numbering still visible

Reported by: erich73's profile 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)

#1 @erich73
14 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.

#2 @jcandothers
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 );

#3 @johnjamesjacoby
14 years ago

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

(In [2976]) Fixes #2341

#4 @linusf
14 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.

#5 @apeatling
14 years ago

  • Milestone changed from 1.2.4 to 1.3

#6 @johnjamesjacoby
14 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.