Plugin Directory

Changeset 3018698


Ignore:
Timestamp:
01/08/2024 10:17:38 AM (2 years ago)
Author:
devsoftbaltic
Message:

fixed https://wordpress.org/support/topic/error-after-updating-to-1-9-120/

Location:
surveyjs/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • surveyjs/trunk/ajax_handlers/save_survey.php

    r3006114 r3018698  
    1111    function callback() {
    1212        if($_SERVER['REQUEST_METHOD'] === 'POST') {
     13            global $wpdb;
     14            $table_name = $wpdb->prefix . 'sjs_my_surveys';
     15
    1316            $id = sanitize_key($_POST['Id']);
    1417            $json = current_user_can( 'unfiltered_html' ) ? $_POST['Json'] : wp_kses_post( $_POST['Json'] );
    1518            $theme = current_user_can( 'unfiltered_html' ) ? $_POST['Theme'] : wp_kses_post( $_POST['Theme'] );
    1619
     20            // create 'theme' column if not exists
     21            $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $table_name AND column_name = 'theme'"  );
     22            if(empty($row)){
     23                $wpdb->query("ALTER TABLE $table_name ADD theme LONGTEXT");
     24            }
     25            // EO create 'theme' column if not exists
     26
    1727            if(!!$json) {
    18                 global $wpdb;
    19                 $table_name = $wpdb->prefix . 'sjs_my_surveys';
    20 
    2128                $result = $wpdb->update(
    2229                    $table_name,
  • surveyjs/trunk/initializer.php

    r3006114 r3018698  
    174174        </div>
    175175        <script>
     176            let theme;
    176177            jQuery.ajax({
    177178                url:  "<?php echo esc_url($getSurveyJsonUri)  ?>",
     
    202203
    203204                const survey<?php echo $id ?> = new Survey.Model(json);
    204                 survey<?php echo $id ?>.applyTheme(theme);
     205                if (!!theme) {
     206                    survey<?php echo $id ?>.applyTheme(theme);
     207                }
    205208                window.survey<?php echo $id ?> = survey<?php echo $id ?>;
    206209                survey<?php echo $id ?>
  • surveyjs/trunk/views/editor.php

    r3006720 r3018698  
    9191                    function SurveyCreatorRenderComponent() {
    9292                        var CommercialLicense = <?php echo json_encode(file_exists(plugin_dir_path(__FILE__) . 'CommercialLicense.txt')) ?>;
    93                         var editorOptions = { showThemeTab: true, showLogicTab: true, showEmbededSurveyTab: false, showOptions: true, generateValidJSON : false };
    94                         Survey.setLicenseKey(
    95                             "NDJiZWUxOTktM2M0ZC00MDk2LWE4ODYtOGU1ZTM0ZTFkYjc4OzE9MjAyNC0xMi0wNywyPTIwMjQtMTItMDcsND0yMDI0LTEyLTA3"
    96                         );
     93                        var editorOptions = { showThemeTab: true, showLogicTab: true, showTranslationTab: true, showEmbededSurveyTab: false, showOptions: true, generateValidJSON : false, haveCommercialLicense: CommercialLicense };
    9794                        const editor = new SurveyCreator.SurveyCreator(editorOptions);
    9895                        editor.showState = true;
Note: See TracChangeset for help on using the changeset viewer.