本文整理汇总了PHP中MemberOrder::getLastMemberOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP MemberOrder::getLastMemberOrder方法的具体用法?PHP MemberOrder::getLastMemberOrder怎么用?PHP MemberOrder::getLastMemberOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberOrder
的用法示例。
在下文中一共展示了MemberOrder::getLastMemberOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_upgrade_1_8_9_3_ajax
function pmpro_upgrade_1_8_9_3_ajax()
{
global $wpdb;
$debug = false;
$run = true;
//some vars
$all_levels = pmpro_getAllLevels(true, true);
//keeping track of which user we're working on
$last_user_id = get_option('pmpro_upgrade_1_8_9_3_last_user_id', 0);
//get all active users during the period where things may have been broken
$user_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' AND user_id > {$last_user_id} ORDER BY user_id LIMIT 10");
//track progress
$first_load = get_transient('pmpro_updates_first_load');
if ($first_load) {
$total_users = $wpdb->get_var("SELECT COUNT(user_id) FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' ORDER BY user_id");
update_option('pmpro_upgrade_1_8_9_3_total', $total_users, 'no');
$progress = 0;
} else {
$total_users = get_option('pmpro_upgrade_1_8_9_3_total', 0);
$progress = get_option('pmpro_upgrade_1_8_9_3_progress', 0);
}
update_option('pmpro_upgrade_1_8_9_3_progress', $progress + count($user_ids), 'no');
global $pmpro_updates_progress;
if ($total_users > 0) {
$pmpro_updates_progress = "[" . $progress . "/" . $total_users . "]";
} else {
$pmpro_updates_progress = "";
}
if (empty($user_ids)) {
//done with this update
pmpro_removeUpdate('pmpro_upgrade_1_8_9_3_ajax');
delete_option('pmpro_upgrade_1_8_9_3_last_user_id');
delete_option('pmpro_upgrade_1_8_9_3_total');
delete_option('pmpro_upgrade_1_8_9_3_progress');
} else {
foreach ($user_ids as $user_id) {
$last_user_id = $user_id;
//keeping track of the last user we processed
$user = get_userdata($user_id);
//user not found for some reason
if (empty($user)) {
if ($debug) {
echo "User #" . $user_id . " not found.\n";
}
continue;
}
//get level
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
//has a start and end date already
if (!empty($user->membership_level->enddate) && !empty($user->membership_level->startdate)) {
if ($debug) {
echo "User #" . $user_id . ", " . $user->user_email . " already has a start and end date.\n";
}
continue;
}
//get order
$last_order = new MemberOrder();
$last_order->getLastMemberOrder();
/*
Figure out if this user should have been given an end date.
The level my have an end date.
They might have used a discount code.
They might be using the set-expiration-dates code.
They might have custom code setting the end date.
Let's setup some vars as if we are at checkout.
Then pass recreate the level with the pmpro_checkout_level filter.
And use the end date there if there is one.
*/
global $pmpro_level, $discount_code, $discount_code_id;
//level
$level_id = $user->membership_level->id;
$_REQUEST['level'] = $level_id;
//gateway
if (!empty($last_order) && !empty($last_order->gateway)) {
$_REQUEST['gateway'] = $last_order->gateway;
} else {
$_REQUEST['gateway'] = pmpro_getGateway();
}
//discount code
$discount_code_id = $user->membership_level->code_id;
$discount_code = $wpdb->get_var("SELECT code FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . $discount_code_id . "' LIMIT 1");
//get level
if (!empty($discount_code_id)) {
$sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level_id . "' LIMIT 1";
$pmpro_level = $wpdb->get_row($sqlQuery);
//if the discount code doesn't adjust the level, let's just get the straight level
if (empty($pmpro_level)) {
$pmpro_level = $all_levels[$level_id];
}
//filter adjustments to the level
$pmpro_level->code_id = $discount_code_id;
$pmpro_level = apply_filters("pmpro_discount_code_level", $pmpro_level, $discount_code_id);
}
//no level yet, use default
if (empty($pmpro_level)) {
$pmpro_level = $all_levels[$level_id];
}
//no level for some reason
if (empty($pmpro_level) && empty($pmpro_level->id)) {
//.........这里部分代码省略.........
示例2: pmprodev_checkout_debug_email
function pmprodev_checkout_debug_email($level)
{
global $pmprodev_options, $current_user, $wpdb;
if (empty($pmprodev_options['checkout_debug_email'])) {
return $level;
}
$email = new PMProEmail();
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$http = 'https://';
} else {
$http = 'http://';
}
$email->subject = sprintf('%s Checkout Page Debug Log', get_bloginfo('name'));
$email->recipient = $pmprodev_options['checkout_debug_email'];
$email->template = 'checkout_debug';
$email->body = file_get_contents(plugin_dir_path(__FILE__) . '/email/checkout_debug.html');
$email->data = array('sitename' => get_bloginfo('sitename'), 'checkout_url' => $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'submit' => print_r($_REQUEST['submit-checkout'], true), 'level' => print_r($level, true), 'user' => print_r($current_user->data, true), 'request' => print_r($_REQUEST, true));
$order = new MemberOrder();
$order->getLastMemberOrder($current_user->user_id);
if (!empty($order)) {
$email->data['order'] = print_r($order, true);
}
$email->sendEmail();
return $level;
}
示例3: pmpro_cron_credit_card_expiring_warnings
function pmpro_cron_credit_card_expiring_warnings()
{
global $wpdb;
$next_month_date = date("Y-m-01", strtotime("+2 months"));
$sqlQuery = "SELECT mu.user_id\n\t\t\t\t\t\tFROM {$wpdb->pmpro_memberships_users} mu\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um1 ON mu.user_id = um1.user_id\n\t\t\t\t\t\t\t\tAND meta_key = 'pmpro_ExpirationMonth'\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um2 ON mu.user_id = um2.user_id\n\t\t\t\t\t\t\t\tAND um2.meta_key = 'pmpro_ExpirationYear'\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um3 ON mu.user_id = um3.user_id\n\t\t\t\t\t\t\t\tAND um3.meta_key = 'pmpro_credit_card_expiring_warning'\n\t\t\t\t\t\tWHERE mu.status = 'active'\n\t\t\t\t\t\t\tAND mu.cycle_number >0\n\t\t\t\t\t\t\tAND CONCAT(um2.meta_value, '-', um1.meta_value, '-01') < '" . $next_month_date . "'\n\t\t\t\t\t\t\tAND (um3.meta_value IS NULL OR CONCAT(um2.meta_value, '-', um1.meta_value, '-01') <> um3.meta_value)\n\t\t\t\t\t";
$cc_expiring_user_ids = $wpdb->get_col($sqlQuery);
if (!empty($cc_expiring_user_ids)) {
require_once ABSPATH . 'wp-includes/pluggable.php';
foreach ($cc_expiring_user_ids as $user_id) {
//get user
$euser = get_userdata($user_id);
//make sure their level doesn't have a billing limit that's been reached
$euser->membership_level = pmpro_getMembershipLevelForUser($euser->ID);
if (!empty($euser->membership_level->billing_limit)) {
/*
There is a billing limit on this level, skip for now.
We should figure out how to tell if the limit has been reached
and if not, email the user about the expiring credit card.
*/
continue;
}
//make sure they are using a credit card type billing method for their current membership level (check the last order)
$last_order = new MemberOrder();
$last_order->getLastMemberOrder($euser->ID);
if (empty($last_order->accountnumber)) {
continue;
}
//okay send them an email
$send_email = apply_filters("pmpro_send_credit_card_expiring_email", true, $e->user_id);
if ($send_email) {
//send an email
$pmproemail = new PMProEmail();
$pmproemail->sendCreditCardExpiringEmail($euser);
printf(__("Credit card expiring email sent to %s. ", "pmpro"), $euser->user_email);
}
//update user meta so we don't email them again
update_user_meta($euser->ID, "pmpro_credit_card_expiring_warning", $euser->pmpro_ExpirationYear . "-" . $euser->pmpro_ExpirationMonth . "-01");
}
}
}
示例4: MemberOrder
<?php
global $wpdb, $current_user, $pmpro_msg, $pmpro_msgt;
global $bfirstname, $blastname, $baddress1, $baddress2, $bcity, $bstate, $bzipcode, $bcountry, $bphone, $bemail, $bconfirmemail, $CardType, $AccountNumber, $ExpirationMonth, $ExpirationYear;
$gateway = pmpro_getOption("gateway");
//need to be secure?
global $besecure, $show_paypal_link;
$user_order = new MemberOrder();
$user_order->getLastMemberOrder();
if (empty($user_order->gateway)) {
//no order
$besecure = false;
} elseif ($user_order->gateway == "paypalexpress") {
$besecure = pmpro_getOption("use_ssl");
//still they might have website payments pro setup
if ($gateway == "paypal") {
//$besecure = true;
} else {
//$besecure = false;
$show_paypal_link = true;
}
} else {
//$besecure = true;
$besecure = pmpro_getOption("use_ssl");
}
//code for stripe
if ($gateway == "stripe") {
//stripe js library
wp_enqueue_script("stripe", "https://js.stripe.com/v1/", array(), "");
//stripe js code for checkout
function pmpro_stripe_javascript()
示例5: MemberOrder
/**
* Filter pmpro_next_payment to get date via API if possible
*
* @since 1.8.5
*/
static function pmpro_next_payment($timestamp, $user_id, $order_status)
{
//find the last order for this user
if (!empty($user_id)) {
//get last order
$order = new MemberOrder();
$order->getLastMemberOrder($user_id, $order_status);
//check if this is a paypal express order with a subscription transaction id
if (!empty($order->id) && !empty($order->subscription_transaction_id) && $order->gateway == "paypalexpress") {
//get the subscription status
$status = $order->getGatewaySubscriptionStatus();
d($status);
if (!empty($status) && !empty($status['NEXTBILLINGDATE'])) {
//found the next billing date at PayPal, going to use that
$timestamp = strtotime(urldecode($status['NEXTBILLINGDATE']), current_time('timestamp'));
} elseif (!empty($status) && !empty($status['PROFILESTARTDATE']) && $order_status == "cancelled") {
//startdate is in the future and we cancelled so going to use that as the next payment date
$startdate_timestamp = strtotime(urldecode($status['PROFILESTARTDATE']), current_time('timestamp'));
if ($startdate_timestamp > current_time('timestamp')) {
$timestamp = $startdate_timestamp;
}
}
}
}
return $timestamp;
}
示例6: pmproppsc_admin_page
function pmproppsc_admin_page()
{
?>
<div class="wrap">
<h2>PMPro Subscription Check</h2>
<?php
if (!empty($_REQUEST['pmpro_subscription_check']) && current_user_can("manage_options")) {
global $wpdb;
//get members
if (!empty($_REQUEST['limit'])) {
$limit = intval($_REQUEST['limit']);
} else {
$limit = 20;
}
if (!empty($_REQUEST['start'])) {
$start = intval($_REQUEST['start']);
} else {
$start = 0;
}
//when using auto refresh get the last user id
if (!empty($_REQUEST['autorefresh']) && empty($_REQUEST['restart'])) {
$last_user_id = get_option("pmpro_subscription_check_last_user_id", 0);
} else {
$last_user_id = 0;
}
//get gateway
$gateway = $_REQUEST['gateway'];
if (!in_array($gateway, array_keys(pmpro_gateways()))) {
wp_die('Invalid gateway selection.');
}
//when using auto refresh get the last user id
if (!empty($_REQUEST['autorefresh']) && empty($_REQUEST['restart'])) {
$last_user_id = get_option("pmpro_stripe_subscription_check_last_user_id", 0);
} else {
$last_user_id = 0;
}
$sqlQuery = "SELECT DISTINCT(user_id) FROM {$wpdb->pmpro_membership_orders} WHERE gateway = '" . esc_sql($gateway) . "' ";
if (!empty($last_user_id)) {
$sqlQuery .= "AND user_id > '" . $last_user_id . "' ";
}
$sqlQuery .= "ORDER BY user_id LIMIT {$start}, {$limit}";
$user_ids = $wpdb->get_col($sqlQuery);
$totalrows = $wpdb->get_var("SELECT COUNT(DISTINCT(user_id)) FROM {$wpdb->pmpro_membership_orders} WHERE gateway = '" . esc_sql($gateway) . "'");
if (empty($_REQUEST['autorefresh'])) {
echo "Checking users for orders " . $start . " to " . min(intval($start + $limit), $totalrows) . ". ";
if ($totalrows > intval($start + $limit)) {
$url = "?page=pmproppsc&pmpro_subscription_check=1&start=" . ($start + $limit) . "&limit=" . $limit . "&gateway=" . $gateway;
echo '<a href="' . $url . '">Next ' . $limit . ' Results</a>';
} else {
echo "All done.";
}
echo "<hr />";
}
$allmembers = "";
$requiresaction = "";
foreach ($user_ids as $user_id) {
$user = get_userdata($user_id);
if (empty($user)) {
$s = "User #" . $user_id . " has been deleted. ";
} else {
$s = "User #" . $user->ID . "(" . $user->user_email . ", " . $user->first_name . " " . $user->lat_name . ") ";
}
$level = pmpro_getMembershipLevelForUser($user_id);
if (!empty($level) && empty($user)) {
$s .= " Had level #" . $level->id . ". ";
$level_id = $level->id;
} elseif (!empty($level)) {
$s .= " Has level #" . $level->id . ". ";
$level_id = $level->id;
} else {
$s .= " Does not have a level. ";
$level_id = "";
}
$order = new MemberOrder();
$order->getLastMemberOrder($user_id, "");
if (!empty($order->id)) {
$s .= " Last order was #" . $order->id . ", status " . $order->status . ". ";
//check status of order at gateway
$details = $order->getGatewaySubscriptionStatus($order);
if (empty($details)) {
$s .= " Couldn't get status from gateway. ";
echo "<span style='color: gray;'>" . $s . "</span>";
$allmembers .= "<span style='color: gray;'>" . $s . "</span>";
} else {
if (!is_array($details)) {
$details = array('STATUS' => $details);
}
$s .= "Gateway Status is " . $details['STATUS'] . ". ";
//if gateway status is active, but local user has no level, cancel the gateway subscription
if (strtolower($details['STATUS']) == 'active' && $level_id != $order->membership_id) {
$s .= " But this user has level #" . $user_level_id . " and order is for #" . $order->membership_id . ". Will try to cancel at the gateway. ";
if (!empty($_REQUEST['mode'])) {
if ($order->cancel()) {
$s .= " Order cancelled.";
echo "<span style='color: green;'><strong>" . $s . "</strong></span>";
} else {
$s .= " Error cancelling order.";
echo "<span style='color: red;'><strong>" . $s . "</strong></span>";
}
} else {
//.........这里部分代码省略.........
开发者ID:strangerstudios,项目名称:pmpro-paypal-subscription-check,代码行数:101,代码来源:pmpro-subscription-check.php
示例7: PMProEmail
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail($user, $morder);
$logstr .= "Created new order with ID #" . $morder->id . ". Event ID #" . $event->id . ".";
/*
Checking if there is an update "after next payment" for this user.
*/
$user_updates = $user->pmpro_stripe_updates;
if (!empty($user_updates)) {
foreach ($user_updates as $key => $update) {
if ($update['when'] == 'payment') {
//get current plan at Stripe to get payment date
$last_order = new MemberOrder();
$last_order->getLastMemberOrder($user_id);
$last_order->setGateway('stripe');
$last_order->Gateway->getCustomer();
if (!empty($last_order->Gateway->customer)) {
//find the first subscription
if (!empty($last_order->Gateway->customer->subscriptions['data'][0])) {
$first_sub = $last_order->Gateway->customer->subscriptions['data'][0]->__toArray();
$end_timestamp = $first_sub['current_period_end'];
}
}
//if we didn't get an end date, let's set one one cycle out
$end_timestamp = strtotime("+" . $update['cycle_number'] . " " . $update['cycle_period']);
//build order object
$update_order = new MemberOrder();
$update_order->setGateway('stripe');
$update_order->user_id = $user->ID;
示例8: pmpro_shortcode_account
function pmpro_shortcode_account($atts, $content = null, $code = "")
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_account] [pmpro_account sections="membership,profile"/]
extract(shortcode_atts(array('section' => '', 'sections' => 'membership,profile,invoices,links'), $atts));
//did they use 'section' instead of 'sections'?
if (!empty($section)) {
$sections = $section;
}
//turn into an array
$sections = explode(',', $sections);
ob_start();
//if a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
if (pmpro_hasMembershipLevel()) {
$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");
?>
<div id="pmpro_account">
<?php
if (in_array('membership', $sections) || in_array('memberships', $sections)) {
?>
<div id="pmpro_account-membership" class="pmpro_box">
<h3><?php
_e("My Memberships", "pmpro");
?>
</h3>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th><?php
_e("Level", "pmpro");
?>
</th>
<th><?php
_e("Billing", "pmpro");
?>
</th>
<th><?php
_e("Expiration", "pmpro");
?>
</th>
</tr>
</thead>
<tbody>
<?php
//TODO: v2.0 will loop through levels here
$level = $current_user->membership_level;
?>
<tr>
<td class="pmpro_account-membership-levelname">
<?php
echo $current_user->membership_level->name;
?>
<div class="pmpro_actionlinks">
<?php
do_action("pmpro_member_action_links_before");
?>
<?php
if (pmpro_isLevelExpiringSoon($current_user->membership_level)) {
?>
<a href="<?php
echo pmpro_url("checkout", "?level=" . $current_user->membership_level->id, "https");
?>
"><?php
_e("Renew", "pmpro");
?>
</a>
<?php
}
?>
<?php
if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) {
?>
<a href="<?php
echo pmpro_url("billing", "", "https");
?>
"><?php
_e("Update Billing Info", "pmpro");
?>
</a>
<?php
}
?>
<?php
//To do: Only show CHANGE link if this level is in a group that has upgrade/downgrade rules
if (count($pmpro_levels) > 1 && !defined("PMPRO_DEFAULT_LEVEL")) {
?>
<a href="<?php
echo pmpro_url("levels");
?>
//.........这里部分代码省略.........
示例9: MemberOrder
</a> |
<a href="<?php
echo home_url(JAVO_DEF_LANG . JAVO_MEMBER_SLUG . '/' . wp_get_current_user()->user_login . '/' . JAVO_LOSTPW_SLUG);
?>
"><?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);
示例10: pap_pmpro_add_order
function pap_pmpro_add_order($morder)
{
if (!empty($morder->total)) {
//need to get the last order before this
$last_order = new MemberOrder();
$last_order->getLastMemberOrder($morder->user_id);
if (!empty($last_order->affiliate_id)) {
$parts = explode(",", $last_order->affiliate_subid);
$affiliate_code = $last_order->affiliate_id;
$campaign_id = $parts[0];
$channel_id = $parts[1];
$visitor_id = $parts[2];
//api
pap_pmpro_track_sale($morder->total, $morder->code, $affiliate_code, $campaign_id, $channel_id, $visitor_id);
//update the affiliate id for this order
global $pap_pmpro_affiliate_id, $pap_pmpro_affiliate_subid;
$pap_pmpro_affiliate_id = $affiliate_code;
$pap_pmpro_affiliate_subid = $campaign_id . "," . $channel_id . "," . $visitor_id;
}
}
}
示例11: billing_content_func
//.........这里部分代码省略.........
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");
示例12: pmpro_pages_shortcode_confirmation
/**
* 1.12 Custom confirmation page
*
*/
public static function pmpro_pages_shortcode_confirmation($content)
{
global $wpdb, $current_user, $pmpro_invoice, $pmpro_currency;
if (empty($pmpro_invoice)) {
$morder = new MemberOrder();
$morder->getLastMemberOrder(get_current_user_id(), apply_filters("pmpro_confirmation_order_status", array("pending", "success")));
if (!empty($morder) && $morder->gateway == "gourl") {
$pmpro_invoice = $morder;
}
}
if (!empty($pmpro_invoice) && $pmpro_invoice->gateway == "gourl" && isset($pmpro_invoice->total) && $pmpro_invoice->total > 0) {
$levelName = $wpdb->get_var("SELECT name FROM {$wpdb->pmpro_membership_levels} WHERE id = '" . $pmpro_invoice->membership_id . "' LIMIT 1");
$content = "<ul>\n\t\t\t\t\t\t\t<li><strong>" . __('Account', GOURLPMP) . ":</strong> " . $current_user->display_name . " (" . $current_user->user_email . ")</li>\n\t\t\t\t\t\t\t<li><strong>" . __('Order', GOURLPMP) . ":</strong> " . $pmpro_invoice->code . "</li>\n\t\t\t\t\t\t\t<li><strong>" . __('Membership Level', GOURLPMP) . ":</strong> " . $levelName . "</li>\n\t\t\t\t\t\t\t<li><strong>" . __('Amount', GOURLPMP) . ":</strong> " . $pmpro_invoice->total . " " . $pmpro_currency . "</li>\n\t\t\t\t\t\t </ul>";
$content .= self::pmpro_gourl_cryptocoin_payment($pmpro_invoice);
}
return $content;
}
开发者ID:MediaPreneur,项目名称:Bitcoin-Gateway-Paid-Memberships-Pro,代码行数:21,代码来源:gourl_paidmembershipspro.php
示例13: pmpropbc_pmpro_account_bullets_bottom
function pmpropbc_pmpro_account_bullets_bottom()
{
//get invoice from DB
if (!empty($_REQUEST['invoice'])) {
$invoice_code = $_REQUEST['invoice'];
if (!empty($invoice_code)) {
$pmpro_invoice = new MemberOrder($invoice_code);
}
}
//no specific invoice, check current user's last order
if (empty($pmpro_invoice) || empty($pmpro_invoice->id)) {
$pmpro_invoice = new MemberOrder();
$pmpro_invoice->getLastMemberOrder(NULL, array('success', 'pending', 'cancelled', ''));
}
if (!empty($pmpro_invoice) && !empty($pmpro_invoice->id)) {
if ($pmpro_invoice->status == "pending" && $pmpro_invoice->gateway == "check") {
if (!empty($_REQUEST['invoice'])) {
?>
<li>
<?php
if (pmpropbc_isMemberPending($pmpro_invoice->user_id)) {
_e('<strong>Membership pending.</strong> We are still waiting for payment of this invoice.', 'pmpropbc');
} else {
_e('<strong>Important Notice:</strong> We are still waiting for payment of this invoice.', 'pmpropbc');
}
?>
</li>
<?php
} else {
?>
<li><?php
if (pmpropbc_isMemberPending($pmpro_invoice->user_id)) {
printf(__('<strong>Membership pending.</strong> We are still waiting for payment for <a href="%s">your latest invoice</a>.', 'pmpropbc'), pmpro_url('invoice', '?invoice=' . $pmpro_invoice->code));
} else {
printf(__('<strong>Important Notice:</strong> We are still waiting for payment for <a href="%s">your latest invoice</a>.', 'pmpropbc'), pmpro_url('invoice', '?invoice=' . $pmpro_invoice->code));
}
?>
</li>
<?php
}
}
}
}
示例14: pmpro_affiliates_pmpro_confirmation_message
function pmpro_affiliates_pmpro_confirmation_message($message)
{
if (!empty($_COOKIE['pmpro_affiliate'])) {
$parts = split(",", $_COOKIE['pmpro_affiliate']);
$affiliate_code = $parts[0];
if (!empty($affiliate_code)) {
global $current_user, $wpdb;
$affiliate_enabled = $wpdb->get_var("SELECT enabled FROM {$wpdb->pmpro_affiliates} WHERE code = '" . $wpdb->escape($affiliate_code) . "' LIMIT 1");
if ($affiliate_enabled) {
$tracking_code = $wpdb->get_var("SELECT trackingcode FROM {$wpdb->pmpro_affiliates} WHERE code = '" . $wpdb->escape($affiliate_code) . "' LIMIT 1");
if (!empty($tracking_code)) {
//filter
$order = new MemberOrder();
$order->getLastMemberOrder();
$tracking_code = str_replace("!!ORDER_ID!!", $order->code, $tracking_code);
$tracking_code = str_replace("!!LEVEL_NAME!!", $current_user->membership_level->name, $tracking_code);
//add to message
$message .= "\n" . stripslashes($tracking_code);
}
}
}
}
return $message;
}
示例15: pmpro_payflow_recurring_orders
function pmpro_payflow_recurring_orders()
{
//is PMPro even active?
if (!function_exists('pmpro_hasMembershipLevel')) {
return;
}
global $wpdb;
$now = current_time('timestamp');
//between what hours should the cron run?
$cron_start = 1;
//1 AM
$cron_end = 6;
//6 AM
$current_hour = date('G', $now);
if ($current_hour > $cron_end || $current_hour < $cron_start) {
return;
}
//where did we leave off?
if (isset($_REQUEST['start'])) {
$start = intval($_REQUEST['start']);
delete_option('pmpro_pfro_paused');
} else {
$start = get_option('payflow_recurring_orders_cron_count', 0);
}
//are we paused? value is timestamp. if set wait until then
$paused = get_option('pmpro_pfro_paused', false);
if (!empty($paused) && $paused > $now) {
return;
}
//how many subscriptions to run at one time. based on your server speed and timeout limits/etc.
$nper = 50;
//next one
$end = intval($start) + intval($nper);
//get subs
$sqlQuery = "\n\t\tSELECT SQL_CALC_FOUND_ROWS user_id FROM\n\t\t(\n\t\t\tSELECT mu.user_id,\n\t\t\t\tCASE mu.cycle_period\n\t\t\t\t\tWHEN 'Day' THEN date_add(mo.timestamp, INTERVAL mu.cycle_number DAY)\n\t\t\t\t\tWHEN 'Month' THEN date_add(mo.timestamp, INTERVAL mu.cycle_number MONTH)\n\t\t\t\t\tWHEN 'Week' THEN date_add(mo.timestamp, INTERVAL mu.cycle_number WEEK)\n\t\t\t\t\tWHEN 'Year' THEN date_add(mo.timestamp, INTERVAL mu.cycle_number YEAR)\n\t\t\t\tEND as next_payment_date\n\t\t\tFROM {$wpdb->pmpro_memberships_users} mu\n\t\t\t\tLEFT JOIN {$wpdb->pmpro_membership_orders} mo\n\t\t\t\t\tON mo.id = (\n\t\t\t\t\t\tSELECT id FROM {$wpdb->pmpro_membership_orders} WHERE gateway = 'payflowpro' AND status NOT IN('review', 'token', 'pending') AND user_id = mu.user_id ORDER BY id DESC LIMIT 1\n\t\t\t\t\t)\n\t\t\tWHERE mu.status = 'active'\n\t\t\t\tAND mo.subscription_transaction_id <> ''\n\t\t) members\n\t\tWHERE DATEDIFF('" . current_time('mysql') . "', next_payment_date) >= 0\n\t\tLIMIT {$start}, {$nper}\n\t";
$sub_user_ids = $wpdb->get_col($sqlQuery);
$count = $wpdb->get_var('SELECT FOUND_ROWS()');
echo "Processing " . intval($start) . " to " . (intval($start) + intval($nper)) . " of " . $count . " subscriptions.<hr />";
//if no more subs, pause until tomorrow
if (empty($sub_user_ids)) {
echo "All done. Pausing until tomorrow.<br />";
$tomorrow = strtotime(date("Y-m-d 00:00:00", $now + 3600 * 24));
update_option('pmpro_pfro_paused', $tomorrow);
update_option('payflow_recurring_orders_cron_count', 0);
return;
}
$failed_payment_emails = array();
//loop through subs
foreach ($sub_user_ids as $user_id) {
$user = get_userdata($user_id);
if (empty($user->ID)) {
echo "Coundn't find user #" . $user_id . "...<br /><hr />";
continue;
}
echo "Checking for recurring orders for user #" . $user->ID . " " . $user->user_login . " (" . $user->user_email . ")...<br />";
$last_order = new MemberOrder();
$last_order->getLastMemberOrder($user_id);
if (!empty($last_order->id)) {
echo "- Last order found. #" . $last_order->id . ", Code: " . $last_order->code . ", SubID: " . $last_order->subscription_transaction_id . ".<br />";
} else {
echo "- No last order. Skipping.";
echo "<hr />";
continue;
}
//is it even Payflow?
if ($last_order->gateway != "payflowpro") {
echo "- Order is for '" . $last_order->gateway . "' gateway.<br />";
echo "<hr />";
continue;
}
//check subscription
if (!empty($last_order->subscription_transaction_id)) {
echo "- Checking subscription #" . $last_order->subscription_transaction_id . ".<br />";
$status = pmpropfro_getSubscriptionPayments($last_order);
//find orders
$payments = pmpropfro_processPaymentHistory($status);
if (!empty($payments)) {
foreach ($payments as $payment) {
if ($payment['P_TRANSTATE'] == 1 || $payment['P_TRANSTATE'] == 11) {
echo "- Failed payment #" . $payment['P_PNREF'] . ".";
//check if we have this one already
$old_order = new MemberOrder();
$old_order->getMemberOrderByPaymentTransactionID($payment['P_PNREF']);
if (empty($old_order->id)) {
$failed_payment_emails[] = $user->user_email;
//not there yet, add it
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $payment['P_PNREF'];
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->InitialPayment = $payment['P_AMT'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $payment['P_AMT'];
$morder->status = "error";
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
echo " Saving order.";
//this will affect the main query, so need to roll back the "end" 1 space
//.........这里部分代码省略.........