__( 'Updates', 'address-autocomplete-anything' ) ), $done ); } public function step() { $user = wp_get_current_user(); // After a failed signup, show what was typed rather than the account's details $first_name = isset( $_POST['first_name'] ) ? sanitize_text_field( wp_unslash( $_POST['first_name'] ) ) : $user->first_name; $email = isset( $_POST['email'] ) ? sanitize_text_field( wp_unslash( $_POST['email'] ) ) : $user->user_email; ?>

failed = true; return; } $response = wp_remote_post( self::SIGNUP_URL, array( 'timeout' => 15, 'user-agent' => 'AddressAutocomplete/' . WPS_AA_VERSION . '; ' . home_url(), 'headers' => array( 'Content-Type' => 'application/json' ), 'body' => wp_json_encode( array( 'email' => $email, 'first_name' => isset( $_POST['first_name'] ) ? sanitize_text_field( wp_unslash( $_POST['first_name'] ) ) : '', 'time_zone' => wp_timezone_string(), ) ), ) ); $result = json_decode( wp_remote_retrieve_body( $response ) ); // Groundhogg sends the contact back when the signup worked if ( empty( $result->contact ) ) { WPSunshine_Address_Autocomplete_Options::add_notice( __( 'I couldn\'t sign you up right now. Try again, or skip this step.', 'address-autocomplete-anything' ), 'error' ); $this->failed = true; } } public function save_ok( $ok, $step ) { return ( 'updates' === $step && $this->failed ) ? false : $ok; } } new WPSunshine_Address_Autocomplete_Setup_Updates();