Make WordPress Core


Ignore:
Timestamp:
12/02/2016 12:01:51 AM (8 years ago)
Author:
westonruter
Message:

Customize: Reject a changeset update when a non-future date is provided and also ensure that a published changeset always gets set to the current date/time.

  • Also moves checks from customize_save Ajax handler to the underlying WP_Customize_Manager::save_changeset_post() call which plugins may invoke directly.
  • Ensures that customize_save_response filter is always passed an array, with error code available as code.

Props utkarshpatel, westonruter, sayedwp.
See #30937.
Fixes #38943.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/manager.php

    r39346 r39409  
    628628            ),
    629629        );
     630        $date = ( gmdate( 'Y' ) + 1 ) . '-12-01 00:00:00';
    630631        $r = $manager->save_changeset_post( array(
    631632            'status' => 'auto-draft',
    632633            'title' => 'Auto Draft',
    633             'date_gmt' => '2010-01-01 00:00:00',
     634            'date_gmt' => $date,
    634635            'data' => $pre_saved_data,
    635636        ) );
     
    652653        $this->assertEquals( 'Auto Draft', get_post( $post_id )->post_title );
    653654        $this->assertEquals( 'auto-draft', get_post( $post_id )->post_status );
    654         $this->assertEquals( '2010-01-01 00:00:00', get_post( $post_id )->post_date_gmt );
     655        $this->assertEquals( $date, get_post( $post_id )->post_date_gmt );
    655656        $this->assertNotEquals( 'Changeset Title', get_option( 'blogname' ) );
    656657        $this->assertArrayHasKey( 'setting_validities', $r );
Note: See TracChangeset for help on using the changeset viewer.