game options and db/install.xml

game options and db/install.xml

Alexander Dominicus發表於
Number of replies: 2
Testers的相片

Hi guys,

I've added some additional features to a quiz plugin (which you can find here) and I want to control these features by the game options.  So I added all the required fields in the game options form, and also the corresponding PHP-code in the background.

Now, I tick an option by its checkbox and klick "safe"-button which leads me back to the game. But when I'm checking the options again the ticked checkbox is still unticked (which is the default state of this option). So the chosen options is not safed after pressing the safe button.

If I change the corresponding variables in the PHP-code by hand everything works correctly and the changes will be applied to the game (the form entries of course do not change).


I'm suspecting this error is coming from the db/install.xml file, where are all game options are safed. I've added my options also in this file and changed "version.php" to update this file. Is it enough to do it that way or should I reinstall the plugin completely after editing the db/install.xml file?

Is there a way to see the content which is safed in the corresponding xmldb table? So I can check if the options will change entries in this table....


Many thanks in advance!


Best,

Alex

評比平均分數: -
In reply to Alexander Dominicus

Re: game options and db/install.xml

Davo Smith發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Moodle only looks at install.xml when the plugin is first installed (there is a clue in the name) - if you want to add changes after that, you either need to uninstall/reinstall the plugin (deleting all current data), or write an upgrade script with instructions about how to alter the database definition to match: https://docs.moodle.org/dev/Upgrade_API#The_files_you_need_for_the_second_release
評比平均分數:Useful (3)