Add a new field to "Create a course"

Add a new field to "Create a course"

by Chien-Hao Chen -
Number of replies: 4

im a new for PHP and Moodle 2.7.1+ ..., i want to add a field "Number of student" for control limited count of a course.

I did this in moodle\course\edit_form.php:

$mform->addElement('text','CountStudent', get_string('CountStudentcourse'),'maxlength="100"  size="10"');
        $mform->addHelpButton('CountStudent','CountStudentcourse');
        $mform->setType('CountStudent', PARAM_RAW);if(!empty($course->id)and!has_capability('moodle/course:changeCountStudent', $coursecontext)){
            $mform->hardFreeze('CountStudent');
            $mform->setConstants('CountStudent', $course->CountStudent);}


In the view show: CountStudentcourse and HelpButton Error

have some simple example for it?? thanks for all helps!! smile

Average of ratings: -
In reply to Chien-Hao Chen

Re: Add a new field to "Create a course"

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Do you mean you want to limit the number of students who can  be enrolled in a course? You can do this with the self enrolment plugin settings,where you specify the maximum number of enrolled users. Would that work instead? See the documentation Self enrolment

Average of ratings: Useful (2)
In reply to Mary Cooch

Re: Add a new field to "Create a course"

by Chien-Hao Chen -

Thanks u so much!! Finally I found plugin!! :D

But the option "Max enroll Users" of "Self Enroll", can I move to the page "Add a new course"??

For easy configuration....


Thanks again!! smile

In reply to Chien-Hao Chen

Re: Add a new field to "Create a course"

by Eder dos Santos -

Hi, Chien-Hao Chen!

Once you created a course, you can set this property only for that course you've created, instead of setting it at site-level.

You must check the enrollment method at:

<yoururl>/enrol/self/edit.php?courseid=<courseid>

Regards.

In reply to Eder dos Santos

Re: Add a new field to "Create a course"

by Chien-Hao Chen -

Hi,  Sr. Santos! 

       M... I know I can set porperty (Max enrolled users) in the page "/moodle/enrol/self/edit.php?courseid=2&id=3" for the course i've created. 

       But my question is... how can i move or show this option "Max enrolled users" in the page "add a new course" (/moodle/course/edit.php?category=1&returnto=topcat) for easy setting "Max enrolled users" when Im creating a new course.


thanks so much for respond! smile

Salud!