Alternative Login in and course redirect - Moodle 2.9.3

Alternative Login in and course redirect - Moodle 2.9.3

by Dave Emsley -
Number of replies: 1

Hi All,

I know this is possible but I cannot find out exactly where to redirect this.  I have developed an alternative signup and, once this has happened, I need to  redirect them to a course which will automatically log them in with their new user information.

I have got the user inserted into the user table using:

 user_create_user($user)

I have enrolled them on the course with:

enrol_try_internal_enrol($row->id, $newuser->id, $studentroleid, $start_time,$end_time)

However I cannot seem to redirect them to the course and them be logged in which is what I need to do to get this working as I need it.


Any help and advice gratefully received,


Best Regards


Dave







Average of ratings: -
In reply to Dave Emsley

Re: Alternative Login in and course redirect - Moodle 2.9.3

by Dave Emsley -

The answer is

core_login_get_return_url();

from '/login/lib.php'


I said I was impressed by how easy the core developers had made it


Cheers

Average of ratings: Useful (1)