Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-7724 - Fix: Count of connection and following in members page. #4498

Open
wants to merge 12 commits into
base: release
Choose a base branch
from

Conversation

istiaq-bb
Copy link
Contributor

Jira Issue:

https://buddyboss.atlassian.net/browse/PROD-7724

General Note

Keep all conversations related to this PR in the associated Jira issue(s). Do NOT add comment on this PR or edit this PR’s description.

Notes to Developer

  • Ensure the IDs (i.e. PROD-1) of all associated Jira issues are reference in this PR’s title
  • Ensure that you have achieved the Definition of Done before submitting for review
  • When this PR is ready for review, move the associate Jira issue(s) to “Needs Review” (or “Code Review” for Dev Tasks)

Notes to Reviewer

  • Ensure that the Definition of Done have been achieved before approving a PR
  • When this PR is approved, move the associated Jira issue(s) to “Needs QA” (or “Approved” for Dev Tasks)

Comment on lines 255 to 266
if ( bp_is_active( 'moderation' ) ) {
$suspended_user_ids = bb_moderation_get_suspended_user_ids();

if ( ! empty( $suspended_user_ids ) ) {
// Use prepare to safely include suspended user IDs.
$placeholders = implode( ', ', array_fill( 0, count( $suspended_user_ids ), '%d' ) );
$following_where_sql .= $wpdb->prepare(
" AND leader_id NOT IN ( {$placeholders} ) ",
...$suspended_user_ids
);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@istiaq-bb Please add filter here and use that filter inside in moderation component and move moderation query there.

…spended

Issue: total_friend_count meta was not updating correctly due to a strict type comparison between user_id (string) and friend_ids (integer).
Root Cause: The condition 'hide' === $type && in_array( $user_id, $friend_ids, true ) was failing because in_array was performing a strict type check (true flag), and $user_id was a string while friend_ids were integers.
Fix: Cast $user_id to integer before comparison to ensure the condition is satisfied.
- Added a filter to the friendship SQL query that excludes moderated/suspended users. This ensures accurate friendship counts when running the 'Repair total connections count for each member' tool from the admin panel, preventing incorrect counts for users with suspended friendships.
- Add migration code to fix my connection count and remove suspend user from follow table if any user is suspended
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants