Skip to:
Content

BuddyPress.org

Ticket #5275: 5275.diff

File 5275.diff, 1.5 KB (added by imath, 11 years ago)
  • bp-members/bp-members-functions.php

     
    512512        if ( !$count = get_transient( 'bp_active_member_count' ) ) {
    513513                // Avoid a costly join by splitting the lookup
    514514                if ( is_multisite() ) {
    515                         $sql = "SELECT ID FROM {$wpdb->users} WHERE (user_status != 0 OR deleted != 0 OR user_status != 0)";
     515                        $sql = "SELECT ID FROM {$wpdb->users} WHERE (spam != 0 OR deleted != 0 OR user_status != 0)";
    516516                } else {
    517517                        $sql = "SELECT ID FROM {$wpdb->users} WHERE user_status != 0";
    518518                }
     
    585585                        update_user_status( $user_id, 'spam', $is_spam );
    586586                }
    587587
    588                 // Always set single site status
    589                 $wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $user_id ) );
    590 
    591588                // Call multisite actions in single site mode for good measure
    592589                if ( !is_multisite() ) {
    593590                        $wp_action = ( true === $is_spam ) ? 'make_spam_user' : 'make_ham_user';
     
    595592                }
    596593        }
    597594
     595        /**
     596         * Must be run in Administration screen and front end to be sure if the Admin switch
     597         * config user_status == spam when spaming from WordPress Network Admin users and
     598         * BuddyPress user's profile capabilities
     599         */
     600        $wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $user_id ) );
     601
    598602        // Hide this user's activity
    599603        if ( ( true === $is_spam ) && bp_is_active( 'activity' ) ) {
    600604                bp_activity_hide_user_activity( $user_id );