Paid Memberships Pro - Version 1.8.9.2

Version Description

  • BUG: Fixed SQL in pmpro_changeMembershipLevel that caused issues with some MySQL setups.
  • BUG: Fixed URL PayPal Express and PayPal standard redirect to at checkout. (Although the incorrect URL was still working on the PayPal side.)
  • BUG: Addon page now passes $status to the plugin_row_meta filter to fix warnings that were sometimes showing up. (Thanks, jawhite)
  • BUG: Fixed typo in the pmpro_orders_csv_extra_columns filter introduced in 1.8.9.1. (Thanks, Johannes Jokelin)
Download this release

Release Info

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

Code changes from version 1.8.9.1 to 1.8.9.2

adminpages/orders-csv.php CHANGED
@@ -316,7 +316,8 @@ $csv_file_header_array = apply_filters( "pmpro_order_list_csv_export_header_arra
316
  $dateformat = apply_filters( 'pmpro_order_list_csv_dateformat', get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) );
317
 
318
  //any extra columns
319
- $extra_columns = apply_filters( "pmpro_order_list_csv_extra_columns", array() );
 
320
 
321
  if ( ! empty( $extra_columns ) ) {
322
  foreach ( $extra_columns as $heading => $callback ) {
316
  $dateformat = apply_filters( 'pmpro_order_list_csv_dateformat', get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) );
317
 
318
  //any extra columns
319
+ $extra_columns = apply_filters( "pmpro_orders_csv_extra_columns", array() ); //the original filter
320
+ $extra_columns = apply_filters( "pmpro_order_list_csv_extra_columns", $extra_columns ); //in case anyone used the typo'd filter
321
 
322
  if ( ! empty( $extra_columns ) ) {
323
  foreach ( $extra_columns as $heading => $callback ) {
classes/gateways/class.pmprogateway_paypalexpress.php CHANGED
@@ -547,11 +547,11 @@
547
  $order->saveOrder();
548
 
549
  //redirect to paypal
550
- $paypal_url = "https://www.paypal.com/webscr&cmd=_express-checkout&useraction=commit&token=" . $this->httpParsedResponseAr['TOKEN'];
551
  $environment = pmpro_getOption("gateway_environment");
552
  if("sandbox" === $environment || "beta-sandbox" === $environment)
553
  {
554
- $paypal_url = "https://www.sandbox.paypal.com/webscr&useraction=commit&cmd=_express-checkout&token=" . $this->httpParsedResponseAr['TOKEN'];
555
  }
556
 
557
  wp_redirect($paypal_url);
547
  $order->saveOrder();
548
 
549
  //redirect to paypal
550
+ $paypal_url = "https://www.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=" . $this->httpParsedResponseAr['TOKEN'];
551
  $environment = pmpro_getOption("gateway_environment");
552
  if("sandbox" === $environment || "beta-sandbox" === $environment)
553
  {
554
+ $paypal_url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=" . $this->httpParsedResponseAr['TOKEN'];
555
  }
556
 
557
  wp_redirect($paypal_url);
includes/functions.php CHANGED
@@ -849,63 +849,59 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status
849
 
850
  //insert current membership
851
  if(!empty($level)) //are we getting a new one or just cancelling the old ones
852
- {
 
853
  if(is_array($level))
854
  {
855
- //make sure the dates are in good formats
856
- if($level['startdate'] != current_time('mysql') && $level['startdate'] != "NULL" && substr($level['startdate'], 0, 1) != "'")
857
- $level['startdate'] = "'" . $level['startdate'] . "'";
858
-
859
- if($level['enddate'] != current_time('mysql') && $level['enddate'] != "NULL" && substr($level['enddate'], 0, 1) != "'")
860
- $level['enddate'] = "'" . $level['enddate'] . "'";
861
-
862
  //Better support mySQL Strict Mode by passing a proper enum value for cycle_period
863
- if ($level['cycle_period'] == '') $level['cycle_period'] = 0;
864
-
865
- $sql = "INSERT INTO $wpdb->pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)
866
- VALUES('" . $level['user_id'] . "',
867
- '" . $level['membership_id'] . "',
868
- '" . intval($level['code_id']) . "',
869
- '" . $level['initial_payment'] . "',
870
- '" . $level['billing_amount'] . "',
871
- '" . $level['cycle_number'] . "',
872
- '" . $level['cycle_period'] . "',
873
- '" . $level['billing_limit'] . "',
874
- '" . $level['trial_amount'] . "',
875
- '" . $level['trial_limit'] . "',
876
- " . $level['startdate'] . ",
877
- " . $level['enddate'] . ")";
878
-
879
- if(!$wpdb->query($sql))
880
- {
881
- $pmpro_error = __("Error interacting with database", "pmpro") . ": ".($wpdb->last_error?$wpdb->last_error:'unavailable');
882
- return false;
883
- }
884
  }
885
  else
886
  {
887
- $sql = "INSERT INTO $wpdb->pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)
888
- VALUES (
889
- '" . $user_id . "',
890
- '" . $level . "',
891
- '0',
892
- '0',
893
- '0',
894
- '0',
895
- '0',
896
- '0',
897
- '0',
898
- '0',
899
- '" . current_time('mysql') . "',
900
- '0000-00-00 00:00:00'
901
- )";
902
-
903
- if(!$wpdb->query($sql))
904
- {
905
- $pmpro_error = __("Error interacting with database", "pmpro") . ": ".($wpdb->last_error?$wpdb->last_error:'unavailable');
906
- return false;
907
- }
908
  }
 
 
 
 
 
 
909
  }
910
 
911
  //remove cached level
849
 
850
  //insert current membership
851
  if(!empty($level)) //are we getting a new one or just cancelling the old ones
852
+ {
853
+ //make sure the dates are in good formats
854
  if(is_array($level))
855
  {
 
 
 
 
 
 
 
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`)
862
+ VALUES
863
+ ( %d, %d, %d, %s, %s, %d, %s, %d, %s, %d, %s, %s )",
864
+ $level['user_id'], // integer
865
+ $level['membership_id'], // integer
866
+ $level['code_id'], // integer
867
+ $level['initial_payment'], // float (string)
868
+ $level['billing_amount'], // float (string)
869
+ $level['cycle_number'], // integer
870
+ $level['cycle_period'], // string (enum)
871
+ $level['billing_limit'], // integer
872
+ $level['trial_amount'], // float (string)
873
+ $level['trial_limit'], // integer
874
+ $level['startdate'], // string (date)
875
+ $level['enddate'] // string (date)
876
+ );
 
877
  }
878
  else
879
  {
880
+ $sql = $wpdb->prepare("
881
+ INSERT INTO {$wpdb->pmpro_memberships_users}
882
+ ( `user_id`, `membership_id`, `code_id`, `initial_payment`, `billing_amount`, `cycle_number`, `cycle_period`, `billing_limit`, `trial_amount`, `trial_limit`, `startdate`, `enddate`)
883
+ VALUES
884
+ ( %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %s, %s )",
885
+ $user_id,
886
+ $level_id,
887
+ '0',
888
+ '0',
889
+ '0',
890
+ '0',
891
+ '0',
892
+ '0',
893
+ '0',
894
+ '0',
895
+ current_time('mysql'),
896
+ '0000-00-00 00:00:00'
897
+ );
 
 
 
898
  }
899
+
900
+ if( false === $wpdb->query($sql) )
901
+ {
902
+ $pmpro_error = sprintf( __("Error interacting with database: %s", "pmpro"), (!empty($wpdb->last_error) ? $wpdb->last_error : 'unavailable' ));
903
+ return false;
904
+ }
905
  }
906
 
907
  //remove cached level
includes/upgradecheck.php CHANGED
@@ -163,7 +163,18 @@ function pmpro_checkForUpgrades()
163
  require_once(PMPRO_DIR . "/includes/updates/upgrade_1_8_9_1.php");
164
  if($pmpro_db_version < 1.891) {
165
  $pmpro_db_version = pmpro_upgrade_1_8_9_1();
166
- }
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
  function pmpro_db_delta()
@@ -211,7 +222,7 @@ function pmpro_db_delta()
211
  $sqlQuery = "
212
  CREATE TABLE `" . $wpdb->pmpro_membership_orders . "` (
213
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
214
- `code` varchar(10) NOT NULL,
215
  `session_id` varchar(64) NOT NULL DEFAULT '',
216
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
217
  `membership_id` int(11) unsigned NOT NULL DEFAULT '0',
@@ -377,4 +388,4 @@ function pmpro_db_delta()
377
  );
378
  ";
379
  dbDelta($sqlQuery);
380
- }
163
  require_once(PMPRO_DIR . "/includes/updates/upgrade_1_8_9_1.php");
164
  if($pmpro_db_version < 1.891) {
165
  $pmpro_db_version = pmpro_upgrade_1_8_9_1();
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) {
173
+ pmpro_db_delta();
174
+
175
+ $pmpro_db_version = 1.9;
176
+ pmpro_setOption("db_version", "1.9");
177
+ }
178
  }
179
 
180
  function pmpro_db_delta()
222
  $sqlQuery = "
223
  CREATE TABLE `" . $wpdb->pmpro_membership_orders . "` (
224
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
225
+ `code` varchar(32) NOT NULL,
226
  `session_id` varchar(64) NOT NULL DEFAULT '',
227
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
228
  `membership_id` int(11) unsigned NOT NULL DEFAULT '0',
388
  );
389
  ";
390
  dbDelta($sqlQuery);
391
+ }
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.1
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.1");
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.2
7
  Author: Stranger Studios
8
  Author URI: http://www.strangerstudios.com
9
  */
13
  */
14
 
15
  //version constant
16
+ define("PMPRO_VERSION", "1.8.9.2");
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)
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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
6
- Stable tag: 1.8.9.1
7
 
8
  A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
9
 
@@ -115,6 +115,13 @@ 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.9.1 =
119
  * BUG: Fixed bug where some recurring orders members who checked out with Stripe in very old versions of PMPro would show up as orders with a blank user_id and membership_id. This update includes a fix for this and an update script to fix old orders affected by this.
120
  * BUG: Fixed bug where the Stripe class activation/deactivation methods were setup too late to actually run on activation/deactivation.
2
  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.2
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
+ =======
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.)
122
+ * BUG: Addon page now passes $status to the plugin_row_meta filter to fix warnings that were sometimes showing up. (Thanks, jawhite)
123
+ * BUG: Fixed typo in the pmpro_orders_csv_extra_columns filter introduced in 1.8.9.1. (Thanks, Johannes Jokelin)
124
+
125
  = 1.8.9.1 =
126
  * BUG: Fixed bug where some recurring orders members who checked out with Stripe in very old versions of PMPro would show up as orders with a blank user_id and membership_id. This update includes a fix for this and an update script to fix old orders affected by this.
127
  * BUG: Fixed bug where the Stripe class activation/deactivation methods were setup too late to actually run on activation/deactivation.