Skip to:
Content

BuddyPress.org

Changeset 8987


Ignore:
Timestamp:
09/07/2014 09:30:04 PM (10 years ago)
Author:
imath
Message:

Make sure xprofile_sync_bp_profile() happens when a user is edited

Bring back checks on the $update var and WordPress error that were removed in r8810 so that the xProfile sync only happens when a user is edited. Add a unit test.

Props boonebgorges

Fixes #5836

Location:
trunk
Files:
2 edited

Legend:

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

    r8928 r8987  
    768768
    769769    // Bail if profile syncing is disabled
    770     if ( bp_disable_profile_sync() ) {
     770    if ( bp_disable_profile_sync() || ! $update || $errors->get_error_codes() ) {
    771771        return;
    772772    }
  • trunk/tests/phpunit/testcases/xprofile/functions.php

    r8986 r8987  
    571571
    572572    /**
     573     * @group xprofile_set_field_data
     574     * @ticket BP5836
     575     */
     576    public function test_xprofile_sync_bp_profile_new_user() {
     577        $post_vars = $_POST;
     578
     579        $_POST = array(
     580            'user_login' => 'foobar',
     581            'pass1'      => 'password',
     582            'pass2'      => 'password',
     583            'role'       => 'subscriber',
     584            'email'      => 'foo@bar.com',
     585            'first_name' => 'Foo',
     586            'last_name'  => 'Bar',
     587        );
     588
     589        $id = add_user();
     590
     591        $display_name = 'Bar Foo';
     592
     593        $_POST = array(
     594            'display_name' => $display_name,
     595            'email'        => 'foo@bar.com',
     596        );
     597
     598        $id = edit_user( $id );
     599
     600        // clean up post vars
     601        $_POST = $post_vars;
     602
     603        $this->assertEquals( $display_name, xprofile_get_field_data( bp_xprofile_fullname_field_id(), $id ) );
     604    }
     605
     606    /**
    573607     * @group xprofile_insert_field
    574608     */
Note: See TracChangeset for help on using the changeset viewer.