data_accountinfo.php
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?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 } ?>