0

We have a webform and our clients can register for an event using this webform, some of fields are preloaded in the form like "firstname" or "lastname", but i like to update the user info in the user's table in case if the user change his/her info in the event registration webform.

I like to know also how can I update user info using single query because when I look at Drupal database, every single info is in different table like 'field_data_field_first_name' !

I'm not really experienced in Drupal development, so thx for ur help.

0

You can use the 'Rules' module to trigger an event when your webform is submitted. Using rules pull out the fields, compare them and update the Profile information if they have changed.

Webform integration: - http://drupal.org/node/474644

Hope this helps.

0

Resolved with this :

function module_name_form_alter(&$form, &$form_state, $form_id)
{
    if($form_id == "form_id")
    {
        $form['#submit'][] = 'module_name_additional_insert';
    }
}


function module_name_additional_insert($form, &$form_state)
{
    $data = $form['submitted'];

    global $user;
    $account = user_load($user -> uid);

    $account -> field_name[LANGUAGE_NONE][0][value] = $data['variable_name']['#value'];

    field_attach_update('user', $account);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.