Simple Membership - Version 3.9.9

Version Description

  • Added an enhancement to accept empty address value and force updating (when admin updates the address of a member profile from admin interface).
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 Simple Membership
Version 3.9.9
Comparing to
See all releases

Code changes from version 3.9.8 to 3.9.9

classes/class.swpm-form.php CHANGED
@@ -24,7 +24,7 @@ class SwpmForm {
24
  if (empty($user_name)) {
25
  return;
26
  }
27
-
28
  $user = get_user_by('login', $user_name);
29
  if ($user && ($user->user_email != $email)){
30
  $error_msg = SwpmUtils::_("Wordpress account exists with given username. But given email doesn't match.");
@@ -39,7 +39,7 @@ class SwpmForm {
39
  $this->errors['wp_user'] = $error_msg;
40
  }
41
  }
42
-
43
  protected function user_name() {
44
  global $wpdb;
45
  if (!empty($this->fields['user_name'])){return;}
@@ -66,13 +66,11 @@ class SwpmForm {
66
 
67
  protected function first_name() {
68
  $first_name = filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING);
69
- if (empty($first_name)) {return;}
70
  $this->sanitized['first_name'] = sanitize_text_field($first_name);
71
  }
72
 
73
  protected function last_name() {
74
  $last_name = filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING);
75
- if (empty($last_name)) {return;}
76
  $this->sanitized['last_name'] = sanitize_text_field($last_name);
77
  }
78
 
@@ -107,16 +105,16 @@ class SwpmForm {
107
  }
108
  $saned = sanitize_email($email);
109
  $query = "SELECT count(member_id) FROM {$wpdb->prefix}swpm_members_tbl WHERE email= %s";
110
- $member_id = filter_input(INPUT_GET, 'member_id', FILTER_SANITIZE_NUMBER_INT);
111
  if (!empty($member_id)) {
112
  $query .= ' AND member_id !=%d';
113
  $result = $wpdb->get_var($wpdb->prepare($query, strip_tags($saned), $member_id));
114
  }
115
- else{
116
  $result = $wpdb->get_var($wpdb->prepare($query, strip_tags($saned)));
117
  }
118
-
119
- if ($result > 0) {
120
  if ($saned != $this->fields['email']) {
121
  $error_msg = SwpmUtils::_('Email is already used.') . " (" . $saned .")";
122
  $this->errors['email'] = $error_msg;
@@ -128,39 +126,33 @@ class SwpmForm {
128
 
129
  protected function phone() {
130
  $phone = filter_input(INPUT_POST, 'phone', FILTER_UNSAFE_RAW);
131
- if (empty($phone)) {return;}
132
  $saned = wp_kses($phone, array());
133
- $this->sanitized['phone'] = $saned;
134
  return;
135
  }
136
 
137
  protected function address_street() {
138
  $address_street = filter_input(INPUT_POST, 'address_street', FILTER_SANITIZE_STRING);
139
- if (empty($address_street)) { return;}
140
  $this->sanitized['address_street'] = wp_kses($address_street, array());
141
  }
142
 
143
  protected function address_city() {
144
  $address_city = filter_input(INPUT_POST, 'address_city', FILTER_SANITIZE_STRING);
145
- if (empty($address_city)){ return; }
146
  $this->sanitized['address_city'] = wp_kses($address_city, array());
147
  }
148
 
149
  protected function address_state() {
150
  $address_state = filter_input(INPUT_POST, 'address_state', FILTER_SANITIZE_STRING);
151
- if (empty($address_state)) {return;}
152
  $this->sanitized['address_state'] = wp_kses($address_state, array());
153
  }
154
 
155
  protected function address_zipcode() {
156
  $address_zipcode = filter_input(INPUT_POST, 'address_zipcode', FILTER_UNSAFE_RAW);
157
- if (empty($address_zipcode)){ return;}
158
  $this->sanitized['address_zipcode'] = wp_kses($address_zipcode, array());
159
  }
160
 
161
  protected function country() {
162
  $country = filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING);
163
- if (empty($country)){ return;}
164
  $this->sanitized['country'] = wp_kses($country, array());
165
  }
166
 
@@ -218,7 +210,7 @@ class SwpmForm {
218
  $this->errors['membership_level'] = SwpmUtils::_('Invalid membership level');
219
  return;
220
  }
221
-
222
  if (empty($membership_level)) {return;}
223
  $this->sanitized['membership_level'] = $membership_level;
224
  }
@@ -293,12 +285,12 @@ class SwpmForm {
293
  }
294
 
295
  public function is_valid() {
296
-
297
  if (!isset($this->errors)){
298
  //Errors are not set at all. Return true.
299
  return true;
300
  }
301
-
302
  return count($this->errors) < 1;
303
  }
304
 
24
  if (empty($user_name)) {
25
  return;
26
  }
27
+
28
  $user = get_user_by('login', $user_name);
29
  if ($user && ($user->user_email != $email)){
30
  $error_msg = SwpmUtils::_("Wordpress account exists with given username. But given email doesn't match.");
39
  $this->errors['wp_user'] = $error_msg;
40
  }
41
  }
42
+
43
  protected function user_name() {
44
  global $wpdb;
45
  if (!empty($this->fields['user_name'])){return;}
66
 
67
  protected function first_name() {
68
  $first_name = filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING);
 
69
  $this->sanitized['first_name'] = sanitize_text_field($first_name);
70
  }
71
 
72
  protected function last_name() {
73
  $last_name = filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING);
 
74
  $this->sanitized['last_name'] = sanitize_text_field($last_name);
75
  }
76
 
105
  }
106
  $saned = sanitize_email($email);
107
  $query = "SELECT count(member_id) FROM {$wpdb->prefix}swpm_members_tbl WHERE email= %s";
108
+ $member_id = filter_input(INPUT_GET, 'member_id', FILTER_SANITIZE_NUMBER_INT);
109
  if (!empty($member_id)) {
110
  $query .= ' AND member_id !=%d';
111
  $result = $wpdb->get_var($wpdb->prepare($query, strip_tags($saned), $member_id));
112
  }
113
+ else{
114
  $result = $wpdb->get_var($wpdb->prepare($query, strip_tags($saned)));
115
  }
116
+
117
+ if ($result > 0) {
118
  if ($saned != $this->fields['email']) {
119
  $error_msg = SwpmUtils::_('Email is already used.') . " (" . $saned .")";
120
  $this->errors['email'] = $error_msg;
126
 
127
  protected function phone() {
128
  $phone = filter_input(INPUT_POST, 'phone', FILTER_UNSAFE_RAW);
 
129
  $saned = wp_kses($phone, array());
130
+ $this->sanitized['phone'] = $saned;
131
  return;
132
  }
133
 
134
  protected function address_street() {
135
  $address_street = filter_input(INPUT_POST, 'address_street', FILTER_SANITIZE_STRING);
 
136
  $this->sanitized['address_street'] = wp_kses($address_street, array());
137
  }
138
 
139
  protected function address_city() {
140
  $address_city = filter_input(INPUT_POST, 'address_city', FILTER_SANITIZE_STRING);
 
141
  $this->sanitized['address_city'] = wp_kses($address_city, array());
142
  }
143
 
144
  protected function address_state() {
145
  $address_state = filter_input(INPUT_POST, 'address_state', FILTER_SANITIZE_STRING);
 
146
  $this->sanitized['address_state'] = wp_kses($address_state, array());
147
  }
148
 
149
  protected function address_zipcode() {
150
  $address_zipcode = filter_input(INPUT_POST, 'address_zipcode', FILTER_UNSAFE_RAW);
 
151
  $this->sanitized['address_zipcode'] = wp_kses($address_zipcode, array());
152
  }
153
 
154
  protected function country() {
155
  $country = filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING);
 
156
  $this->sanitized['country'] = wp_kses($country, array());
157
  }
158
 
210
  $this->errors['membership_level'] = SwpmUtils::_('Invalid membership level');
211
  return;
212
  }
213
+
214
  if (empty($membership_level)) {return;}
215
  $this->sanitized['membership_level'] = $membership_level;
216
  }
285
  }
286
 
287
  public function is_valid() {
288
+
289
  if (!isset($this->errors)){
290
  //Errors are not set at all. Return true.
291
  return true;
292
  }
293
+
294
  return count($this->errors) < 1;
295
  }
296
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://simple-membership-plugin.com/
4
  Tags: member, members, members only, membership, memberships, register, WordPress membership plugin, content, content protection, paypal, restrict, restrict access, Restrict content, admin, access control, subscription, teaser, protection, profile, login, login page, bbpress, stripe, braintree
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
- Stable tag: 3.9.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -158,6 +158,9 @@ https://simple-membership-plugin.com/
158
 
159
  == Changelog ==
160
 
 
 
 
161
  = 3.9.8 =
162
  - Added a new action hook 'swpm_validate_login_hash_mismatch'
163
  - Ability to manually add a transaction record in the Payments menu of the plugin
4
  Tags: member, members, members only, membership, memberships, register, WordPress membership plugin, content, content protection, paypal, restrict, restrict access, Restrict content, admin, access control, subscription, teaser, protection, profile, login, login page, bbpress, stripe, braintree
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
+ Stable tag: 3.9.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
158
 
159
  == Changelog ==
160
 
161
+ = 3.9.9 =
162
+ - Added an enhancement to accept empty address value and force updating (when admin updates the address of a member profile from admin interface).
163
+
164
  = 3.9.8 =
165
  - Added a new action hook 'swpm_validate_login_hash_mismatch'
166
  - Ability to manually add a transaction record in the Payments menu of the plugin
simple-wp-membership.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
- Version: 3.9.8
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
@@ -19,7 +19,7 @@ include_once('classes/class.simple-wp-membership.php');
19
  include_once('classes/class.swpm-cronjob.php');
20
  include_once('swpm-compat.php');
21
 
22
- define('SIMPLE_WP_MEMBERSHIP_VER', '3.9.8');
23
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.3');
24
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
25
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
+ Version: 3.9.9
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
19
  include_once('classes/class.swpm-cronjob.php');
20
  include_once('swpm-compat.php');
21
 
22
+ define('SIMPLE_WP_MEMBERSHIP_VER', '3.9.9');
23
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.3');
24
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
25
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');