I would like to change default certificate settings. For example, when a teacher adds a certificate to a course, I would like the "Save Certificates" setting to be defaulted to Yes. Many of our teachers overlook this setting. I have tried changing the default in the database, but it seems to have no effect. Are these defaults established somewhere in the php code? If so, where?
I have not tested this but I am pretty sure it is here- mod/certificate/db/install.xml on the line
FIELD NAME="savecert" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="emailothers" NEXT="reportcert"/>
Change the default to 1
As alway YMMV and test on a non production server. Normally I test my suggestion before making them but I am buried in work right now.
It appears that this file is used during installation of the certificate module to create the database tables that support it. I had already gone into the underlying database and changed that default value to "1", but it had no effect when actually adding a certificate to a course. Changing it in this install file had no impact either. This is what makes me think there is scripting somewhere that is overriding this database setting.
After much searching, I found these default parameters being set in mod/certificate/mod_form.php. Specifically in the following lines:
$mform->addElement('select', 'savecert', get_string('savecertificate', 'certificate'), $ynoptions);
$mform->setDefault('savecert', 1);
$mform->setHelpButton('savecert', array('save', get_string('savecertificate', 'certificate'), 'certificate'));
Where the setDefault('savecert', 1) was originally set to 0. Setting it to 1 has done the trick.
$mform->addElement('select', 'savecert', get_string('savecertificate', 'certificate'), $ynoptions);
$mform->setDefault('savecert', 1);
$mform->setHelpButton('savecert', array('save', get_string('savecertificate', 'certificate'), 'certificate'));
Where the setDefault('savecert', 1) was originally set to 0. Setting it to 1 has done the trick.