Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $form_data = array();
  2. $form_data['values']['firstname'] = $user->field_civilite['und'][0]['tid'];
  3. $form_data['values']['lastname'] = $user->field_prenom['und'][0]['value'];
  4. $form_data['values']['mail'] = $user->field_nom['und'][0]['value'];
  5.  
  6. webform_client_form_submit(226, $form_data);
  7.  
  8. $node = node_load($nid); //nid is the node id of your webform
  9. global $user;
  10.  
  11. //the values to save
  12. $data = array(
  13. 1 => array('value' => array($first_value)),
  14. 2 => array('value' => array($second_value)),
  15. );
  16.  
  17. $submission = (object) array(
  18. 'nid' => $nid,
  19. 'uid' => $user->uid,
  20. 'submitted' => REQUEST_TIME,
  21. 'remote_addr' => ip_address(),
  22. 'is_draft' => FALSE,
  23. 'data' => $data,
  24. );
  25.  
  26. module_load_include('inc', 'webform', 'includes/webform.submissions');
  27. webform_submission_insert($node, $submission);
  28. webform_submission_send_mail($node, $submission);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement