Use “Self enrolment” in “Add a new course”

Use “Self enrolment” in “Add a new course”

by Chien-Hao Chen -
Number of replies: 0

Hi! ... Im new for PHP and Moodle..., I want set "Max enrolled users" in the page "Add a new course".

In this moment i did this code in archive(moodle\course\edit_form.php):

    $mform->addElement('text','customint3', get_string('maxenrolled','enrol_self'));

    $mform->addHelpButton('customint3','maxenrolled','enrol_self');

    $mform->setType('customint3', PARAM_INT);

but i know miss something for use Self Enrolment in this page... like active the table "enrol_self"...

For use "Self Enrolment" , first need to get "CourseID". Because in the page of "Self Enrolment" need foreign key for updating the format of a course.

So... how can I do in the code "edit_form.php" for creating a course and updating Enrolment Self(maxenrolled) immediately after click the button?? Have function of moodle for easy edit it??


And... Could I pass the value of $mform->addElement() to another variable?

Something like>>

$mform->addElement('text','customint3', get_string('maxenrolled','enrol_self'),
$_SESSION['varname']);


Need your advice please!! And thanks!!

Average of ratings: -