Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. add_action( 'user_register', 'action_before_user_register', 10, 1 );
  2.  
  3. function action_before_user_register( $user_id ) {
  4. $username = $user_info->user_login;
  5. $email = $user_info->user_email;
  6. // exit();
  7. if ( isset( $_POST['first_name'] ) ) $query_array['Name'] = $_POST['first_name'].' '.$_POST['last_name'];
  8. else $query_array['Name'] = $username;
  9. $query_array['Email'] = $email;
  10. $query_array['Customer_Id'] = $user_id;
  11. // print_r($query_array);
  12. // exit();
  13. $postdata = http_build_query(
  14. $query_array
  15. );
  16. $opts = array('http' =>
  17. array(
  18. 'method' => 'POST',
  19. 'header' => 'Content-type: application/x-www-form-urlencoded',
  20. 'content' => $postdata
  21. )
  22. );
  23. $context = stream_context_create($opts);
  24. $url = server_api.access_token.'/customers/add/';
  25. $result = json_decode(file_get_contents($url, false, $context));
  26. update_usermeta( $user_id, 'octopos_cus_id', $result->data->insert_id );
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement