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/tests/phpunit/testcases/members/functions.php

    r9336 r9398  
    451451     * @group bp_core_process_spammer_status
    452452     */
     453    public function test_bp_core_process_spammer_status() {
     454        if ( is_multisite() ) {
     455            return;
     456        }
     457
     458        $bp = buddypress();
     459        $displayed_user = $bp->displayed_user;
     460
     461        $u1 = $this->factory->user->create();
     462        $bp->displayed_user->id = $u1;
     463
     464        // Spam the user
     465        bp_core_process_spammer_status( $u1, 'spam' );
     466
     467        $this->assertTrue( bp_is_user_spammer( $u1 ) );
     468
     469        // Unspam the user
     470        bp_core_process_spammer_status( $u1, 'ham' );
     471
     472        $this->assertFalse( bp_is_user_spammer( $u1 ) );
     473
     474        // Reset displayed user
     475        $bp->displayed_user = $displayed_user;
     476    }
     477
     478    /**
     479     * @group bp_core_process_spammer_status
     480     */
     481    public function test_bp_core_process_spammer_status_ms_bulk_spam() {
     482        if ( ! is_multisite() ) {
     483            return;
     484        }
     485
     486        $bp = buddypress();
     487        $displayed_user = $bp->displayed_user;
     488
     489        $u1 = $this->factory->user->create();
     490        $bp->displayed_user->id = $u1;
     491
     492        // Bulk spam in network admin uses update_user_status
     493        update_user_status( $u1, 'spam', '1' );
     494
     495        $this->assertTrue( bp_is_user_spammer( $u1 ) );
     496
     497        // Unspam the user
     498        bp_core_process_spammer_status( $u1, 'ham' );
     499
     500        $this->assertFalse( bp_is_user_spammer( $u1 ) );
     501
     502        // Reset displayed user
     503        $bp->displayed_user = $displayed_user;
     504    }
     505
     506    /**
     507     * @group bp_core_process_spammer_status
     508     */
     509    public function test_bp_core_process_spammer_status_ms_bulk_ham() {
     510        if ( ! is_multisite() ) {
     511            return;
     512        }
     513
     514        $bp = buddypress();
     515        $displayed_user = $bp->displayed_user;
     516
     517        $u1 = $this->factory->user->create();
     518        $bp->displayed_user->id = $u1;
     519
     520        // Spam the user
     521        bp_core_process_spammer_status( $u1, 'spam' );
     522
     523        $this->assertTrue( bp_is_user_spammer( $u1 ) );
     524
     525        // Bulk unspam in network admin uses update_user_status
     526        update_user_status( $u1, 'spam', '0' );
     527
     528        $this->assertFalse( bp_is_user_spammer( $u1 ) );
     529
     530        // Reset displayed user
     531        $bp->displayed_user = $displayed_user;
     532    }
     533
     534    /**
     535     * @group bp_core_process_spammer_status
     536     */
    453537    public function test_bp_core_process_spammer_status_make_spam_user_filter() {
    454538        add_filter( 'make_spam_user', array( $this, 'notification_filter_callback' ) );
Note: See TracChangeset for help on using the changeset viewer.