WordPress.org

Ready to get started?Download WordPress

Forums

Watu
[resolved] Version 1.7 doesn't create exams (5 posts)

  1. kelmoda
    Member
    Posted 1 year ago #

    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?

    http://wordpress.org/extend/plugins/watu/

  2. prasunsen
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. kelmoda
    Member
    Posted 1 year ago #

    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

  4. prasunsen
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. kelmoda
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic