Version Description
- BUG: Fixed bug introduced in 1.8.9.2 where member start and end dates weren't being set correctly. Includes an update script to fix past users affected by this.
- BUG: Fixed warnings on new order page in the dashboard.
- BUG/ENHANCEMENT: Fixed the pmpro_checkout_default_submit_button() methods of the PayPal Express to no longer check if the current gateway is a paypal one. The method is only called when the gateway is loaded anyway or when another addon (e.g. the pmpro-pay-by-check addon) adds the hook.
- BUG/ENHANCEMENT: Moved check instructions code into the check gateway class so it can be overriden by addons (e.g. an update to the pmpro-pay-by-check addon).
Download this release
Release Info
Developer | strangerstudios |
Plugin | Paid Memberships Pro |
Version | 1.8.9.3 |
Comparing to | |
See all releases |
Code changes from version 1.8.9.2 to 1.8.9.3
- adminpages/orders.php +31 -0
- classes/gateways/class.pmprogateway_check.php +16 -0
- classes/gateways/class.pmprogateway_paypalexpress.php +1 -3
- classes/gateways/class.pmprogateway_paypalstandard.php +0 -2
- includes/functions.php +4 -0
- includes/updates/upgrade_1_8_9_3.php +204 -0
- includes/upgradecheck.php +10 -1
- pages/checkout.php +1 -7
- paid-memberships-pro.php +2 -2
- preheaders/checkout.php +2 -2
- readme.txt +7 -1
adminpages/orders.php
CHANGED
@@ -184,6 +184,7 @@ if ( ! empty( $_REQUEST['save'] ) ) {
|
|
184 |
$order = new MemberOrder( $order_id );
|
185 |
} else {
|
186 |
$order = new MemberOrder();
|
|
|
187 |
}
|
188 |
|
189 |
//update values
|
@@ -307,6 +308,36 @@ if ( ! empty( $_REQUEST['save'] ) ) {
|
|
307 |
$order->code = $order->getRandomCode();
|
308 |
} else {
|
309 |
$order = new MemberOrder(); //new order
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
}
|
312 |
}
|
184 |
$order = new MemberOrder( $order_id );
|
185 |
} else {
|
186 |
$order = new MemberOrder();
|
187 |
+
$order->billing = new stdClass();
|
188 |
}
|
189 |
|
190 |
//update values
|
308 |
$order->code = $order->getRandomCode();
|
309 |
} else {
|
310 |
$order = new MemberOrder(); //new order
|
311 |
+
|
312 |
+
//defaults
|
313 |
+
$order->code = $order->getRandomCode();
|
314 |
+
$order->user_id = "";
|
315 |
+
$order->membership_id = "";
|
316 |
+
$order->billing = new stdClass();
|
317 |
+
$order->billing->name = "";
|
318 |
+
$order->billing->street = "";
|
319 |
+
$order->billing->city = "";
|
320 |
+
$order->billing->state = "";
|
321 |
+
$order->billing->zip = "";
|
322 |
+
$order->billing->country = "";
|
323 |
+
$order->billing->phone = "";
|
324 |
+
$order->subtotal = "";
|
325 |
+
$order->tax = "";
|
326 |
+
$order->couponamount = "";
|
327 |
+
$order->total = "";
|
328 |
+
$order->payment_type = "";
|
329 |
+
$order->cardtype = "";
|
330 |
+
$order->accountnumber = "";
|
331 |
+
$order->expirationmonth = "";
|
332 |
+
$order->expirationyear = "";
|
333 |
+
$order->status = "success";
|
334 |
+
$order->gateway = pmpro_getOption("gateway");
|
335 |
+
$order->gateway_environment = pmpro_getOption("gateway_environment");
|
336 |
+
$order->payment_transaction_id = "";
|
337 |
+
$order->subscription_transaction_id = "";
|
338 |
+
$order->affiliate_id = "";
|
339 |
+
$order->affiliate_subid = "";
|
340 |
+
$order->notes = "";
|
341 |
}
|
342 |
}
|
343 |
}
|
classes/gateways/class.pmprogateway_check.php
CHANGED
@@ -26,6 +26,7 @@
|
|
26 |
//add fields to payment settings
|
27 |
add_filter('pmpro_payment_options', array('PMProGateway_check', 'pmpro_payment_options'));
|
28 |
add_filter('pmpro_payment_option_fields', array('PMProGateway_check', 'pmpro_payment_option_fields'), 10, 2);
|
|
|
29 |
|
30 |
//code to add at checkout
|
31 |
$gateway = pmpro_getGateway();
|
@@ -136,6 +137,21 @@
|
|
136 |
|
137 |
return $fields;
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
/**
|
141 |
* Process checkout.
|
26 |
//add fields to payment settings
|
27 |
add_filter('pmpro_payment_options', array('PMProGateway_check', 'pmpro_payment_options'));
|
28 |
add_filter('pmpro_payment_option_fields', array('PMProGateway_check', 'pmpro_payment_option_fields'), 10, 2);
|
29 |
+
add_filter('pmpro_checkout_after_payment_information_fields', array('PMProGateway_check', 'pmpro_checkout_after_payment_information_fields'));
|
30 |
|
31 |
//code to add at checkout
|
32 |
$gateway = pmpro_getGateway();
|
137 |
|
138 |
return $fields;
|
139 |
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Show instructions on checkout page
|
143 |
+
* Moved here from pages/checkout.php
|
144 |
+
* @since 1.8.9.3
|
145 |
+
*/
|
146 |
+
static function pmpro_checkout_after_payment_information_fields() {
|
147 |
+
global $gateway;
|
148 |
+
|
149 |
+
if($gateway == "check" && !pmpro_isLevelFree($pmpro_level)) {
|
150 |
+
$instructions = pmpro_getOption("instructions");
|
151 |
+
echo '<div class="pmpro_check_instructions">' . wpautop($instructions) . '</div>';
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
|
156 |
/**
|
157 |
* Process checkout.
|
classes/gateways/class.pmprogateway_paypalexpress.php
CHANGED
@@ -406,13 +406,11 @@
|
|
406 |
|
407 |
//show our submit buttons
|
408 |
?>
|
409 |
-
<?php if($gateway == "paypal" || $gateway == "paypalexpress" || $gateway == "paypalstandard") { ?>
|
410 |
<span id="pmpro_paypalexpress_checkout" <?php if(($gateway != "paypalexpress" && $gateway != "paypalstandard") || !$pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
411 |
<input type="hidden" name="submit-checkout" value="1" />
|
412 |
<input type="image" value="<?php _e('Check Out with PayPal', 'pmpro');?> »" src="<?php echo apply_filters("pmpro_paypal_button_image", "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif");?>" />
|
413 |
</span>
|
414 |
-
|
415 |
-
|
416 |
<span id="pmpro_submit_span" <?php if(($gateway == "paypalexpress" || $gateway == "paypalstandard") && $pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
417 |
<input type="hidden" name="submit-checkout" value="1" />
|
418 |
<input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php if($pmpro_requirebilling) { _e('Submit and Check Out', 'pmpro'); } else { _e('Submit and Confirm', 'pmpro');}?> »" />
|
406 |
|
407 |
//show our submit buttons
|
408 |
?>
|
|
|
409 |
<span id="pmpro_paypalexpress_checkout" <?php if(($gateway != "paypalexpress" && $gateway != "paypalstandard") || !$pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
410 |
<input type="hidden" name="submit-checkout" value="1" />
|
411 |
<input type="image" value="<?php _e('Check Out with PayPal', 'pmpro');?> »" src="<?php echo apply_filters("pmpro_paypal_button_image", "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif");?>" />
|
412 |
</span>
|
413 |
+
|
|
|
414 |
<span id="pmpro_submit_span" <?php if(($gateway == "paypalexpress" || $gateway == "paypalstandard") && $pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
415 |
<input type="hidden" name="submit-checkout" value="1" />
|
416 |
<input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php if($pmpro_requirebilling) { _e('Submit and Check Out', 'pmpro'); } else { _e('Submit and Confirm', 'pmpro');}?> »" />
|
classes/gateways/class.pmprogateway_paypalstandard.php
CHANGED
@@ -196,12 +196,10 @@
|
|
196 |
|
197 |
//show our submit buttons
|
198 |
?>
|
199 |
-
<?php if($gateway == "paypal" || $gateway == "paypalexpress" || $gateway == "paypalstandard") { ?>
|
200 |
<span id="pmpro_paypalexpress_checkout" <?php if(($gateway != "paypalexpress" && $gateway != "paypalstandard") || !$pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
201 |
<input type="hidden" name="submit-checkout" value="1" />
|
202 |
<input type="image" value="<?php _e('Check Out with PayPal', 'pmpro');?> »" src="<?php echo apply_filters("pmpro_paypal_button_image", "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif");?>" />
|
203 |
</span>
|
204 |
-
<?php } ?>
|
205 |
|
206 |
<span id="pmpro_submit_span" <?php if(($gateway == "paypalexpress" || $gateway == "paypalstandard") && $pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
207 |
<input type="hidden" name="submit-checkout" value="1" />
|
196 |
|
197 |
//show our submit buttons
|
198 |
?>
|
|
|
199 |
<span id="pmpro_paypalexpress_checkout" <?php if(($gateway != "paypalexpress" && $gateway != "paypalstandard") || !$pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
200 |
<input type="hidden" name="submit-checkout" value="1" />
|
201 |
<input type="image" value="<?php _e('Check Out with PayPal', 'pmpro');?> »" src="<?php echo apply_filters("pmpro_paypal_button_image", "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif");?>" />
|
202 |
</span>
|
|
|
203 |
|
204 |
<span id="pmpro_submit_span" <?php if(($gateway == "paypalexpress" || $gateway == "paypalstandard") && $pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
|
205 |
<input type="hidden" name="submit-checkout" value="1" />
|
includes/functions.php
CHANGED
@@ -856,6 +856,10 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status
|
|
856 |
//Better support mySQL Strict Mode by passing a proper enum value for cycle_period
|
857 |
if ($level['cycle_period'] == '') { $level['cycle_period'] = 0; }
|
858 |
|
|
|
|
|
|
|
|
|
859 |
$sql = $wpdb->prepare("
|
860 |
INSERT INTO {$wpdb->pmpro_memberships_users}
|
861 |
(`user_id`, `membership_id`, `code_id`, `initial_payment`, `billing_amount`, `cycle_number`, `cycle_period`, `billing_limit`, `trial_amount`, `trial_limit`, `startdate`, `enddate`)
|
856 |
//Better support mySQL Strict Mode by passing a proper enum value for cycle_period
|
857 |
if ($level['cycle_period'] == '') { $level['cycle_period'] = 0; }
|
858 |
|
859 |
+
// clean up date formatting (string/not string)
|
860 |
+
$level['startdate'] = preg_replace('/\'/', '', $level['startdate']);
|
861 |
+
$level['enddate'] = preg_replace('/\'/', '', $level['enddate']);
|
862 |
+
|
863 |
$sql = $wpdb->prepare("
|
864 |
INSERT INTO {$wpdb->pmpro_memberships_users}
|
865 |
(`user_id`, `membership_id`, `code_id`, `initial_payment`, `billing_amount`, `cycle_number`, `cycle_period`, `billing_limit`, `trial_amount`, `trial_limit`, `startdate`, `enddate`)
|
includes/updates/upgrade_1_8_9_3.php
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Upgrade to 1.8.9.3
|
4 |
+
Fixing incorrect start and end dates.
|
5 |
+
*/
|
6 |
+
function pmpro_upgrade_1_8_9_3() {
|
7 |
+
global $wpdb;
|
8 |
+
|
9 |
+
//Fixing incorrect start and end dates. (Sets up update via AJAX)
|
10 |
+
$user_ids = $wpdb->get_col("SELECT user_id FROM $wpdb->pmpro_memberships_users WHERE status = 'active' AND modified > '2016-05-19'");
|
11 |
+
|
12 |
+
if(!empty($user_ids))
|
13 |
+
pmpro_addUpdate('pmpro_upgrade_1_8_9_3_ajax');
|
14 |
+
|
15 |
+
pmpro_setOption("db_version", "1.91");
|
16 |
+
return 1.893;
|
17 |
+
}
|
18 |
+
|
19 |
+
/*
|
20 |
+
We run this part of the update via AJAX from the updates page.
|
21 |
+
*/
|
22 |
+
function pmpro_upgrade_1_8_9_3_ajax() {
|
23 |
+
global $wpdb;
|
24 |
+
|
25 |
+
$debug = false;
|
26 |
+
$run = true;
|
27 |
+
|
28 |
+
//some vars
|
29 |
+
$all_levels = pmpro_getAllLevels(true, true);
|
30 |
+
|
31 |
+
//keeping track of which user we're working on
|
32 |
+
$last_user_id = get_option('pmpro_upgrade_1_8_9_3_last_user_id', 0);
|
33 |
+
|
34 |
+
//get all active users during the period where things may have been broken
|
35 |
+
$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");
|
36 |
+
|
37 |
+
//track progress
|
38 |
+
$first_load = get_transient('pmpro_updates_first_load');
|
39 |
+
if($first_load) {
|
40 |
+
$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");
|
41 |
+
update_option('pmpro_upgrade_1_8_9_3_total', $total_users, 'no');
|
42 |
+
$progress = 0;
|
43 |
+
} else {
|
44 |
+
$total_users = get_option('pmpro_upgrade_1_8_9_3_total', 0);
|
45 |
+
$progress = get_option('pmpro_upgrade_1_8_9_3_progress', 0);
|
46 |
+
}
|
47 |
+
update_option('pmpro_upgrade_1_8_9_3_progress', $progress + count($user_ids), 'no');
|
48 |
+
global $pmpro_updates_progress;
|
49 |
+
if($total_users > 0)
|
50 |
+
$pmpro_updates_progress = "[" . $progress . "/" . $total_users . "]";
|
51 |
+
else
|
52 |
+
$pmpro_updates_progress = "";
|
53 |
+
|
54 |
+
if(empty($user_ids)) {
|
55 |
+
//done with this update
|
56 |
+
pmpro_removeUpdate('pmpro_upgrade_1_8_9_3_ajax');
|
57 |
+
delete_option('pmpro_upgrade_1_8_9_3_last_user_id');
|
58 |
+
delete_option('pmpro_upgrade_1_8_9_3_total');
|
59 |
+
delete_option('pmpro_upgrade_1_8_9_3_progress');
|
60 |
+
} else {
|
61 |
+
foreach($user_ids as $user_id) {
|
62 |
+
$last_user_id = $user_id; //keeping track of the last user we processed
|
63 |
+
$user = get_userdata($user_id);
|
64 |
+
|
65 |
+
//user not found for some reason
|
66 |
+
if(empty($user)) {
|
67 |
+
if($debug)
|
68 |
+
echo "User #" . $user_id . " not found.\n";
|
69 |
+
continue;
|
70 |
+
}
|
71 |
+
|
72 |
+
//get level
|
73 |
+
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
|
74 |
+
|
75 |
+
//has a start and end date already
|
76 |
+
if(!empty($user->membership_level->enddate) && !empty($user->membership_level->startdate)) {
|
77 |
+
if($debug)
|
78 |
+
echo "User #" . $user_id . ", " . $user->user_email . " already has a start and end date.\n";
|
79 |
+
continue;
|
80 |
+
}
|
81 |
+
|
82 |
+
//get order
|
83 |
+
$last_order = new MemberOrder();
|
84 |
+
$last_order->getLastMemberOrder();
|
85 |
+
|
86 |
+
/*
|
87 |
+
Figure out if this user should have been given an end date.
|
88 |
+
The level my have an end date.
|
89 |
+
They might have used a discount code.
|
90 |
+
They might be using the set-expiration-dates code.
|
91 |
+
They might have custom code setting the end date.
|
92 |
+
|
93 |
+
Let's setup some vars as if we are at checkout.
|
94 |
+
Then pass recreate the level with the pmpro_checkout_level filter.
|
95 |
+
And use the end date there if there is one.
|
96 |
+
*/
|
97 |
+
global $pmpro_level, $discount_code, $discount_code_id;
|
98 |
+
|
99 |
+
//level
|
100 |
+
$level_id = $user->membership_level->id;
|
101 |
+
$_REQUEST['level'] = $level_id;
|
102 |
+
|
103 |
+
//gateway
|
104 |
+
if(!empty($last_order) && !empty($last_order->gateway))
|
105 |
+
$_REQUEST['gateway'] = $last_order->gateway;
|
106 |
+
else
|
107 |
+
$_REQUEST['gateway'] = pmpro_getGateway();
|
108 |
+
|
109 |
+
//discount code
|
110 |
+
$discount_code_id = $user->membership_level->code_id;
|
111 |
+
$discount_code = $wpdb->get_var( "SELECT code FROM $wpdb->pmpro_discount_codes WHERE id = '" . $discount_code_id . "' LIMIT 1" );
|
112 |
+
|
113 |
+
//get level
|
114 |
+
if(!empty($discount_code_id)) {
|
115 |
+
$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";
|
116 |
+
|
117 |
+
$pmpro_level = $wpdb->get_row( $sqlQuery );
|
118 |
+
|
119 |
+
//if the discount code doesn't adjust the level, let's just get the straight level
|
120 |
+
if ( empty( $pmpro_level ) ) {
|
121 |
+
$pmpro_level = $all_levels[$level_id];
|
122 |
+
}
|
123 |
+
|
124 |
+
//filter adjustments to the level
|
125 |
+
$pmpro_level->code_id = $discount_code_id;
|
126 |
+
$pmpro_level = apply_filters( "pmpro_discount_code_level", $pmpro_level, $discount_code_id );
|
127 |
+
}
|
128 |
+
|
129 |
+
//no level yet, use default
|
130 |
+
if ( empty( $pmpro_level ) ) {
|
131 |
+
$pmpro_level = $all_levels[$level_id];
|
132 |
+
}
|
133 |
+
|
134 |
+
//no level for some reason
|
135 |
+
if(empty($pmpro_level) && empty($pmpro_level->id)) {
|
136 |
+
if($debug)
|
137 |
+
echo "No level found with ID #" . $level_id . " for user #" . $user_id . ", " . $user->user_email . ".\n";
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
|
141 |
+
//filter level
|
142 |
+
$pmpro_level = apply_filters( "pmpro_checkout_level", $pmpro_level );
|
143 |
+
|
144 |
+
if($debug)
|
145 |
+
echo "User #" . $user_id . ", " . $user->user_email . ". Fixing.\n";
|
146 |
+
|
147 |
+
//calculate and fix start date
|
148 |
+
if(empty($user->membership_level->startdate)) {
|
149 |
+
$startdate = $wpdb->get_var("SELECT modified FROM $wpdb->pmpro_memberships_users WHERE user_id = $user_id AND membership_id = $level_id AND status = 'active' LIMIT 1");
|
150 |
+
|
151 |
+
//filter
|
152 |
+
$filtered_startdate = apply_filters( "pmpro_checkout_start_date", $startdate, $user_id, $pmpro_level );
|
153 |
+
|
154 |
+
//only use filtered value if it's not 0
|
155 |
+
if(!empty($filtered_startdate) && $filtered_startdate != '0000-00-00 00:00:00' && $filtered_startdate != "'0000-00-00 00:00:00'")
|
156 |
+
$startdate = $filtered_startdate;
|
157 |
+
|
158 |
+
if($debug)
|
159 |
+
echo "- Adding startdate " . $startdate . ".\n";
|
160 |
+
if($run) {
|
161 |
+
$sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET startdate = '" . esc_sql($startdate) . "' WHERE user_id = $user_id AND membership_id = $level_id AND status = 'active' LIMIT 1";
|
162 |
+
$wpdb->query($sqlQuery);
|
163 |
+
}
|
164 |
+
} else {
|
165 |
+
$startdate = date( "Y-m-d", $user->membership_level->startdate );
|
166 |
+
}
|
167 |
+
|
168 |
+
//calculate and fix the end date
|
169 |
+
if(empty($user->membership_level->enddate)) {
|
170 |
+
if ( ! empty( $pmpro_level->expiration_number ) ) {
|
171 |
+
$enddate = date( "Y-m-d", strtotime( "+ " . $pmpro_level->expiration_number . " " . $pmpro_level->expiration_period, $last_order->timestamp ) );
|
172 |
+
} else {
|
173 |
+
$enddate = "NULL";
|
174 |
+
}
|
175 |
+
|
176 |
+
$enddate = apply_filters( "pmpro_checkout_end_date", $enddate, $user_id, $pmpro_level, $startdate );
|
177 |
+
|
178 |
+
if(!empty($enddate) && $enddate != "NULL") {
|
179 |
+
if($debug)
|
180 |
+
echo "- Adding enddate " . $enddate . ".\n";
|
181 |
+
if($run) {
|
182 |
+
$sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET enddate = '" . esc_sql($enddate) . "' WHERE user_id = $user_id AND membership_id = $level_id AND status = 'active' LIMIT 1";
|
183 |
+
$wpdb->query($sqlQuery);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
//clear vars for next pass
|
189 |
+
$user_id = NULL;
|
190 |
+
$level_id = NULL;
|
191 |
+
$discount_code = NULL;
|
192 |
+
$discount_code_id = NULL;
|
193 |
+
$pmpro_level = NULL;
|
194 |
+
$last_order = NULL;
|
195 |
+
$startdate = NULL;
|
196 |
+
$filtered_startdate = NULL;
|
197 |
+
$enddate = NULL;
|
198 |
+
|
199 |
+
echo "\n";
|
200 |
+
}
|
201 |
+
|
202 |
+
update_option('pmpro_upgrade_1_8_9_3_last_user_id', $last_user_id, 'no');
|
203 |
+
}
|
204 |
+
}
|
includes/upgradecheck.php
CHANGED
@@ -166,7 +166,7 @@ function pmpro_checkForUpgrades()
|
|
166 |
}
|
167 |
|
168 |
/*
|
169 |
-
v1.9
|
170 |
* Changed 'code' column of pmpro_membership_orders table to 32 characters.
|
171 |
*/
|
172 |
if($pmpro_db_version < 1.9) {
|
@@ -175,6 +175,15 @@ function pmpro_checkForUpgrades()
|
|
175 |
$pmpro_db_version = 1.9;
|
176 |
pmpro_setOption("db_version", "1.9");
|
177 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
function pmpro_db_delta()
|
166 |
}
|
167 |
|
168 |
/*
|
169 |
+
v1.8.9.2 (db v1.9)
|
170 |
* Changed 'code' column of pmpro_membership_orders table to 32 characters.
|
171 |
*/
|
172 |
if($pmpro_db_version < 1.9) {
|
175 |
$pmpro_db_version = 1.9;
|
176 |
pmpro_setOption("db_version", "1.9");
|
177 |
}
|
178 |
+
|
179 |
+
/*
|
180 |
+
v1.8.9.3 (db v1.91)
|
181 |
+
* Fixing incorrect start and end dates.
|
182 |
+
*/
|
183 |
+
require_once(PMPRO_DIR . "/includes/updates/upgrade_1_8_9_3.php");
|
184 |
+
if($pmpro_db_version < 1.91) {
|
185 |
+
$pmpro_db_version = pmpro_upgrade_1_8_9_3();
|
186 |
+
}
|
187 |
}
|
188 |
|
189 |
function pmpro_db_delta()
|
pages/checkout.php
CHANGED
@@ -665,13 +665,7 @@
|
|
665 |
-->
|
666 |
</script>
|
667 |
|
668 |
-
<?php
|
669 |
-
if($gateway == "check" && !pmpro_isLevelFree($pmpro_level))
|
670 |
-
{
|
671 |
-
$instructions = pmpro_getOption("instructions");
|
672 |
-
echo '<div class="pmpro_check_instructions">' . wpautop($instructions) . '</div>';
|
673 |
-
}
|
674 |
-
?>
|
675 |
|
676 |
<?php
|
677 |
if($tospage && !$pmpro_review)
|
665 |
-->
|
666 |
</script>
|
667 |
|
668 |
+
<?php do_action('pmpro_checkout_after_payment_information_fields'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
|
670 |
<?php
|
671 |
if($tospage && !$pmpro_review)
|
paid-memberships-pro.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
-
Version: 1.8.9.
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
@@ -13,7 +13,7 @@ Author URI: http://www.strangerstudios.com
|
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
-
define("PMPRO_VERSION", "1.8.9.
|
17 |
define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
|
18 |
|
19 |
//if the session has been started yet, start it (ignore if running from command line)
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
+
Version: 1.8.9.3
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
+
define("PMPRO_VERSION", "1.8.9.3");
|
17 |
define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
|
18 |
|
19 |
//if the session has been started yet, start it (ignore if running from command line)
|
preheaders/checkout.php
CHANGED
@@ -648,7 +648,7 @@ if ( ! empty( $pmpro_confirmed ) ) {
|
|
648 |
do_action( 'pmpro_checkout_before_change_membership_level', $user_id, $morder );
|
649 |
|
650 |
//start date is NOW() but filterable below
|
651 |
-
$startdate =
|
652 |
|
653 |
/**
|
654 |
* Filter the start date for the membership/subscription.
|
@@ -663,7 +663,7 @@ if ( ! empty( $pmpro_confirmed ) ) {
|
|
663 |
|
664 |
//calculate the end date
|
665 |
if ( ! empty( $pmpro_level->expiration_number ) ) {
|
666 |
-
$enddate =
|
667 |
} else {
|
668 |
$enddate = "NULL";
|
669 |
}
|
648 |
do_action( 'pmpro_checkout_before_change_membership_level', $user_id, $morder );
|
649 |
|
650 |
//start date is NOW() but filterable below
|
651 |
+
$startdate = current_time( "mysql" );
|
652 |
|
653 |
/**
|
654 |
* Filter the start date for the membership/subscription.
|
663 |
|
664 |
//calculate the end date
|
665 |
if ( ! empty( $pmpro_level->expiration_number ) ) {
|
666 |
+
$enddate = date( "Y-m-d", strtotime( "+ " . $pmpro_level->expiration_number . " " . $pmpro_level->expiration_period, current_time( "timestamp" ) ) );
|
667 |
} else {
|
668 |
$enddate = "NULL";
|
669 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: strangerstudios
|
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.5.2
|
6 |
-
Stable tag: 1.8.9.
|
7 |
|
8 |
A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
|
9 |
|
@@ -116,6 +116,12 @@ Not sure? You can find out by doing a bit a research.
|
|
116 |
|
117 |
== Changelog ==
|
118 |
=======
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
= 1.8.9.2 =
|
120 |
* BUG: Fixed SQL in pmpro_changeMembershipLevel that caused issues with some MySQL setups.
|
121 |
* BUG: Fixed URL PayPal Express and PayPal standard redirect to at checkout. (Although the incorrect URL was still working on the PayPal side.)
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.5.2
|
6 |
+
Stable tag: 1.8.9.3
|
7 |
|
8 |
A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
|
9 |
|
116 |
|
117 |
== Changelog ==
|
118 |
=======
|
119 |
+
= 1.8.9.3 =
|
120 |
+
* BUG: Fixed bug introduced in 1.8.9.2 where member start and end dates weren't being set correctly. Includes an update script to fix past users affected by this.
|
121 |
+
* BUG: Fixed warnings on new order page in the dashboard.
|
122 |
+
* BUG/ENHANCEMENT: Fixed the pmpro_checkout_default_submit_button() methods of the PayPal Express to no longer check if the current gateway is a paypal one. The method is only called when the gateway is loaded anyway or when another addon (e.g. the pmpro-pay-by-check addon) adds the hook.
|
123 |
+
* BUG/ENHANCEMENT: Moved check instructions code into the check gateway class so it can be overriden by addons (e.g. an update to the pmpro-pay-by-check addon).
|
124 |
+
|
125 |
= 1.8.9.2 =
|
126 |
* BUG: Fixed SQL in pmpro_changeMembershipLevel that caused issues with some MySQL setups.
|
127 |
* BUG: Fixed URL PayPal Express and PayPal standard redirect to at checkout. (Although the incorrect URL was still working on the PayPal side.)
|