Redirect after signup

Redirect after signup

by Zeid Fanous -
Number of replies: 9

Hi all, 


can i redirect a user to course directly after signup. I am using Moodle 2.9 and currently the user goes to the user preference page after signup. I would like to redirect the user to a course page. Is that possible?


Thanks smile 

Average of ratings: -
In reply to Zeid Fanous

Re: Redirect after signup

by Zeid Fanous -

I finally managed to do it after editing the URL in edit.php. i hope this the correct way. it works

In reply to Zeid Fanous

Re: Redirect after signup

by james aco -

Hello,

will you share the change you made in the edit.php

Thank you

In reply to james aco

Re: Redirect after signup

by Zeid Fanous -
Hi James, sure thing,


I edited the edit.php in moodle/user. 

// Remote users cannot be edited.

if (is_mnet_remote_user($user)) {

    if (user_not_fully_set_up($user)) {

        $hostwwwroot = $DB->get_field('mnet_host', 'wwwroot', array('id' => $user->mnethostid));

        print_error('usernotfullysetup', 'mnet', '', $hostwwwroot);

    }

    redirect($CFG->wwwroot . "/user/view.php?course={$course->id}");

}


i added the URL to the redirect statement above, i will only be using moodle for assessment after signup. so it might not be convenient for different scenarios. it works for me smile 

In reply to Zeid Fanous

Re: Redirect after signup

by سودابه سامانلو -
hi, 

I want redirect the user to profile After registration.

But I don't t know the solution. Please more explain about your solution.

In reply to سودابه سامانلو

Re: Redirect after signup

by Zeid Fanous -

Hi, 


please see my post above smile 

In reply to Zeid Fanous

Re: Redirect after signup

by سودابه سامانلو -
Thanks for answer,
 how can I change these code that redirect to user profile!!!?
********************
if (is_mnet_remote_user($user)) {
    if (user_not_fully_set_up($user, true)) {
        $hostwwwroot = $DB->get_field('mnet_host', 'wwwroot', array('id' => $user->mnethostid));
        print_error('usernotfullysetup', 'mnet', '', $hostwwwroot);
    }
    redirect($CFG->wwwroot . "/user/view.php?course={$userid->id}");
}
*********************
this is user/edit.php
Change this file is enough???
what another file that I should  change for redirect user after signup?
please help me  blush blush
Thanks.
In reply to سودابه سامانلو

Re: Redirect after signup

by Zeid Fanous -

oh i smile am no expert... that is as far as i knoww smile ... i think you need a more experienced person .

In reply to Zeid Fanous

Re: Redirect after signup

by Stuart Mealor -

You could ensure that users are sent to their Dashboard when they Login, and then it's easy for them to get to their Profile.

I don't really understand why you would want to force people to go to their Profile page when they Login?  What do you expect them to do?  Directing to the Front Page or their Dashboard seems a lot more logical and useful smile

Average of ratings: Useful (1)
In reply to سودابه سامانلو

Re: Redirect after signup

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It's up to you but I wouldn't recommend making changes to core code. Will you remember what you did when it comes to upgrades (and will the code be the same)?

If you send someone the link to the course page they will be asked to log in and then will be sent to the course page without any code changes.