WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/18/2016 08:04:36 PM (5 years ago)
Author:
westonruter
Message:

Customize: Implement customized state persistence with changesets.

Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r38708 r38810  
    367367 *
    368368 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
     369 * @global WP_Customize_Manager $wp_customize
    369370 */
    370371function wp_admin_bar_customize_menu( $wp_admin_bar ) {
     372    global $wp_customize;
     373
    371374    // Don't show for users who can't access the customizer or when in the admin.
    372375    if ( ! current_user_can( 'customize' ) || is_admin() ) {
     
    374377    }
    375378
     379    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
     380    if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) {
     381        return;
     382    }
     383
    376384    $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     385    if ( is_customize_preview() && $wp_customize->changeset_uuid() ) {
     386        $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url );
     387    }
     388
    377389    $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
     390    if ( is_customize_preview() ) {
     391        $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url );
     392    }
    378393
    379394    $wp_admin_bar->add_menu( array(
Note: See TracChangeset for help on using the changeset viewer.