I am trying to customize the signup form in moodle. I have modified moodle\login\signup_form.php to add additional fields. Now I want to change the action url of the form. Because my signup form is on the home page and I want to change the action url to moodle\login\signup.php. Please help.
1 Answers
You can pass URL when the form is being called to your new action URL where the form supposed to be processed. So in moodle/login/signup.php
$mform_signup = $authplugin->signup_form($CFG->wwwroot . '/path/to/file.php');
You should NOT be editing Moodle core files - It will be a serious problem when upgrading and have other consequences - Instead, you should get into the habit of creating new plugins, in this case, you could create a local plugin https://docs.moodle.org/dev/Local_plugins and put your new form with all the changes you want in there.
You could copy the form and logic process from the core signup into your new local plugin. Once you have the form on your new local plugin, you can go to Site Administration > Plugins > Authentication > Manage Authentications and change the Alternate Login URL setting to your new login form which would be something like moodle/local/mylocalpluginname/login.php. When users will log in, it will take them to your custom login form.

- 330
- 4
- 13