문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top