I am trying to create a module where the users creates his account and on submit, i get his information and insert them in a second database too. I mean that he will exist in both databases and in Drupals user table and in user table of the other database.
How can i get his information and insert them to a custom database?
I am totally new to Drupal development.
Thank you in advance for any help or advice.
You will need to implement hook_form_alter() and use the following code:
function [YOUR_MODULE]_form_alter(&$form, &$form_state, $form_id)
{
if($form_id == "user_register_form")
{
$form['#submit'][] = "your_custom_submit_callback";
}
}
Then create the custom submit callback to manipulate the submitted values the way you like:
function your_custom_submit_callback($form, &$form_state)
{
// your code goes here...
}
Hope this works... Muhammad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With