Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_create_sandbox( $update_data, $user_id, $contact_id, $form_id ) {
- if ( $form_id == 6 ) {
- $email = explode( '@', $update_data['email'] );
- // Stop spammers
- if ( is_numeric( $email[0] ) ) {
- return;
- }
- $args = array(
- 'timeout' => 20,
- );
- $response = wp_remote_post( 'https://wpfusiondemo.com/wp-json/llmstm/v1/sites?key=0mZoq6VBhce3&type=trial&template=cool-violet&email=' . urlencode( $update_data['email'] ), $args );
- if ( is_wp_error( $response ) ) {
- error_log( 'ERROR' );
- error_log( print_r( $response, true ) );
- }
- $response = json_decode( wp_remote_retrieve_body( $response ) );
- $update_data = array(
- 'field[30,0]' => $response->login_url_priv,
- 'field[31,0]' => $response->password,
- );
- wp_fusion()->crm->update_contact( $contact_id, $update_data, false );
- }
- }
- add_action( 'wpf_forms_post_submission', 'wpf_create_sandbox', 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement