File: /var/www/dev.captainschairit.com/wp-content/themes/captainschare/template-parts/profile-page.php
<?php
/**
* Template Name: Profile Page
*/
$user_ID = get_current_user_id();
if($user_ID && is_super_admin( $user_ID )) {
$url = get_site_url();
wp_redirect( $url );
}
if(!is_user_logged_in()) {
$url = get_site_url().'/cc-login';
wp_redirect( $url );
}
get_header();
$page_heading = get_field('page_heading');
$content_part = get_field('content_part');
$company_info = get_user_meta ( $user_ID, 'company_info', true);
$msp_chosen = get_user_meta ( $user_ID, 'msp_chosen', true);
$billing_info = get_user_meta ( $user_ID, 'billing_info', true);
$package_info = get_user_meta ( $user_ID, 'package_info', true);
$card_no = get_user_meta ( $user_ID, 'card_no', true);
$trial_date = get_user_meta ( $user_ID, 'trial_date', true);
$end_date = date('Y-m-d', strtotime($trial_date.' +'.$package_info['free_trial'].' days'));
$date1 = date_create($end_date);
$date2=date_create(date('Y-m-d'));
$diff = date_diff($date1,$date2);
// echo '<pre>'; print_r ($diff); echo '</pre>';
?>
<!-- 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">Captain's Chair</h2>
</div>
<div class="col-sm-12">
<div class="msp-tab mt-5">
<div class="msp-tab-body">
<div class="col-lg-12">
<div class="confirmation-page mb-5">
<h2 class="mb-3">Payment Profile</h2>
<!-- <p>Please confirm the below information is correct. No charges will be applied till the end of the
trial.</p>
<p>
Welcome to the Captain's Chair team.<br>
As a new Partner you will receive an email invite to your site within 1 business day.</p>
<p>If you have any questions before then, please give us a call.</p> -->
<div class="row equal-height-conf">
<div class="col-sm-6">
<h2>
<a href="<?php echo get_site_url(); ?>/edit-profile" class="float-right"><i class="fas fa-edit"></i></a>
Contact Details
</h2>
<p><?php echo $company_info['company_url']; ?>.captainschair.app</p>
<p><?php echo $company_info['first_name'].' '.$company_info['last_name']; ?></p>
<p><?php echo $company_info['email']; ?></p>
<p><?php echo $company_info['phone_no']; ?></p>
<p><?php echo $company_info['web_url']; ?></p>
</div>
<?php
// echo '<pre>'; print_r($msp_chosen);
$args = array(
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'cc-connectors',
'post_status' => 'publish',
);
$all_connectors = get_posts( $args );
// echo '<pre>'; print_r ($all_connectors); echo '</pre>';
$terms = get_terms( array(
'taxonomy' => 'cc-connector-types',
'hide_empty' => false,
));
// echo '<pre>'; print_r ($terms); echo '</pre>';
?>
<div class="col-sm-6">
<h2>Connectors</h2>
<?php foreach($terms as $term) {
// $term_obj = get_term_by();
$slugs_from_session = array_keys( $msp_chosen);
if(in_array($term->slug, $slugs_from_session)) {
// echo '<pre>'; print_r($slugs_from_session); ?>
<p>
<b> <?php echo $term->name.': '; ?></b>
<?php $out = array();
foreach($all_connectors as $connector) {
// echo '<pre>'; print_r($key);
if(in_array($connector->ID, $msp_chosen[$term->slug])) {
// echo '<pre>'; print_r($connector);
array_push($out, $connector->post_title);
?>
<!-- ConnectWise Automate, Microsoft O365 -->
<?php
}
} ?>
</p>
<span>
<?php
echo '<p>'.implode(', ', $out).'</p>';
}
}
?>
</div>
</div>
<div class="row equal-height-conf">
<div class="col-sm-6">
<h2>plan</h2>
<p><?php echo $package_info['name']; ?>
<span class="float-right">$<?php echo number_format($package_info['amount'], 2, '.', ''); ?></span></p>
<p><?php echo $package_info['free_trial']; ?> Day Trial</p>
<?php if($trial_date != '' && $diff->days >= 0) {
// $date1=date_create($end_date);
// echo $date2=date_create(date('Y-m-d'));
// $diff = date_diff($date1,$date2); ?>
<p><?php echo $diff->days; ?> Days Left</p>
<?php
} else if($trial_date != '' && $diff->days < 0) { ?>
<p>Your trial has expired!</p>
<?php
} ?>
</div>
<div class="col-sm-6">
<h2>
<a href="<?php echo get_site_url(); ?>/edit-billing-details" class="float-right"><i class="fas fa-edit"></i></a>
Payment Details
</h2>
<p><?php echo $billing_info['company_name']; ?></p>
<p><?php echo $billing_info['first_name'].' '.$billing_info['last_name'];; ?></p>
<p><?php echo $billing_info['bill_address']; ?></p>
<p><?php echo $Countries[$billing_info['bill_country']]; ?></p>
<p><?php echo $billing_info['bill_state']; ?></p>
<p><?php echo $billing_info['bill_city']; ?></p>
<p><?php echo $billing_info['bill_zip']; ?></p>
<p><b>Ctredit card</b>
**** **** **** <?php echo $card_no; ?></p>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
get_footer();
?>