Fields Mapping

edited September 2017 in Social Login
Hi there,

It is possible to grabbing data from social network (with which user is authorized) to mandatory fields on drupal site at register page?

For example, need to save personal page from social network, need to save name and surname in other field (real name field https://www.drupal.org/project/realname), need to save town on special field and etc.

Warm regards,
Alex.

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Hi Alex,

    yes, it's possible, but you need to modify the plugin.

    You have to open this file:
    social_login.module

    Then look for this function:
    function social_login_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id)

    The form fields are populated using the following lines:
    $form['account']['name']['#default_value'] = $user_login; $form['account']['mail']['#default_value'] = $user_email;

    There you need to add the code to set the default values for the fields.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.