Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/22/2015 01:31:56 PM (10 years ago)
Author:
imath
Message:

On multisite configs, make sure unspamming the user from the Users Network Administration screen is updating the .

When a user is marked as spam from the front end, then marked as ham from the network-users administration screen using the 'unspam' bulk action, we need to be sure the field of the users table is updated so that BuddyPress effectively takes in account the user has been unspammed.

This commit also makes sure the user's cache has been cleared.

Fixes #5275

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-functions.php

    r9371 r9398  
    786786    remove_action( 'make_ham_user',  'bp_core_mark_user_ham_admin'  );
    787787
    788     // Determine if we are on an admin page
    789     $is_admin = is_admin();
    790     if ( $is_admin && ! defined( 'DOING_AJAX' ) ) {
    791         $is_admin = (bool) ( buddypress()->members->admin->user_page !== get_current_screen()->id );
    792     }
    793 
    794     // When marking as spam in the Dashboard, these actions are handled by WordPress
     788    // force the cleanup of WordPress content and status for multisite configs
    795789    if ( $do_wp_cleanup ) {
    796790
     
    813807            update_user_status( $user_id, 'spam', $is_spam );
    814808        }
    815 
    816         // Always set single site status
    817         $wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $user_id ) );
    818 
     809    }
     810
     811    // Update the user status
     812    $wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $user_id ) );
     813
     814    // Clean user cache
     815    clean_user_cache( $user_id );
     816
     817    if ( ! is_multisite() ) {
    819818        // Call multisite actions in single site mode for good measure
    820         if ( !is_multisite() ) {
    821             if ( true === $is_spam ) {
    822 
    823                 /**
    824                  * Fires at end of processing spammer in Dashboard if not multisite and user is spam.
    825                  *
    826                  * @since BuddyPress (1.5.0)
    827                  *
    828                  * @param int $value Displayed user ID.
    829                  */
    830                 do_action( 'make_spam_user', bp_displayed_user_id() );
    831             } else {
    832 
    833                 /**
    834                  * Fires at end of processing spammer in Dashboard if not multisite and user is not spam.
    835                  *
    836                  * @since BuddyPress (1.5.0)
    837                  *
    838                  * @param int $value Displayed user ID.
    839                  */
    840                 do_action( 'make_ham_user', bp_displayed_user_id() );
    841             }
    842 
    843 
     819        if ( true === $is_spam ) {
     820
     821            /**
     822             * Fires at end of processing spammer in Dashboard if not multisite and user is spam.
     823             *
     824             * @since BuddyPress (1.5.0)
     825             *
     826             * @param int $value user ID.
     827             */
     828            do_action( 'make_spam_user', $user_id );
     829        } else {
     830
     831            /**
     832             * Fires at end of processing spammer in Dashboard if not multisite and user is not spam.
     833             *
     834             * @since BuddyPress (1.5.0)
     835             *
     836             * @param int $value user ID.
     837             */
     838            do_action( 'make_ham_user', $user_id );
    844839        }
    845840    }
Note: See TracChangeset for help on using the changeset viewer.