Make WordPress Core

Changeset 31421


Ignore:
Timestamp:
02/11/2015 10:12:47 PM (12 years ago)
Author:
ocean90
Message:

Customizer: Restore showing a login form inside the previewer if an user is logged out.

Broken since [31370].

props westonruter.
see #31294.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r31370 r31421  
    141141         */
    142142        protected function wp_die( $ajax_message, $message = null ) {
    143                 if ( $this->doing_ajax() )
     143                if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
    144144                        wp_die( $ajax_message );
    145 
    146                 if ( ! $message )
     145                }
     146
     147                if ( ! $message ) {
    147148                        $message = __( 'Cheatin’ uh?' );
     149                }
    148150
    149151                wp_die( $message );
     
    158160         */
    159161        public function wp_die_handler() {
    160                 if ( $this->doing_ajax() )
     162                if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
    161163                        return '_ajax_wp_die_handler';
     164                }
    162165
    163166                return '_default_wp_die_handler';
     
    174177                send_origin_headers();
    175178
    176                 if ( is_admin() && ! $this->doing_ajax() )
    177                     auth_redirect();
    178                 elseif ( $this->doing_ajax() && ! is_user_logged_in() )
    179                     $this->wp_die( 0 );
     179                $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
     180                if ( is_admin() && ! $doing_ajax_or_is_customized ) {
     181                        auth_redirect();
     182                } elseif ( $doing_ajax_or_is_customized && ! is_user_logged_in() ) {
     183                        $this->wp_die( 0 );
     184                }
    180185
    181186                show_admin_bar( false );
     
    195200                        // If the requested theme is not the active theme and the user doesn't have the
    196201                        // switch_themes cap, bail.
    197                         if ( ! current_user_can( 'switch_themes' ) )
     202                        if ( ! current_user_can( 'switch_themes' ) ) {
    198203                                $this->wp_die( -1 );
     204                        }
    199205
    200206                        // If the theme has errors while loading, bail.
    201                         if ( $this->theme()->errors() )
     207                        if ( $this->theme()->errors() ) {
    202208                                $this->wp_die( -1 );
     209                        }
    203210
    204211                        // If the theme isn't allowed per multisite settings, bail.
    205                         if ( ! $this->theme()->is_allowed() )
     212                        if ( ! $this->theme()->is_allowed() ) {
    206213                                $this->wp_die( -1 );
     214                        }
    207215                }
    208216
     
    216224         */
    217225        public function after_setup_theme() {
    218                 if ( ! $this->doing_ajax() && ! validate_current_theme() ) {
     226                $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_SERVER['customized'] ) );
     227                if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
    219228                        wp_redirect( 'themes.php?broken=true' );
    220229                        exit;
     
    230239        public function start_previewing_theme() {
    231240                // Bail if we're already previewing.
    232                 if ( $this->is_preview() )
     241                if ( $this->is_preview() ) {
    233242                        return;
     243                }
    234244
    235245                $this->previewing = true;
     
    267277         */
    268278        public function stop_previewing_theme() {
    269                 if ( ! $this->is_preview() )
     279                if ( ! $this->is_preview() ) {
    270280                        return;
     281                }
    271282
    272283                $this->previewing = false;
Note: See TracChangeset for help on using the changeset viewer.