i am creating a web service for user registration. I just add some fields in user registration form using profile2 module. How can i integrate this with services module. i just want to make a services with the new fields
1 Answer
I'm assuming you're familiar with Services. In your endpoint, Copy the pattern here:
array(
'name' => 'username',
'type' => 'string',
'description' => 'A valid username',
'source' => array('data' => 'username'),
'optional' => FALSE,
),
array(
'name' => 'password',
'type' => 'string',
'description' => 'A valid password',
'source' => array('data' => 'password'),
'optional' => FALSE,
),
For your arguments, and add your field machine names.
Inside your callback, you can set $form_state['values'][...] with the passed values, and then use
drupal_form_submit('user_register_form', $form_state);
To register the user.