Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/02/2013 08:49:29 PM (12 years ago)
Author:
boonebgorges
Message:

Prevent BP_User_Query from fetching spam users on alphabetical sort

BP_User_Query's 'alphabetical' sort type, in contrast to the other values of
'type', does not look at users' last_activity usermeta value. As a result, it
cannot infer spam/deleted/activated status in the same way as the other 'type'
values. To prevent spammed/deleted/unactivated users from being returned on
alphabetical sorts, we do a subquery that limits results to user_status = 0.

Fixes #5114

Props sbrajesh, imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r7636 r7638  
    311311                }
    312312
     313                // Alphabetical queries ignore last_activity, while BP uses last_activity
     314                // to infer spam/deleted/non-activated users. To ensure that these users
     315                // are filtered out, we add an appropriate sub-query.
     316                $sql['where'][] = "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE " . bp_core_get_status_sql( '' ) . " )";
     317
    313318                break;
    314319
Note: See TracChangeset for help on using the changeset viewer.