Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'user_register', 'action_before_user_register', 10, 1 );
- function action_before_user_register( $user_id ) {
- $username = $user_info->user_login;
- $email = $user_info->user_email;
- // exit();
- if ( isset( $_POST['first_name'] ) ) $query_array['Name'] = $_POST['first_name'].' '.$_POST['last_name'];
- else $query_array['Name'] = $username;
- $query_array['Email'] = $email;
- $query_array['Customer_Id'] = $user_id;
- // print_r($query_array);
- // exit();
- $postdata = http_build_query(
- $query_array
- );
- $opts = array('http' =>
- array(
- 'method' => 'POST',
- 'header' => 'Content-type: application/x-www-form-urlencoded',
- 'content' => $postdata
- )
- );
- $context = stream_context_create($opts);
- $url = server_api.access_token.'/customers/add/';
- $result = json_decode(file_get_contents($url, false, $context));
- update_usermeta( $user_id, 'octopos_cus_id', $result->data->insert_id );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement