WordPress.org

Making WordPress.org

Ticket #1110: 1110.diff

File 1110.diff, 1.8 KB (added by satwant5, 6 years ago)

IMport widgets functionality added

  • wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/includes/source-site-id-setting.php

    diff --git wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/includes/source-site-id-setting.php wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/includes/source-site-id-setting.php
    index ae450ea..27726e5 100644
    class Source_Site_ID_Setting extends \WP_Customize_Setting { 
    101101
    102102                return $skip;
    103103        }
    104 
    105         /**
    106          * Clone the source site into the current site
    107          *
    108          * If the theme needs to be switched, Core will do that for us because we added the `?theme=` parameter
    109          * to the URL.
    110          *
    111          * @param int $source_site_id
    112          */
    113         protected function update( $source_site_id ) {
     104       
     105        protected function update_css( $source_site_id ) {
    114106                switch_to_blog( $source_site_id );
    115107
    116108                if ( ! $source_cite_css_post = \Jetpack_Custom_CSS::get_current_revision() ) {
    class Source_Site_ID_Setting extends \WP_Customize_Setting { 
    133125                        'content_width'   => $source_site_content_width,
    134126                ) );
    135127        }
     128       
     129        protected function update_widgets( $source_site_id ) {
     130                switch_to_blog( $source_site_id );
     131       
     132                $sidebars_widgets = get_option('sidebars_widgets');
     133
     134                restore_current_blog();
     135       
     136                if ( !isset( $sidebars_widgets['array_version'] ) )                     
     137                        $sidebars_widgets['array_version'] = 3;
     138                update_option( 'sidebars_widgets', $sidebars_widgets );
     139        }
     140        /**
     141         * Clone the source site into the current site
     142         *
     143         * If the theme needs to be switched, Core will do that for us because we added the `?theme=` parameter
     144         * to the URL.
     145         *
     146         * @param int $source_site_id
     147         */
     148        protected function update( $source_site_id ) {
     149                update_css( $source_site_id );
     150                update_widgets( $source_site_id );
     151        }
     152
    136153}