Paid Memberships Pro - Version 1.8.10.4

Version Description

  • BUG: Fixed issue where non-decimal currencies (e.g. Japanese Yen) were sending invalid amounts to the Stripe gateway.
  • BUG/ENHANCEMENT: If an invalid discount code is applied at checkout, we now set the code_level JS var to false. Along with updates to the Pay by Check addon, this fixes issues with the Pay by Check addon where users could not checkout when using a discount code that reduced the price to free.
  • BUG/ENHANCEMENT: Fixed HTML validation issue in CVV field of the checkout page.
  • BUG/ENHANCEMENT: Now using the current_time function in profile.php to avoid off-by-one errors when changing members' expiration dates.
Download this release

Release Info

Developer strangerstudios
Plugin Icon 128x128 Paid Memberships Pro
Version 1.8.10.4
Comparing to
See all releases

Code changes from version 1.8.10.3 to 1.8.10.4

classes/gateways/class.pmprogateway_stripe.php CHANGED
@@ -249,7 +249,7 @@
249
  // this identifies your website in the createToken call below
250
  Stripe.setPublishableKey('<?php echo pmpro_getOption("stripe_publishablekey"); ?>');
251
 
252
- var pmpro_require_billing = true;
253
 
254
  jQuery(document).ready(function() {
255
  jQuery("#pmpro_form, .pmpro_form").submit(function(event) {
@@ -1086,8 +1086,13 @@
1086
  */
1087
  function charge(&$order)
1088
  {
1089
- global $pmpro_currency;
1090
-
 
 
 
 
 
1091
  //create a code for the order
1092
  if(empty($order->code))
1093
  $order->code = $order->getRandomCode();
@@ -1113,7 +1118,7 @@
1113
  try
1114
  {
1115
  $response = Stripe_Charge::create(array(
1116
- "amount" => $amount * 100, # amount in cents, again
1117
  "currency" => strtolower($pmpro_currency),
1118
  "customer" => $this->customer->id,
1119
  "description" => "Order #" . $order->code . ", " . trim($order->FirstName . " " . $order->LastName) . " (" . $order->Email . ")"
@@ -1399,7 +1404,13 @@
1399
  */
1400
  function subscribe(&$order, $checkout = true)
1401
  {
1402
- global $pmpro_currency;
 
 
 
 
 
 
1403
 
1404
  //create a code for the order
1405
  if(empty($order->code))
@@ -1494,7 +1505,7 @@
1494
  try
1495
  {
1496
  $plan = array(
1497
- "amount" => $amount * 100,
1498
  "interval_count" => $order->BillingFrequency,
1499
  "interval" => strtolower($order->BillingPeriod),
1500
  "trial_period_days" => $trial_period_days,
249
  // this identifies your website in the createToken call below
250
  Stripe.setPublishableKey('<?php echo pmpro_getOption("stripe_publishablekey"); ?>');
251
 
252
+ pmpro_require_billing = true;
253
 
254
  jQuery(document).ready(function() {
255
  jQuery("#pmpro_form, .pmpro_form").submit(function(event) {
1086
  */
1087
  function charge(&$order)
1088
  {
1089
+ global $pmpro_currency, $pmpro_currencies;
1090
+ $currency_unit_multiplier = 100; //ie 100 cents per USD
1091
+
1092
+ //account for zero-decimal currencies like the Japanese Yen
1093
+ if(is_array($pmpro_currencies[$pmpro_currency]) && isset($pmpro_currencies[$pmpro_currency]['decimals']) && $pmpro_currencies[$pmpro_currency]['decimals'] == 0)
1094
+ $currency_unit_multiplier = 1;
1095
+
1096
  //create a code for the order
1097
  if(empty($order->code))
1098
  $order->code = $order->getRandomCode();
1118
  try
1119
  {
1120
  $response = Stripe_Charge::create(array(
1121
+ "amount" => $amount * $currency_unit_multiplier, # amount in cents, again
1122
  "currency" => strtolower($pmpro_currency),
1123
  "customer" => $this->customer->id,
1124
  "description" => "Order #" . $order->code . ", " . trim($order->FirstName . " " . $order->LastName) . " (" . $order->Email . ")"
1404
  */
1405
  function subscribe(&$order, $checkout = true)
1406
  {
1407
+ global $pmpro_currency, $pmpro_currencies;
1408
+
1409
+ $currency_unit_multiplier = 100; //ie 100 cents per USD
1410
+
1411
+ //account for zero-decimal currencies like the Japanese Yen
1412
+ if(is_array($pmpro_currencies[$pmpro_currency]) && isset($pmpro_currencies[$pmpro_currency]['decimals']) && $pmpro_currencies[$pmpro_currency]['decimals'] == 0)
1413
+ $currency_unit_multiplier = 1;
1414
 
1415
  //create a code for the order
1416
  if(empty($order->code))
1505
  try
1506
  {
1507
  $plan = array(
1508
+ "amount" => $amount * $currency_unit_multiplier,
1509
  "interval_count" => $order->BillingFrequency,
1510
  "interval" => strtolower($order->BillingPeriod),
1511
  "trial_period_days" => $trial_period_days,
includes/profile.php CHANGED
@@ -85,19 +85,19 @@ function pmpro_membership_level_profile_fields($user)
85
  $end_date = !empty($user->membership_level->enddate);
86
 
87
  //some vars for the dates
88
- $current_day = date("j");
89
  if($end_date)
90
  $selected_expires_day = date("j", $user->membership_level->enddate);
91
  else
92
  $selected_expires_day = $current_day;
93
 
94
- $current_month = date("M");
95
  if($end_date)
96
  $selected_expires_month = date("m", $user->membership_level->enddate);
97
  else
98
  $selected_expires_month = date("m");
99
 
100
- $current_year = date("Y");
101
  if($end_date)
102
  $selected_expires_year = date("Y", $user->membership_level->enddate);
103
  else
85
  $end_date = !empty($user->membership_level->enddate);
86
 
87
  //some vars for the dates
88
+ $current_day = date("j", current_time('timestamp'));
89
  if($end_date)
90
  $selected_expires_day = date("j", $user->membership_level->enddate);
91
  else
92
  $selected_expires_day = $current_day;
93
 
94
+ $current_month = date("M", current_time('timestamp'));
95
  if($end_date)
96
  $selected_expires_month = date("m", $user->membership_level->enddate);
97
  else
98
  $selected_expires_month = date("m");
99
 
100
+ $current_year = date("Y", current_time('timestamp'));
101
  if($end_date)
102
  $selected_expires_year = date("Y", $user->membership_level->enddate);
103
  else
pages/checkout.php CHANGED
@@ -603,7 +603,7 @@
603
  if($pmpro_show_cvv) { ?>
604
  <div class="pmpro_payment-cvv">
605
  <label for="CVV"><?php _e('CVV', 'pmpro');?></label>
606
- <input class="input" id="CVV" name="CVV" type="text" size="4" value="<?php if(!empty($_REQUEST['CVV'])) { echo esc_attr($_REQUEST['CVV']); }?>" class=" <?php echo pmpro_getClassForField("CVV");?>" /> <small>(<a href="javascript:void(0);" onclick="javascript:window.open('<?php echo pmpro_https_filter(PMPRO_URL)?>/pages/popup-cvv.html','cvv','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=600, height=475');"><?php _e("what's this?", 'pmpro');?></a>)</small>
607
  </div>
608
  <?php } ?>
609
 
603
  if($pmpro_show_cvv) { ?>
604
  <div class="pmpro_payment-cvv">
605
  <label for="CVV"><?php _e('CVV', 'pmpro');?></label>
606
+ <input class="input" id="CVV" name="CVV" type="text" size="4" value="<?php if(!empty($_REQUEST['CVV'])) { echo esc_attr($_REQUEST['CVV']); }?>" class="<?php echo pmpro_getClassForField("CVV");?>" /> <small>(<a href="javascript:void(0);" onclick="javascript:window.open('<?php echo pmpro_https_filter(PMPRO_URL)?>/pages/popup-cvv.html','cvv','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=600, height=475');"><?php _e("what's this?", 'pmpro');?></a>)</small>
607
  </div>
608
  <?php } ?>
609
 
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.10.3
7
  Author: Stranger Studios
8
  Author URI: http://www.strangerstudios.com
9
  Text Domain: pmpro
@@ -15,7 +15,7 @@ Domain Path: /languages
15
  */
16
 
17
  //version constant
18
- define("PMPRO_VERSION", "1.8.10.3");
19
  define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
20
 
21
  //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.10.4
7
  Author: Stranger Studios
8
  Author URI: http://www.strangerstudios.com
9
  Text Domain: pmpro
15
  */
16
 
17
  //version constant
18
+ define("PMPRO_VERSION", "1.8.10.4");
19
  define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
20
 
21
  //if the session has been started yet, start it (ignore if running from command line)
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.3
6
- Stable tag: 1.8.10.3
7
 
8
  A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
9
 
@@ -115,6 +115,12 @@ Not sure? You can find out by doing a bit a research.
115
  [View All Screenshots](http://www.paidmembershipspro.com/features/screenshots/)
116
 
117
  == Changelog ==
 
 
 
 
 
 
118
  = 1.8.10.3 =
119
  * BUG: Fixed bug where users could not confirm PayPal Express payments if the main gateway was Stripe or Braintree.
120
  * BUG: Fixed issue where the billing address and/or credit card fields were not showing up on the Update Billing page.
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.3
6
+ Stable tag: 1.8.10.4
7
 
8
  A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
9
 
115
  [View All Screenshots](http://www.paidmembershipspro.com/features/screenshots/)
116
 
117
  == Changelog ==
118
+ = 1.8.10.4 =
119
+ * BUG: Fixed issue where non-decimal currencies (e.g. Japanese Yen) were sending invalid amounts to the Stripe gateway.
120
+ * BUG/ENHANCEMENT: If an invalid discount code is applied at checkout, we now set the code_level JS var to false. Along with updates to the Pay by Check addon, this fixes issues with the Pay by Check addon where users could not checkout when using a discount code that reduced the price to free.
121
+ * BUG/ENHANCEMENT: Fixed HTML validation issue in CVV field of the checkout page.
122
+ * BUG/ENHANCEMENT: Now using the current_time function in profile.php to avoid off-by-one errors when changing members' expiration dates.
123
+
124
  = 1.8.10.3 =
125
  * BUG: Fixed bug where users could not confirm PayPal Express payments if the main gateway was Stripe or Braintree.
126
  * BUG: Fixed issue where the billing address and/or credit card fields were not showing up on the Update Billing page.
services/applydiscountcode.php CHANGED
@@ -45,6 +45,9 @@
45
  jQuery('#<?php echo $msgfield?>').addClass('pmpro_error');
46
  jQuery('#<?php echo $msgfield?>').addClass('pmpro_discount_code_msg');
47
 
 
 
 
48
  //filter to insert your own code
49
  <?php do_action('pmpro_applydiscountcode_return_js', $discount_code, $discount_code_id, $level_id, false); ?>
50
  </script>
45
  jQuery('#<?php echo $msgfield?>').addClass('pmpro_error');
46
  jQuery('#<?php echo $msgfield?>').addClass('pmpro_discount_code_msg');
47
 
48
+ var code_level;
49
+ code_level = false;
50
+
51
  //filter to insert your own code
52
  <?php do_action('pmpro_applydiscountcode_return_js', $discount_code, $discount_code_id, $level_id, false); ?>
53
  </script>