I had a problem with Faculty changing the CourseID number in a course that had been autocreated using enrol_database_sync.php.
So I have made a modification to course/edit_form.pnp that hides the courseID from anyone without the Admin role
at Line 78 I have added this test...
if(has_capability('moodle/site:doanything',$categorycontext)) {
$mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"');
$mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true);
$mform->setType('idnumber', PARAM_RAW);
}else{
$mvorm->addElement('hidden','idnumber', getstring('idnumbercourse'));
}
It seems to work. My question is do I need the else that adds the hidden element. I had assumed that without it the data in the database would be removed.
If this works I want to hide other fields like user/idnumber that is my key for ldap auth.
V