File: /var/www/captainschairit.com/wp-content/themes/captainschare/template-parts/thankyou-page-other.php
<?php
/**
* Template Name: Thank You Page Other
*/
session_start();
unset($_SESSION['company_info']);
unset($_SESSION['msp_chosen']);
// unset($_SESSION['billing_info']);
unset($_SESSION['package_info']);
unset($_SESSION['card_info']);
// echo '<pre>'; print_r($_SESSION['company_info']);
// echo '<pre>'; print_r($_SESSION['msp_chosen']);
// if(count($_SESSION['company_info']) > 0 || count($_SESSION['msp_chosen']) > 0) {
// // $username = strstr($_SESSION['company_info']['email'], '@', true);
// $username = str_replace('.', '_', $_SESSION['company_info']['company_url']);
// $user_id_exists = username_exists($username);
// $error = array();
// // echo '<pre>'; print_r($_SESSION['company_info']);
// if ( ! $user_id_exists && false == email_exists( $_SESSION['company_info']['email'] )) {
// // $random_password = wp_generate_password( $length = 12, $include_standard_special_chars = false );
// // echo '<pre>'; print_r($_SESSION['company_info']);
// $password = wp_generate_password( 8, true, false );
// $user_id = wp_create_user($username, $password, $_SESSION['company_info']['email']);
// // echo 'here'; exit;
// if($user_id) {
// $u = new WP_User( $user_id );
// // Remove role
// $u->remove_role( 'subscriber' );
// // Add role
// $u->add_role( 'future_prospect' );
// // First name and last name
// $u->first_name( $_SESSION['company_info']['first_name'] );
// $u->last_name( $_SESSION['company_info']['last_name'] );
// // $response = createCustomerProfile($_SESSION['company_info']['email'], $_SESSION['billing_info'], $_SESSION['card_info'], $_SESSION['company_info'], $_SESSION['package_info']);
// // echo '<pre>'; print_r($response->getMessages()->getMessage());
// // echo 'here'; exit;
// // if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
// // echo "Succesfully created customer profile : " . $response->getCustomerProfileId() . "\n";
// // $paymentProfiles = $response->getCustomerPaymentProfileIdList();
// // $success[] = "Succesfully created customer profile : " . $response->getCustomerProfileId() . "\n";
// // $success[] = "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n";
// // echo "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n";
// // add_user_meta( $user_id, 'customer_profile_id', $response->getCustomerProfileId() );
// // add_user_meta( $user_id, 'payment_profile_id', $paymentProfiles[0] );
// // session_start();
// add_user_meta( $user_id, 'company_info', $_SESSION['company_info'] );
// add_user_meta( $user_id, 'msp_chosen', $_SESSION['msp_chosen'] );
// update_user_meta( $user_id, 'user_active_status', 'inactive' );
// // add_user_meta( $user_id, 'billing_info', $_SESSION['billing_info'] );
// // add_user_meta( $user_id, 'package_info', $_SESSION['package_info'] );
// // add_user_meta( $user_id, 'card_no', substr($_SESSION['card_info']['card_no'], -4) );
// custom_wp_new_user_notification_email($user_id, $password);
// // wp_new_user_notification_custom($user_id, $random_password);
// // wp_new_user_notification($user_id);
// unset($_SESSION['company_info']);
// unset($_SESSION['msp_chosen']);
// $url = get_site_url().'/thank-you';
// wp_redirect( $url );
// exit;
// // } else {
// // wp_delete_user($user_id);
// // // echo "ERROR : Invalid response\n";
// // $errorMessages = $response->getMessages()->getMessage();
// // // echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
// // $error[] = "ERROR : Couldn't create profile. Please check the card details and try again.\n";
// // // $error[] = "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
// // // echo '<pre>'; print_r($response);
// // }
// }
// } else {
// $error[] = 'User Already exists';
// }
// }
get_header();
$page_heading = get_field('page_heading');
$thank_you_text = get_field('thank_you_text');
$thank_you_content = get_field('thank_you_content');
// echo '<pre>'; print_r($_SESSION['msp_chosen']);
?>
<!-- Services -->
<section class="page-section msp-menu-top" id="CompanyInfo">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="heading01 mb-5"><?php echo $page_heading; ?></h2>
<div class="text-center thank-you">
<div class="warning-chk mt-5 pt-5">
<i class="far fa-meh"></i>
</div>
<h2 class="mb-5">Thank you</h2>
<p class="mb-3"><?php echo $thank_you_text; ?></p>
<p><?php echo $thank_you_content; ?></p>
</div>
</div>
</div>
</div>
</section>
<?php
get_footer();
?>