data_accountinfo.php 1.47 KB
<?php
/**
 * account info for ajax
 * @author Ho Ngoc Hang<kemly.vn@gmail.com>
 */
//$current_user = wp_get_current_user();
global $current_user;
global $wpdb;
$query = "SELECT user_email FROM $wpdb->users WHERE `ID` = '" . $current_user->data->ID . "'";
$resut = $wpdb->get_results($query);
if (count($resut) > 0) {
    $current_email = $resut[0]->user_email;
}
//get_userdata
//$current_email = isset($current_user->user_email) ? $current_user->user_email : '';
$customer_id = get_user_meta(get_current_user_id(), '_stripe_customer_id', true);
$stripe = new WC_Gateway_Stripe();
$cardInfo = $stripe->fgc_get_saved_cards($customer_id);
?>
<tr>
    <th><?php esc_html_e('Email', 'woocommerce-subscriptions') ?></th>
    <td class="tv_email"><?php echo $current_email; ?></td>
</tr>
<tr>
    <th><?php esc_html_e('Password', 'woocommerce-subscriptions') ?></th>
    <td>........</td>
</tr>
<?php if (!empty($cardInfo)) { ?>
    <tr>
        <th><?php esc_html_e('Card Number', 'woocommerce-subscriptions') ?></th>
        <td class="text-uppercase tv_cartinfo">****************<?php echo $cardInfo->last4; ?></td>
    </tr>
    <tr>
        <th><?php esc_html_e('Expiration date', 'woocommerce-subscriptions') ?></th>
        <td class="text-uppercase tv_cartinfo"><?php echo $cardInfo->exp_month . '/' . $cardInfo->exp_year; ?></td>
    </tr>
    <tr>
        <th><?php esc_html_e('CCV', 'woocommerce-subscriptions') ?></th>
        <td class="text-uppercase tv_cartinfo">.......</td>
    </tr>
<?php } ?>