• Resolved kelmoda

    (@kelmoda)


    Hello,
    I’ve updated from watu 1.6 (which worked OK) to 1.7 and with this last version I’m not able to create exams. I allways receive the same “To add this exam to your blog, insert the code [WATU 0] into any post.” And looking at the DB, no exam has been created.

    The table wp_watu_master has the following fields:
    ID, name, description, final_screen, added_on
    In watu.php file, at the create table sql only have this fields.

    In watu_exam.php file the insert sql says:

    INSERT INTO wp_watu_master
    (name, description, final_screen, added_on, randomize)

    This means that the sql insert code has extra column, randomize.

    Is this an error?

    https://www.ads-software.com/extend/plugins/watu/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Bob

    (@prasunsen)

    You need to deactivate and activate the plugin so the new table field gets added.

    Thread Starter kelmoda

    (@kelmoda)

    I’ve done this twice and assured both times that tables were dropped.

    I’ve just downloaded again the watu.zip file and assured that in the watu.php file the create statement for the table watu_master doesn’t include the randomize column and the insert statement in the exam.php file has it included.

    I’ve seen there is an alter table at the end of the file including this column. I’ll try again and tell you.

    Thank you for your answer

    Plugin Author Bob

    (@prasunsen)

    It does include the SQL, in watu.php on line 151:

    // db updates in 1.7
    if(empty($version) or $version < 1.7) {
    $sql = “ALTER TABLE {$wpdb->prefix}watu_master ADD randomize TINYINT NOT NULL”;
    $wpdb->query($sql);
    }

    I have absolutely no idea why it wouldn’t create the field for you. The upgrade works fine for me and apparently to everyone else. Maybe you’ll have to manually add the field in your phpmyadmin.

    Thread Starter kelmoda

    (@kelmoda)

    Thank you so much for your answer. You are right, the code is there.

    I don’t know why this line of code hasn’t been executed:
    if(empty($version) or $version < 1.7) {
    $sql = “ALTER TABLE {$wpdb->prefix}watu_master ADD randomize TINYINT NOT NULL”;
    $wpdb->query($sql);
    }

    May be because you are using $wpdb->query($sql); instead of dbDelta($sql); ?
    Or may be because {$wpdb->prefix}watu_master is not between ‘ ‘ ?

    I’ve updated manually the table and everything works well.

    Congratulations for your plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Version 1.7 doesn't create exams’ is closed to new replies.