X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/03f2fa83c13c1b532284205fa7efcab9b8b2c41f..refs/heads/pristine:/wp-admin/customize.php?autofocus%5Bcontrol%5D=header_image diff --git a/wp-admin/customize.php b/wp-admin/customize.php index aa949e54..44654c00 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -15,11 +15,36 @@ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'customize' ) ) { wp_die( '

' . __( 'Cheatin’ uh?' ) . '

' . - '

' . __( 'You are not allowed to customize the appearance of this site.' ) . '

', + '

' . __( 'Sorry, you are not allowed to customize this site.' ) . '

', 403 ); } +/** + * @global WP_Scripts $wp_scripts + * @global WP_Customize_Manager $wp_customize + */ +global $wp_scripts, $wp_customize; + +if ( $wp_customize->changeset_post_id() ) { + if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '

', + 403 + ); + } + if ( in_array( get_post_status( $wp_customize->changeset_post_id() ), array( 'publish', 'trash' ), true ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'This changeset has already been published and cannot be further modified.' ) . '

' . + '

' . __( 'Customize New Changes' ) . '

', + 403 + ); + } +} + + wp_reset_vars( array( 'url', 'return', 'autofocus' ) ); if ( ! empty( $url ) ) { $wp_customize->set_preview_url( wp_unslash( $url ) ); @@ -31,12 +56,6 @@ if ( ! empty( $autofocus ) && is_array( $autofocus ) ) { $wp_customize->set_autofocus( wp_unslash( $autofocus ) ); } -/** - * @global WP_Scripts $wp_scripts - * @global WP_Customize_Manager $wp_customize - */ -global $wp_scripts, $wp_customize; - $registered = $wp_scripts->registered; $wp_scripts = new WP_Scripts; $wp_scripts->registered = $registered; @@ -115,42 +134,66 @@ do_action( 'customize_controls_print_scripts' );
is_theme_active() ? __( 'Save & Publish' ) : __( 'Save & Activate' ); - submit_button( $save_text, 'primary save', 'save', false ); + $save_attrs = array(); + if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) { + $save_attrs['style'] = 'display: none'; + } + submit_button( $save_text, 'primary save', 'save', false, $save_attrs ); ?> - + - +
-
+
' . get_bloginfo( 'name' ) . '' ); ?> - +
-
+
+ +
@@ -158,7 +201,7 @@ do_action( 'customize_controls_print_scripts' );