Links to my online courses are posted on various websites. The link look like this : https://example.com/course/view.php?id=31
When new users click on the link, they are brought to my Moodle website login page.
When they sign-up with Google authentication, they are taken to the form where they need to fill up a couple of custom fields.
After they fill in the custom fields and submit, they are taken to preferences.php
Instead of the preferences.php, I need them to go to the original URL, which is stored in "wantsurl"
Right now, I have just edited the preferences.php and used a simple redirect to send users to the dashboard page.
What code can I add to the preferences.php page to redirect users to the original URL that they want to go to? i.e. "wantsurl"
Note: If I remove the custom fields, users are redirected to the course page (wantsurl) after authentication. But the custom fields are essential.
If a user is previously registered on my website, they are properly redirected to "wantsurl" after the Google authentication. It is only when they have to fill in the custom fields that they get redirected to the preferences page.