Enroll in a course

Enroll in a course

by n kepi -
Number of replies: 13

Hi,

I wanna take out the enrollment function. So that it is not necessary to enroll in a course. I want to give the students the possibilty to start immediatly with the course when they`re logged in and choose out one course....

Can someone give me an advice how to solve this???

Necy

Average of ratings: -
In reply to n kepi

Re: Enroll in a course

by Tony Delahunty -

What is it you want not to happen?  If you want to make your courses accessible to guest users, set the 'Guest access' course setting . 

If you want logged on users to get in to the course without the 'Are you sure you want to enrol' confirmation screen, then you can  bypass this by commenting out the code block under  

else if (empty($_GET['confirm'] && .....  

in the 

/// Automatically enrol in to courses without password

section in the moodle\enrol\manual\enrol.php source file [assuming you're the default manual enrolment] - take care doing this, ie backup the code first.

If you want to disable the whole enrolment function, more than this, what do you want to happen instead?

Tony

In reply to Tony Delahunty

Re: Enroll in a course

by n kepi -

First of all thank you for your answer!

Well I just want that my students can take part in the courses without enrolling in....

so I´m goint to test your tipp now...and tell you after that what happend wide eyes

Necy

In reply to Tony Delahunty

Re: Enroll in a course

by n kepi -

I can disable this comment  'Are you sure you want to enrol' on the screen but I want to skip this enrol.php page???

Do you know what I mean???

Necy

In reply to n kepi

Re: Enroll in a course

by Tony Delahunty -

Hi Necy, maybe I wasn't too clear above: if you comment out various conditional sections of code in the manual/enrol.php (still assuming you're using the default enrolment method - you have to use something) as pasted here, then your users won't see the enrol.php page but will go straight through to the course/view.php?id=nn [or other requested page]

NB this is still a hack: the cleaner way would be to define a require_enrol_confirmation flag for setting on the Admin page (or even course by course) - I guess I can do this is there's demand for it... 

/// Automatically enrol into courses without password

    if ($course->password == "") {   // no password, so enrol

        if (isguest()) {
            add_to_log($course->id, "course", "guest", "view.php?id=$course->id", "$USER->id");

        }
        // TD - aug 2006 - sections below commented out so as to skip
        //    the  ' Are you sure you want to enrol' page
        /* else if (empty($_GET['confirm']) && empty($_GET['cancel'])) {

            print_header($strloginto, $course->fullname, "<a href=\".\">$strcourses</a> -> $strloginto");
            echo "<br />";
            notice_yesno(get_string("enrolmentconfirmation"), "enrol.php?id=$course->id&amp;confirm=1", "enrol.php?id=$course->id&amp;cancel=1");
            print_footer();
            exit;

        } */
        //elseif (!empty($_GET['confirm'])) {
          else  {
            if ($course->enrolperiod) {
                $timestart = time();
                $timeend = time() + $course->enrolperiod;
            } else {
                $timestart = $timeend = 0;
            }

            if (! enrol_student($USER->id, $course->id, $timestart, $timeend, 'manual')) {
                error("An error occurred while trying to enrol you.");
            }

            $subject = get_string("welcometocourse", "", $course->fullname);
            $a->coursename = $course->fullname;
            $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id";
            $message = get_string("welcometocoursetext", "", $a);
            if (! $teacher = get_teacher($course->id)) {
                $teacher = get_admin();
            }
            email_to_user($USER, $teacher, $subject, $message);

            add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id");

            $USER->student[$course->id] = true;

            if ($SESSION->wantsurl) {
                $destination = $SESSION->wantsurl;
                unset($SESSION->wantsurl);
            } else {
                $destination = "$CFG->wwwroot/course/view.php?id=$course->id";
            }

            redirect($destination);
        }
        /*elseif (!empty($_GET['cancel'])) {
            unset($SESSION->wantsurl);
            redirect($CFG->wwwroot);
        }
        */
    }

In reply to Tony Delahunty

Re: Enroll in a course

by n kepi -

Hi Tony!

Well, now at the moment I can skip the enroll page...but while the next page is loading there is s little error message for a few seconds....it´s so fast that I have difficulties to memorize the error message...

Do you know what it is???

In reply to n kepi

Re: Enroll in a course

by Tony Delahunty -

>> while the next page is loading there is s little error message for a few seconds....

(sorry for delayed response; only just seen this)  Well, at a guess, it could be an email send failure, since a confirmation email would normally be generated for a new enrol.  Is your email being routed, are the email addresses valid for new enrolments?

To see the message at your leisure, you need some kind of debugging setup to set a breakpoint I guess:  you could try putting in PHP die() statements at various points to try and trap the behaviour and reveal browser output- although obviously don't be doing this with your live code...  Or there's probably a PHP or Apache setting you could find to send your error messages to a file not the browser...

In reply to Tony Delahunty

Re: Enroll in a course

by Deleted user -

HI Tony,

Just been searching for an answer to what I'm trying to do and have come across your discussions.

Picture if you would areas of information for students, i.e. Student Union, Careers, Student Restaurant Menus, graphics and the like.

At the moment I add 9000 odd students into each information course that I've setup so that each person in charge of content can import their own materials etc. I have about 12 of these information courses for students. This means that when a student logs on and is presented with 'My Courses' there are in excess of 12 courses with descriptions on that home page plus whatever academic courses.

My idea was to try and create an 'events' course and link out to all the information courses from this single course. At the moment if a student is not enrolled in a course he cannot view it. If I can get this to work somehow then I would delete the students within the other information courses and only populate the one events course, enrollment not being necessary for the others.

I hope this is making sense and that you are able to guide me.

Is it possible to identify the information courses with some code that would allow open view access without students being able to get into every other course within our Moodle?

Thanks. Gerald

In reply to Tony Delahunty

Re: Enroll in a course

by Mabe Lan -

Hi, Tony:

How can I change "You are about to enroll yourself as a member of this course.
Are you sure you wish to do this?" to some other wordings??

Thanks very much

Fingers

In reply to Mabe Lan

Re: Enroll in a course

by Chris Potter -
Search through the file moodle\lang\en_utf8\moodle.php and find the string labeled:

$string['enrolmentconfirmation']

There you will see the wording you want to change. Keep in mind if you do future upgrades that this will get overwritten.

Hope that helps!
In reply to Chris Potter

Re: Enroll in a course

by Mabe Lan -

Hi, Chris:

Thank you very much. It works. You are awesome.

In reply to Tony Delahunty

Re: Enroll in a course

by Matthew Fleming -

There seems to be some update to the code since Tony posted this back in 2006.  I am trying to get rid of the screen that says:

You are about to enrol yourself as a member of this course.
Are you sure you wish to do this?

I followed the edits as shown above as best I could, but there were areas where the code does not match.  I'm currently on Moodle 1.9.5. 

Are there any updates to this work around.  It would really be great if this were an option similar to the option of whether or not to send an email confirmation.

Thanks,
Matt

In reply to Tony Delahunty

Re: Enroll in a course

by Paul Garratt -

Did anyone ever get this to work with the updated version of Moodle 1.9?

Thanks

In reply to Tony Delahunty

Re: Enroll in a course

by pascaline anjereboh -

Pascaline Anjereboh: Enrolling in a course was a kind of little issue to me but i think it's ok!