function pmpro_membership_level_profile_fields($user) { global $current_user, $pmpro_currency_symbol; if (!current_user_can("administrator")) { return false; } global $wpdb; /*$user->membership_level = $wpdb->get_row("SELECT l.id AS ID, l.name AS name FROM {$wpdb->pmpro_membership_levels} AS l JOIN {$wpdb->pmpro_memberships_users} AS mu ON (l.id = mu.membership_id) WHERE mu.user_id = " . $user->ID . " LIMIT 1");*/ $user->membership_level = pmpro_getMembershipLevelForUser($user->ID); $levels = $wpdb->get_results("SELECT * FROM {$wpdb->pmpro_membership_levels}", OBJECT); if (!$levels) { return ""; } ?> <h3><?php _e("Membership Level", "pmpro"); ?> </h3> <table class="form-table"> <?php $show_membership_level = true; $show_membership_level = apply_filters("pmpro_profile_show_membership_level", $show_membership_level, $user); if ($show_membership_level) { ?> <tr> <th><label for="membership_level"><?php _e("Current Level", "pmpro"); ?> </label></th> <td> <select name="membership_level" onchange="pmpro_mchange_warning();"> <option value="" <?php if (empty($user->membership_level->ID)) { ?> selected="selected"<?php } ?> >-- <?php _e("None", "pmpro"); ?> --</option> <?php foreach ($levels as $level) { $current_level = $user->membership_level->ID == $level->id; ?> <option value="<?php echo $level->id; ?> " <?php if ($current_level) { ?> selected="selected"<?php } ?> ><?php echo $level->name; ?> </option> <?php } ?> </select> <script> var pmpro_mchange_once = 0; function pmpro_mchange_warning() { if(pmpro_mchange_once == 0) { alert('Warning: The existing membership will be cancelled, and the new membership will be free.'); pmpro_mchange_once = 1; } } </script> <?php $membership_values = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND user_id = '" . $user->ID . "' LIMIT 1"); if (!empty($membership_values->billing_amount) || !empty($membership_values->trial_amount)) { ?> <?php if ($membership_values->billing_amount > 0) { ?> at <?php echo $pmpro_currency_symbol; echo $membership_values->billing_amount; ?> <?php if ($membership_values->cycle_number > 1) { ?> per <?php echo $membership_values->cycle_number; ?> <?php echo sornot($membership_values->cycle_period, $membership_values->cycle_number); ?> <?php } elseif ($membership_values->cycle_number == 1) { ?> per <?php echo $membership_values->cycle_period; ?> <?php } ?> <?php } ?> <?php if ($membership_values->billing_limit) { ?> for <?php echo $membership_values->billing_limit . ' ' . sornot($membership_values->cycle_period, $membership_values->billing_limit); } ?> . <?php if ($membership_values->trial_limit) { ?> The first <?php echo $membership_values->trial_limit; ?> <?php echo sornot("payments", $membership_values->trial_limit); ?> will cost <?php echo $pmpro_currency_symbol; echo $membership_values->trial_amount; ?> . <?php } ?> <?php } else { _e("User is not paying.", "pmpro"); } ?> </td> </tr> <?php } $show_expiration = true; $show_expiration = apply_filters("pmpro_profile_show_expiration", $show_expiration, $user); if ($show_expiration) { //is there an end date? $user->membership_level = pmpro_getMembershipLevelForUser($user->ID); $end_date = !empty($user->membership_level->enddate); //some vars for the dates $current_day = date("j"); if ($end_date) { $selected_expires_day = date("j", $user->membership_level->enddate); } else { $selected_expires_day = $current_day; } $current_month = date("M"); if ($end_date) { $selected_expires_month = date("m", $user->membership_level->enddate); } else { $selected_expires_month = date("m"); } $current_year = date("Y"); if ($end_date) { $selected_expires_year = date("Y", $user->membership_level->enddate); } else { $selected_expires_year = (int) $current_year + 1; } ?> <tr> <th><label for="expiration"><?php _e("Expires", "pmpro"); ?> </label></th> <td> <select id="expires" name="expires"> <option value="0" <?php if (!$end_date) { ?> selected="selected"<?php } ?> ><?php _e("No", "pmpro"); ?> </option> <option value="1" <?php if ($end_date) { ?> selected="selected"<?php } ?> ><?php _e("Yes", "pmpro"); ?> </option> </select> <span id="expires_date" <?php if (!$end_date) { ?> style="display: none;"<?php } ?> > on <select name="expires_month"> <?php for ($i = 1; $i < 13; $i++) { ?> <option value="<?php echo $i; ?> " <?php if ($i == $selected_expires_month) { ?> selected="selected"<?php } ?> ><?php echo date("M", strtotime($i . "/1/" . $current_year)); ?> </option> <?php } ?> </select> <input name="expires_day" type="text" size="2" value="<?php echo $selected_expires_day; ?> " /> <input name="expires_year" type="text" size="4" value="<?php echo $selected_expires_year; ?> " /> </span> <script> jQuery('#expires').change(function() { if(jQuery(this).val() == 1) jQuery('#expires_date').show(); else jQuery('#expires_date').hide(); }); </script> </td> </tr> <?php } ?> </table> <?php }
} ?> </li> <?php } ?> <?php if ($level->billing_limit) { ?> <li><strong><?php _e("Duration", "pmpro"); ?> :</strong> <?php echo $level->billing_limit . ' ' . sornot($level->cycle_period, $level->billing_limit); ?> </li> <?php } ?> </ul> <?php } ?> <?php if (pmpro_isLevelRecurring($level)) { ?> <?php
<?php if (!pmpro_isLevelExpiring($level)) { ?> -- <?php } else { ?> <?php _e('After', 'pmpro'); ?> <?php echo $level->expiration_number; ?> <?php echo sornot($level->expiration_period, $level->expiration_number); ?> <?php } ?> </td> <td><?php if ($level->allow_signups) { _e('Yes', 'pmpro'); } else { _e('No', 'pmpro'); } ?> </td> <td align="center"><a href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id;
} ?> </li> <?php } ?> <?php if ($current_user->membership_level->billing_limit) { ?> <li><strong><?php _e("Duration", "pmpro"); ?> :</strong> <?php echo $current_user->membership_level->billing_limit . ' ' . sornot($current_user->membership_level->cycle_period, $current_user->membership_level->billing_limit); ?> </li> <?php } ?> <?php if ($current_user->membership_level->enddate) { ?> <li><strong><?php _e("Membership Expires", "pmpro"); ?> :</strong> <?php echo date_i18n(get_option('date_format'), $current_user->membership_level->enddate); ?>
function pmpro_getLevelExpiration(&$level) { if($level->expiration_number) { $expiration_text = "Membership expires after " . $level->expiration_number . " " . sornot(strtolower($level->expiration_period), $level->expiration_number) . "."; } else $expiration_text = ""; $expiration_text = apply_filters("pmpro_level_expiration_text", $expiration_text, $level); return $expiration_text; }
function billing_content_func($atts) { global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels; //-> If a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.) if ($current_user->membership_level->ID) { if ($pmpro_msg) { ?> <div class="pmpro_message <?php echo $pmpro_msgt; ?> "><?php echo $pmpro_msg; ?> </div> <?php } ?> <div class="row billing-content"> <div class="col-md-8 col-sm-8 col-sm-offset-3 col-md-offset-3"> <!-- BEGIN CONTENT--> <div id="pmpro_account"> <div id="pmpro_account-membership" class="pmpro_box-first"> <?php //wpex_logo(); ?> <!-- <div class="clear clearfix"></div> <br/> --> <?php $level = $current_user->membership_level->name; ?> <p><?php _e("Membership status: <strong>" . $level . "</strong>", "pmpro"); ?> </p> <?php //die(var_dump($current_user)); ?> <ul> <li><strong><?php _e("Level", "pmpro"); ?> :</strong> <?php echo $current_user->membership_level->name; ?> </li> <?php if ($current_user->membership_level->billing_amount > 0) { ?> <li><strong><?php _e("Membership Fee", "pmpro"); ?> :</strong> <?php $level = $current_user->membership_level; if ($current_user->membership_level->cycle_number > 1) { printf(__('%s every %d %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number)); } elseif ($current_user->membership_level->cycle_number == 1) { printf(__('%s per %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period)); } else { echo pmpro_formatPrice($current_user->membership_level->billing_amount); } ?> </li> <?php } ?> <?php if ($current_user->membership_level->billing_limit) { ?> <li><strong><?php _e("Duration", "pmpro"); ?> :</strong> <?php echo $current_user->membership_level->billing_limit . ' ' . sornot($current_user->membership_level->cycle_period, $current_user->membership_level->billing_limit); ?> </li> <?php } ?> <?php if ($current_user->membership_level->enddate) { ?> <li><strong><?php _e("Next billing date", "pmpro"); ?> :</strong> <?php echo date_i18n(get_option('date_format'), $current_user->membership_level->enddate); ?> </li> <?php } ?> <?php if ($current_user->membership_level->trial_limit == 1) { printf(__("Your first payment will cost %s.", "pmpro"), pmpro_formatPrice($current_user->membership_level->trial_amount)); } elseif (!empty($current_user->membership_level->trial_limit)) { printf(__("Your first %d payments will cost %s.", "pmpro"), $current_user->membership_level->trial_limit, pmpro_formatPrice($current_user->membership_level->trial_amount)); } ?> </ul> </div> <!-- end pmpro_account-membership --> <div id="pmpro_account-profile" class="pmpro_box hide"> <?php get_currentuserinfo(); ?> <h3><?php _e("My Account", "pmpro"); ?> </h3> <?php if ($current_user->user_firstname) { ?> <p><?php echo $current_user->user_firstname; ?> <?php echo $current_user->user_lastname; ?> </p> <?php } ?> <ul> <li><strong><?php _e("Username", "pmpro"); ?> :</strong> <?php echo $current_user->user_login; ?> </li> <li><strong><?php _e("Email", "pmpro"); ?> :</strong> <?php echo $current_user->user_email; ?> </li> </ul> <p> <a href="<?php echo admin_url('profile.php'); ?> "><?php _e("Edit Profile", "pmpro"); ?> </a> | <a href="<?php echo admin_url('profile.php'); ?> "><?php _ex("Change Password", "As in 'change password'.", "pmpro"); ?> </a> </p> </div> <!-- end pmpro_account-profile --> <?php //last invoice for current info //$ssorder = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM $wpdb->pmpro_membership_orders WHERE user_id = '$current_user->ID' AND membership_id = '" . $current_user->membership_level->ID . "' AND status = 'success' ORDER BY timestamp DESC LIMIT 1"); $ssorder = new MemberOrder(); $ssorder->getLastMemberOrder(); $invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' ORDER BY timestamp DESC LIMIT 6"); if (!empty($ssorder->id) && $ssorder->gateway != "check" && $ssorder->gateway != "paypalexpress" && $ssorder->gateway != "paypalstandard" && $ssorder->gateway != "twocheckout") { //default values from DB (should be last order or last update) $bfirstname = get_user_meta($current_user->ID, "pmpro_bfirstname", true); $blastname = get_user_meta($current_user->ID, "pmpro_blastname", true); $baddress1 = get_user_meta($current_user->ID, "pmpro_baddress1", true); $baddress2 = get_user_meta($current_user->ID, "pmpro_baddress2", true); $bcity = get_user_meta($current_user->ID, "pmpro_bcity", true); $bstate = get_user_meta($current_user->ID, "pmpro_bstate", true); $bzipcode = get_user_meta($current_user->ID, "pmpro_bzipcode", true); $bcountry = get_user_meta($current_user->ID, "pmpro_bcountry", true); $bphone = get_user_meta($current_user->ID, "pmpro_bphone", true); $bemail = get_user_meta($current_user->ID, "pmpro_bemail", true); $bconfirmemail = get_user_meta($current_user->ID, "pmpro_bconfirmemail", true); $CardType = get_user_meta($current_user->ID, "pmpro_CardType", true); $AccountNumber = hideCardNumber(get_user_meta($current_user->ID, "pmpro_AccountNumber", true), false); $ExpirationMonth = get_user_meta($current_user->ID, "pmpro_ExpirationMonth", true); $ExpirationYear = get_user_meta($current_user->ID, "pmpro_ExpirationYear", true); ?> <div id="pmpro_account-billing" class="pmpro_box"> <h3><?php _e("Billing Information", "pmpro"); ?> </h3> <?php if (!empty($baddress1)) { ?> <p> <strong><?php _e("Billing Address", "pmpro"); ?> </strong><br /> <?php echo $bfirstname . " " . $blastname; ?> <br /> <?php echo $current_user->user_email; ?> <br /> <?php echo $baddress1; ?> <br /> <?php if ($baddress2) { echo $baddress2 . "<br />"; } ?> <?php if ($bcity && $bstate) { ?> <?php echo $bcity; ?> , <?php echo $bstate; ?> <?php echo $bzipcode; ?> <?php echo $bcountry; ?> <?php } ?> <br /> <?php echo formatPhone($bphone); ?> </p> <?php } ?> <?php if (!empty($AccountNumber)) { ?> <p> <strong><?php _e("Payment Method", "pmpro"); ?> </strong><br /> <?php echo $CardType; ?> : <?php echo last4($AccountNumber); ?> (<?php echo $ExpirationMonth; ?> /<?php echo $ExpirationYear; ?> ) </p> <?php } ?> <?php if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) { ?> <p><a href="<?php echo pmpro_url("billing", ""); ?> "><?php _e("Edit Billing Information", "pmpro"); ?> </a></p> <?php } ?> </div> <!-- end pmpro_account-billing --> <?php } ?> <?php if (!empty($invoices)) { ?> <div id="pmpro_account-invoices" class="pmpro_box"> <h3><?php _e("Past Invoices", "pmpro"); ?> </h3> <ul> <?php $count = 0; foreach ($invoices as $invoice) { if ($count++ > 5) { break; } ?> <li><a href="<?php echo pmpro_url("invoice", "?invoice=" . $invoice->code); ?> "><?php echo date_i18n(get_option("date_format"), $invoice->timestamp); ?> (<?php echo pmpro_formatPrice($invoice->total); ?> )</a></li> <?php } ?> </ul> <?php //if ($count == 6) { ?> <p><a href="<?php echo pmpro_url("invoice"); ?> "><?php _e("View All Invoices", "pmpro"); ?> </a></p> <?php //} ?> </div> <!-- end pmpro_account-billing --> <?php } ?> <!-- <p class="help-block">We have the following subscriptions available for our site. To join, simply click on the <strong>Change Subscription</strong> button to Change Membership Level.</p> --> <?php //getLevels(); ?> </div> <!-- end pmpro_account --> <!-- END CONTENT--> </div> </div> <?php } else { $user_id = $current_user->ID; //make sure we only run once a day $today = date("Y-m-d", current_time("timestamp")); //look for memberships that expired $sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM {$wpdb->pmpro_memberships_users} mu WHERE mu.status = 'expired' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE(mu.enddate) <= '" . $today . "' AND mu.user_id = '" . $user_id . "' ORDER BY mu.enddate LIMIT 1"; $expired = $wpdb->get_results($sqlQuery); if (count($expired) > 0) { ?> <div class="row billing-content"> <div class="col-md-8 col-sm-8 col-sm-offset-3 col-md-offset-3"> <!-- BEGIN CONTENT--> <div id="pmpro_account"> <div id="pmpro_account-membership" class="pmpro_box-first"> <?php foreach ($expired as $e) { $level_id = $e->membership_id; $level = pmpro_getLevel($level_id); ?> <div class="pmpro_message">Your "<?php echo $level->name; ?> " Membership has expired, please renew now <a href="<?php echo pmpro_url("levels"); ?> "><?php _e("here", "pmpro"); ?> </a>.</div> <div id="pmpro_account-membership" class="pmpro_box-first"> <?php $level = $current_user->membership_level->name; ?> <p><?php _e("Membership status: <strong>" . $level->name . "(Expired)</strong>", "pmpro"); ?> </p> <ul> <?php if ($e->enddate) { //die(var_dump($e->enddate)); ?> <li><strong><?php _e("Expiration billing date", "pmpro"); ?> : </strong> <?php echo " " . date_i18n(get_option('date_format'), strtotime($e->enddate)); ?> </li> <?php } ?> </ul> </div> <!-- end pmpro_account-membership --> <?php } ?> </div> </div> </div> </div> <?php } } ?> <?php }
<?php if($level->billing_limit) { ?>(for <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?> <?php } ?> </td> <td> <?php if(!pmpro_isLevelTrial($level)) { ?> -- <?php } else { ?> <?php echo $pmpro_currency_symbol?><?php echo $level->trial_amount?> for <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?> <?php } ?> </td> <td> <?php if(!pmpro_isLevelExpiring($level)) { ?> -- <?php } else { ?> After <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?> <?php } ?> </td> <td><?php if($level->allow_signups) { ?>Yes<?php } else { ?>No<?php } ?></td> <td align="center"><a href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id?>" class="edit">edit</a></td> <td align="center"><a href="admin.php?page=pmpro-membershiplevels©=<?php echo $level->id?>&edit=-1" class="edit">copy</a></td> <td align="center"><a href="javascript: askfirst('Are you sure you want to delete membership level <?php echo $level->name?>? All subscriptions will be canceled.','admin.php?page=pmpro-membershiplevels&action=delete_membership_level&deleteid=<?php echo $level->id?>'); void(0);" class="delete">delete</a></td> </tr> <?php } ?> </tbody> </table> <?php } ?>
<?php } elseif($current_user->membership_level->cycle_number == 1) { ?> per <?php echo $current_user->membership_level->cycle_period?> <?php } ?> </li> <?php } ?> <?php if($current_user->membership_level->billing_limit) { ?> <li><strong>Duration:</strong> <?php echo $current_user->membership_level->billing_limit.' '.sornot($current_user->membership_level->cycle_period,$current_user->membership_level->billing_limit)?></li> <?php } ?> <?php if($current_user->membership_level->enddate) { ?> <li><strong>Membership Expires:</strong> <?php echo date(get_option('date_format'), $current_user->membership_level->enddate)?></li> <?php } ?> <?php if($current_user->membership_level->trial_limit) { ?> Your first <?php echo $current_user->membership_level->trial_limit?> <?php echo sornot("payment",$current_user->membership_level->trial_limit)?> will cost $<?php echo $current_user->membership_level->trial_amount?>. <?php } ?> <?php //the nextpayment code is not tight yet /* $nextpayment = pmpro_next_payment(); if($nextpayment) { ?> <li><strong>Next Invoice:</strong> <?php echo date("F j, Y", $nextpayment)?></li> <?php } */ ?> </ul>
{ ?> <p><?php if($level->trial_amount == '0.00') { ?><strong>Free</strong><?php } else { ?><?php echo $pmpro_currency_symbol . $level->trial_amount?><?php } ?> for the next <?php echo $level->trial_limit.' ' .sornot("payment",$level->trial_limit)?>.</p> <?php } if($level->billing_limit > 0 && $level->initial_payment > 0) { ?> <p><strong><?php echo ($level->billing_limit+1).' '.sornot("payment",($level->billing_limit+1))?></strong> total.</p> <?php } elseif($level->billing_limit) { ?> <p><strong><?php echo $level->billing_limit.' '.sornot("payment",$level->billing_limit)?></strong> total.</p> <?php } $expiration_text = pmpro_getLevelExpiration($level); if($expiration_text) { ?> <p><?php echo $expiration_text?></p> <?php } ?> </td> <td> <?php if(empty($current_user->membership_level->ID)) { ?> <a href="<?php echo pmpro_url("checkout", "?level=" . $level->id, "https")?>">Select</a>
<p>Logged in as <strong><?php echo $current_user->user_login?></strong>. <small><a href="<?php echo wp_logout_url(get_bloginfo("url") . "/membership-checkout/?level=" . $level->id);?>">logout</a></small></p> <ul> <li><strong>Level:</strong> <?php echo $level->name?></li> <?php if($level->billing_amount > 0) { ?> <li><strong>Membership Fee:</strong> <?php echo $pmpro_currency_symbol?><?php echo $level->billing_amount?> <?php if($level->cycle_number > 1) { ?> per <?php echo $level->cycle_number?> <?php echo sornot($level->cycle_period,$level->cycle_number)?> <?php } elseif($level->cycle_number == 1) { ?> per <?php echo $level->cycle_period?> <?php } ?> </li> <?php } ?> <?php if($level->billing_limit) { ?> <li><strong>Duration:</strong> <?php echo $level->billing_limit.' '.sornot($level->cycle_period,$level->billing_limit)?></li> <?php } ?> <?php //the nextpayment code is not tight yet /* $nextpayment = pmpro_next_payment(); if($nextpayment) { ?> <li><strong>Next Invoice:</strong> <?php echo date(get_option('date_format'), $nextpayment)?></li> <?php } */ ?> </ul>
function billing_content_func($atts) { global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels; //-> If a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.) if ($current_user->membership_level->ID) { if ($pmpro_msg) { ?> <div class="pmpro_message <?php echo $pmpro_msgt; ?> "><?php echo $pmpro_msg; ?> </div> <?php } ?> <div class="row"> <div class="col-md-8 col-sm-8 col-sm-offset-2 col-md-offset-2"> <!-- BEGIN CONTENT--> <div id="pmpro_account"> <div id="pmpro_account-membership" class="pmpro_box"> <p><?php _e("Your membership is <strong>active</strong>.", "pmpro"); ?> </p> <ul> <li><strong><?php _e("Level", "pmpro"); ?> :</strong> <?php echo $current_user->membership_level->name; ?> </li> <?php if ($current_user->membership_level->billing_amount > 0) { ?> <li><strong><?php _e("Membership Fee", "pmpro"); ?> :</strong> <?php $level = $current_user->membership_level; if ($current_user->membership_level->cycle_number > 1) { printf(__('%s every %d %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number)); } elseif ($current_user->membership_level->cycle_number == 1) { printf(__('%s per %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period)); } else { echo pmpro_formatPrice($current_user->membership_level->billing_amount); } ?> </li> <?php } ?> <?php if ($current_user->membership_level->billing_limit) { ?> <li><strong><?php _e("Duration", "pmpro"); ?> :</strong> <?php echo $current_user->membership_level->billing_limit . ' ' . sornot($current_user->membership_level->cycle_period, $current_user->membership_level->billing_limit); ?> </li> <?php } ?> <?php if ($current_user->membership_level->enddate) { ?> <li><strong><?php _e("Membership Expires", "pmpro"); ?> :</strong> <?php echo date_i18n(get_option('date_format'), $current_user->membership_level->enddate); ?> </li> <?php } ?> <?php if ($current_user->membership_level->trial_limit == 1) { printf(__("Your first payment will cost %s.", "pmpro"), pmpro_formatPrice($current_user->membership_level->trial_amount)); } elseif (!empty($current_user->membership_level->trial_limit)) { printf(__("Your first %d payments will cost %s.", "pmpro"), $current_user->membership_level->trial_limit, pmpro_formatPrice($current_user->membership_level->trial_amount)); } ?> </ul> </div> <!-- end pmpro_account-membership --> <div id="pmpro_account-profile" class="pmpro_box hide"> <?php get_currentuserinfo(); ?> <h3><?php _e("My Account", "pmpro"); ?> </h3> <?php if ($current_user->user_firstname) { ?> <p><?php echo $current_user->user_firstname; ?> <?php echo $current_user->user_lastname; ?> </p> <?php } ?> <ul> <li><strong><?php _e("Username", "pmpro"); ?> :</strong> <?php echo $current_user->user_login; ?> </li> <li><strong><?php _e("Email", "pmpro"); ?> :</strong> <?php echo $current_user->user_email; ?> </li> </ul> <p> <a href="<?php echo admin_url('profile.php'); ?> "><?php _e("Edit Profile", "pmpro"); ?> </a> | <a href="<?php echo admin_url('profile.php'); ?> "><?php _ex("Change Password", "As in 'change password'.", "pmpro"); ?> </a> </p> </div> <!-- end pmpro_account-profile --> <?php //last invoice for current info //$ssorder = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM $wpdb->pmpro_membership_orders WHERE user_id = '$current_user->ID' AND membership_id = '" . $current_user->membership_level->ID . "' AND status = 'success' ORDER BY timestamp DESC LIMIT 1"); $ssorder = new MemberOrder(); $ssorder->getLastMemberOrder(); $invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' ORDER BY timestamp DESC LIMIT 6"); if (!empty($ssorder->id) && $ssorder->gateway != "check" && $ssorder->gateway != "paypalexpress" && $ssorder->gateway != "paypalstandard" && $ssorder->gateway != "twocheckout") { //default values from DB (should be last order or last update) $bfirstname = get_user_meta($current_user->ID, "pmpro_bfirstname", true); $blastname = get_user_meta($current_user->ID, "pmpro_blastname", true); $baddress1 = get_user_meta($current_user->ID, "pmpro_baddress1", true); $baddress2 = get_user_meta($current_user->ID, "pmpro_baddress2", true); $bcity = get_user_meta($current_user->ID, "pmpro_bcity", true); $bstate = get_user_meta($current_user->ID, "pmpro_bstate", true); $bzipcode = get_user_meta($current_user->ID, "pmpro_bzipcode", true); $bcountry = get_user_meta($current_user->ID, "pmpro_bcountry", true); $bphone = get_user_meta($current_user->ID, "pmpro_bphone", true); $bemail = get_user_meta($current_user->ID, "pmpro_bemail", true); $bconfirmemail = get_user_meta($current_user->ID, "pmpro_bconfirmemail", true); $CardType = get_user_meta($current_user->ID, "pmpro_CardType", true); $AccountNumber = hideCardNumber(get_user_meta($current_user->ID, "pmpro_AccountNumber", true), false); $ExpirationMonth = get_user_meta($current_user->ID, "pmpro_ExpirationMonth", true); $ExpirationYear = get_user_meta($current_user->ID, "pmpro_ExpirationYear", true); ?> <div id="pmpro_account-billing" class="pmpro_box"> <h3><?php _e("Billing Information", "pmpro"); ?> </h3> <?php if (!empty($baddress1)) { ?> <p> <strong><?php _e("Billing Address", "pmpro"); ?> </strong><br /> <?php echo $bfirstname . " " . $blastname; ?> <br /> <?php echo $baddress1; ?> <br /> <?php if ($baddress2) { echo $baddress2 . "<br />"; } ?> <?php if ($bcity && $bstate) { ?> <?php echo $bcity; ?> , <?php echo $bstate; ?> <?php echo $bzipcode; ?> <?php echo $bcountry; ?> <?php } ?> <br /> <?php echo formatPhone($bphone); ?> </p> <?php } ?> <?php if (!empty($AccountNumber)) { ?> <p> <strong><?php _e("Payment Method", "pmpro"); ?> </strong><br /> <?php echo $CardType; ?> : <?php echo last4($AccountNumber); ?> (<?php echo $ExpirationMonth; ?> /<?php echo $ExpirationYear; ?> ) </p> <?php } ?> <?php if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) { ?> <p><a href="<?php echo pmpro_url("billing", ""); ?> "><?php _e("Edit Billing Information", "pmpro"); ?> </a></p> <?php } ?> </div> <!-- end pmpro_account-billing --> <?php } ?> <?php if (!empty($invoices)) { ?> <div id="pmpro_account-invoices" class="pmpro_box"> <h3><?php _e("Past Invoices", "pmpro"); ?> </h3> <ul> <?php $count = 0; foreach ($invoices as $invoice) { if ($count++ > 5) { break; } ?> <li><a href="<?php echo pmpro_url("invoice", "?invoice=" . $invoice->code); ?> "><?php echo date_i18n(get_option("date_format"), $invoice->timestamp); ?> (<?php echo pmpro_formatPrice($invoice->total); ?> )</a></li> <?php } ?> </ul> <?php if ($count == 6) { ?> <p><a href="<?php echo pmpro_url("invoice"); ?> "><?php _e("View All Invoices", "pmpro"); ?> </a></p> <?php } ?> </div> <!-- end pmpro_account-billing --> <?php } ?> <p class="help-block">We have the following subscriptions available for our site. To join, simply click on the <strong>Renew</strong> or <strong>Change Subscription</strong> button and then complete the registration details.</p> <?php getLevels(); ?> <div id="pmpro_account-links" class="pmpro_box"> <h3><?php _e("Manage Membership", "pmpro"); ?> </h3> <ul> <?php do_action("pmpro_member_links_top"); ?> <?php if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) { ?> <li><a href="<?php echo pmpro_url("billing", "", "https"); ?> "><?php _e("Update Billing Information", "pmpro"); ?> </a></li> <?php } ?> <?php if (count($pmpro_levels) > 1 && !defined("PMPRO_DEFAULT_LEVEL")) { ?> <li><a href="<?php echo pmpro_url("levels"); ?> "> <?php _e("Change Membership Level", "pmpro"); ?> </a></li> <?php } ?> <li><a href="<?php echo pmpro_url("cancel"); ?> " class="red"><?php _e("Cancel Membership", "pmpro"); ?> </a></li> <?php do_action("pmpro_member_links_bottom"); ?> </ul> </div> <!-- end pmpro_account-links --> </div> <!-- end pmpro_account --> <!-- END CONTENT--> </div> </div> <?php } ?> <?php }