Simple Membership - Version 3.7.4

Version Description

  • Stripe Subscription now considers plan trial period settings.
  • Added CSS class names to the fields in the admin add/edit members interface.
  • Added more translatable strings to the POT file.
  • WordPress 5.0 compatibility
Download this release

Release Info

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

Code changes from version 3.7.0 to 3.7.4

classes/class.simple-wp-membership.php CHANGED
@@ -35,10 +35,10 @@ include_once('shortcode-related/class.swpm-shortcodes-handler.php');
35
  class SimpleWpMembership {
36
 
37
  public function __construct() {
38
-
39
  new SwpmShortcodesHandler(); //Tackle the shortcode definitions and implementation.
40
  new SwpmSelfActionHandler(); //Tackle the self action hook handling.
41
-
42
  add_action('admin_menu', array(&$this, 'menu'));
43
  add_action('init', array(&$this, 'init_hook'));
44
  add_action('wp_loaded', array(&$this, 'handle_wp_loaded_tasks'));
@@ -64,11 +64,12 @@ class SimpleWpMembership {
64
  add_action('wp_enqueue_scripts', array(&$this, 'front_library'));
65
  add_action('load-toplevel_page_simple_wp_membership', array(&$this, 'admin_library'));
66
  add_action('load-wp-membership_page_simple_wp_membership_levels', array(&$this, 'admin_library'));
67
- add_action('profile_update', array(&$this, 'sync_with_wp_profile'), 10, 2);
 
68
  add_action('wp_logout', array(&$this, 'wp_logout'));
69
- add_action('wp_authenticate', array(&$this, 'wp_authenticate_handler'), 1, 2);
70
  add_action('swpm_logout', array(&$this, 'swpm_do_user_logout'));
71
  add_action('user_register', array(&$this, 'swpm_handle_wp_user_registration'));
 
72
 
73
  //AJAX hooks
74
  add_action('wp_ajax_swpm_validate_email', 'SwpmAjax::validate_email_ajax');
@@ -219,26 +220,26 @@ class SimpleWpMembership {
219
  }
220
 
221
  public static function swpm_login($username, $pass, $rememberme = true) {
222
- if (is_user_logged_in()) {
223
  $current_user = wp_get_current_user();
224
- SwpmLog::log_auth_debug("static function swpm_login(). User is logged in. WP Username: ". $current_user->user_login, true);
225
  if ($current_user->user_login == $username) {
226
  return;
227
  }
228
  }
229
- SwpmLog::log_auth_debug("Trying wp_signon() with username: ". $username, true);
230
  $user_obj = wp_signon(array('user_login' => $username, 'user_password' => $pass, 'remember' => $rememberme), is_ssl());
231
  if ($user_obj instanceof WP_User) {
232
  wp_set_current_user($user_obj->ID, $user_obj->user_login);
233
- SwpmLog::log_auth_debug("Setting current WP user to: ". $user_obj->user_login, true);
234
  } else {
235
  SwpmLog::log_auth_debug("wp_signon() failed for the corresponding WP user account.", false);
236
- if( is_wp_error( $user_obj ) ) {
237
  //SwpmLog::log_auth_debug("Error Message: ". $user_obj->get_error_message(), false);
238
  $force_wp_user_sync = SwpmSettings::get_instance()->get_value('force-wp-user-sync');
239
  if (!empty($force_wp_user_sync)) {
240
  //Force WP user login sync is enabled. Show error and exit out since the WP user login failed.
241
- $error_msg = SwpmUtils::_("Error! This site has the force WP user login feature enabled in the settings. We could not find a WP user record for the given username: "). $username;
242
  $error_msg .= "<br /><br />" . SwpmUtils::_("This error is triggered when a member account doesn't have a corresponding WP user account. So the plugin fails to log the user into the WP User system.");
243
  $error_msg .= "<br /><br />" . SwpmUtils::_("Contact the site admin and request them to check your username in the WP Users menu to see what happened with the WP user entry of your account.");
244
  $error_msg .= "<br /><br />" . SwpmUtils::_("The site admin can disable the Force WP User Synchronization feature in the settings to disable this feature and this error will go away.");
@@ -247,7 +248,15 @@ class SimpleWpMembership {
247
  }
248
  }
249
  }
250
-
 
 
 
 
 
 
 
 
251
  SwpmLog::log_auth_debug("Triggering swpm_after_login hook.", true);
252
  do_action('swpm_after_login');
253
  if (!SwpmUtils::is_ajax()) {
@@ -264,16 +273,37 @@ class SimpleWpMembership {
264
  }
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  public function wp_authenticate_handler($username, $password) {
268
-
269
  $auth = SwpmAuth::get_instance();
270
  if (($auth->is_logged_in() && ($auth->userData->user_name == $username))) {
271
- SwpmLog::log_auth_debug('wp_authenticate action. User with username: '.$username.'is already logged in.', true);
272
  return;
273
  }
274
  if (!empty($username)) {
275
  SwpmLog::log_auth_debug('wp_authenticate action. Handling login for username: ' . $username, true);
276
  $auth->login($username, $password, true);
 
 
 
 
 
277
  }
278
  }
279
 
@@ -289,7 +319,7 @@ class SimpleWpMembership {
289
  }
290
  return ob_get_clean();
291
  }
292
-
293
  public function wp_logout() {
294
  $auth = SwpmAuth::get_instance();
295
  if ($auth->is_logged_in()) {
@@ -313,9 +343,9 @@ class SimpleWpMembership {
313
  $profile['last_name'] = $wp_user_data->user_lastname;
314
  $wpdb->update($wpdb->prefix . "swpm_members_tbl", $profile, array('member_id' => $profile['member_id']));
315
  }
316
-
317
  function swpm_handle_wp_user_registration($user_id) {
318
-
319
  $swpm_settings_obj = SwpmSettings::get_instance();
320
  $enable_auto_create_swpm_members = $swpm_settings_obj->get_value('enable-auto-create-swpm-members');
321
  $default_level = $swpm_settings_obj->get_value('auto-create-default-membership-level');
@@ -324,10 +354,10 @@ class SimpleWpMembership {
324
  if (empty($enable_auto_create_swpm_members)) {
325
  return;
326
  }
327
- if (empty($default_level)){
328
  return;
329
  }
330
-
331
  $user_info = get_userdata($user_id);
332
  if (SwpmMemberUtils::get_user_by_user_name($user_info->user_login)) {
333
  SwpmLog::log_simple_debug("swpm_handle_wp_user_registration() - SWPM member account with this username already exists! No new account will be created for this user.", false);
@@ -471,8 +501,8 @@ class SimpleWpMembership {
471
 
472
  // The actual fields for data entry
473
  echo '<h4>' . __("Do you want to protect this content?", 'simple-membership') . '</h4>';
474
- echo '<input type="radio" ' . ((!$is_protected) ? 'checked' : "") . ' name="swpm_protect_post" value="1" /> '. SwpmUtils::_('No, Do not protect this content.') . '<br/>';
475
- echo '<input type="radio" ' . (($is_protected) ? 'checked' : "") . ' name="swpm_protect_post" value="2" /> '. SwpmUtils::_('Yes, Protect this content.') . '<br/>';
476
  echo $protection_obj->get_last_message();
477
 
478
  echo '<h4>' . __("Select the membership level that can access this content:", 'simple-membership') . "</h4>";
@@ -572,11 +602,11 @@ class SimpleWpMembership {
572
  $init_tasks->do_init_tasks();
573
  }
574
 
575
- public function handle_wp_loaded_tasks(){
576
  $wp_loaded_tasks = new SwpmWpLoadedTasks();
577
  $wp_loaded_tasks->do_wp_loaded_tasks();
578
  }
579
-
580
  public function admin_library() {
581
  //Only loaded on selective swpm admin menu page rendering.
582
  $this->common_library();
35
  class SimpleWpMembership {
36
 
37
  public function __construct() {
38
+
39
  new SwpmShortcodesHandler(); //Tackle the shortcode definitions and implementation.
40
  new SwpmSelfActionHandler(); //Tackle the self action hook handling.
41
+
42
  add_action('admin_menu', array(&$this, 'menu'));
43
  add_action('init', array(&$this, 'init_hook'));
44
  add_action('wp_loaded', array(&$this, 'handle_wp_loaded_tasks'));
64
  add_action('wp_enqueue_scripts', array(&$this, 'front_library'));
65
  add_action('load-toplevel_page_simple_wp_membership', array(&$this, 'admin_library'));
66
  add_action('load-wp-membership_page_simple_wp_membership_levels', array(&$this, 'admin_library'));
67
+
68
+ add_action('wp_authenticate', array(&$this, 'wp_authenticate_handler'), 1, 2);
69
  add_action('wp_logout', array(&$this, 'wp_logout'));
 
70
  add_action('swpm_logout', array(&$this, 'swpm_do_user_logout'));
71
  add_action('user_register', array(&$this, 'swpm_handle_wp_user_registration'));
72
+ add_action('profile_update', array(&$this, 'sync_with_wp_profile'), 10, 2);
73
 
74
  //AJAX hooks
75
  add_action('wp_ajax_swpm_validate_email', 'SwpmAjax::validate_email_ajax');
220
  }
221
 
222
  public static function swpm_login($username, $pass, $rememberme = true) {
223
+ if (is_user_logged_in()) {
224
  $current_user = wp_get_current_user();
225
+ SwpmLog::log_auth_debug("static function swpm_login(). User is logged in. WP Username: " . $current_user->user_login, true);
226
  if ($current_user->user_login == $username) {
227
  return;
228
  }
229
  }
230
+ SwpmLog::log_auth_debug("Trying wp_signon() with username: " . $username, true);
231
  $user_obj = wp_signon(array('user_login' => $username, 'user_password' => $pass, 'remember' => $rememberme), is_ssl());
232
  if ($user_obj instanceof WP_User) {
233
  wp_set_current_user($user_obj->ID, $user_obj->user_login);
234
+ SwpmLog::log_auth_debug("Setting current WP user to: " . $user_obj->user_login, true);
235
  } else {
236
  SwpmLog::log_auth_debug("wp_signon() failed for the corresponding WP user account.", false);
237
+ if (is_wp_error($user_obj)) {
238
  //SwpmLog::log_auth_debug("Error Message: ". $user_obj->get_error_message(), false);
239
  $force_wp_user_sync = SwpmSettings::get_instance()->get_value('force-wp-user-sync');
240
  if (!empty($force_wp_user_sync)) {
241
  //Force WP user login sync is enabled. Show error and exit out since the WP user login failed.
242
+ $error_msg = SwpmUtils::_("Error! This site has the force WP user login feature enabled in the settings. We could not find a WP user record for the given username: ") . $username;
243
  $error_msg .= "<br /><br />" . SwpmUtils::_("This error is triggered when a member account doesn't have a corresponding WP user account. So the plugin fails to log the user into the WP User system.");
244
  $error_msg .= "<br /><br />" . SwpmUtils::_("Contact the site admin and request them to check your username in the WP Users menu to see what happened with the WP user entry of your account.");
245
  $error_msg .= "<br /><br />" . SwpmUtils::_("The site admin can disable the Force WP User Synchronization feature in the settings to disable this feature and this error will go away.");
248
  }
249
  }
250
  }
251
+
252
+ $proceed_after_auth = apply_filters('swpm_login_auth_completed_filter', true);
253
+
254
+ if (!$proceed_after_auth) {
255
+ $auth = SwpmAuth::get_instance();
256
+ $auth->logout();
257
+ return;
258
+ }
259
+
260
  SwpmLog::log_auth_debug("Triggering swpm_after_login hook.", true);
261
  do_action('swpm_after_login');
262
  if (!SwpmUtils::is_ajax()) {
273
  }
274
  }
275
 
276
+ /* This function can be used to authenticate a member using currently logged in wp user. */
277
+ public function set_current_user_handler() {
278
+ $auth = SwpmAuth::get_instance();
279
+ if ($auth->is_logged_in()) {
280
+ return;
281
+ }
282
+ $user = wp_get_current_user();
283
+ if (empty($user) || $user->ID === 0) {
284
+ return false;
285
+ }
286
+ SwpmLog::log_auth_debug('set_current_user action. Attempting to login user ' . $user->user_login, true);
287
+ //remove hook in order for it to not be called several times in the process
288
+ remove_action('set_current_user', array($this, 'set_current_user_handler'));
289
+ $auth->login_to_swpm_using_wp_user($user);
290
+ }
291
+
292
  public function wp_authenticate_handler($username, $password) {
293
+
294
  $auth = SwpmAuth::get_instance();
295
  if (($auth->is_logged_in() && ($auth->userData->user_name == $username))) {
296
+ SwpmLog::log_auth_debug('wp_authenticate action. User with username: ' . $username . ' is already logged in.', true);
297
  return;
298
  }
299
  if (!empty($username)) {
300
  SwpmLog::log_auth_debug('wp_authenticate action. Handling login for username: ' . $username, true);
301
  $auth->login($username, $password, true);
302
+ } else {
303
+ //empty username can mean some plugin trying to login WP user using its own methods.
304
+ //Let's add hook for set_current_user action and let it handle the login if needed.
305
+ SwpmLog::log_auth_debug('wp_authenticate action. Empty username provided. Adding set_current_username hook to catch potential login attempt.', true);
306
+ add_action('set_current_user', array($this, 'set_current_user_handler'));
307
  }
308
  }
309
 
319
  }
320
  return ob_get_clean();
321
  }
322
+
323
  public function wp_logout() {
324
  $auth = SwpmAuth::get_instance();
325
  if ($auth->is_logged_in()) {
343
  $profile['last_name'] = $wp_user_data->user_lastname;
344
  $wpdb->update($wpdb->prefix . "swpm_members_tbl", $profile, array('member_id' => $profile['member_id']));
345
  }
346
+
347
  function swpm_handle_wp_user_registration($user_id) {
348
+
349
  $swpm_settings_obj = SwpmSettings::get_instance();
350
  $enable_auto_create_swpm_members = $swpm_settings_obj->get_value('enable-auto-create-swpm-members');
351
  $default_level = $swpm_settings_obj->get_value('auto-create-default-membership-level');
354
  if (empty($enable_auto_create_swpm_members)) {
355
  return;
356
  }
357
+ if (empty($default_level)) {
358
  return;
359
  }
360
+
361
  $user_info = get_userdata($user_id);
362
  if (SwpmMemberUtils::get_user_by_user_name($user_info->user_login)) {
363
  SwpmLog::log_simple_debug("swpm_handle_wp_user_registration() - SWPM member account with this username already exists! No new account will be created for this user.", false);
501
 
502
  // The actual fields for data entry
503
  echo '<h4>' . __("Do you want to protect this content?", 'simple-membership') . '</h4>';
504
+ echo '<input type="radio" ' . ((!$is_protected) ? 'checked' : "") . ' name="swpm_protect_post" value="1" /> ' . SwpmUtils::_('No, Do not protect this content.') . '<br/>';
505
+ echo '<input type="radio" ' . (($is_protected) ? 'checked' : "") . ' name="swpm_protect_post" value="2" /> ' . SwpmUtils::_('Yes, Protect this content.') . '<br/>';
506
  echo $protection_obj->get_last_message();
507
 
508
  echo '<h4>' . __("Select the membership level that can access this content:", 'simple-membership') . "</h4>";
602
  $init_tasks->do_init_tasks();
603
  }
604
 
605
+ public function handle_wp_loaded_tasks() {
606
  $wp_loaded_tasks = new SwpmWpLoadedTasks();
607
  $wp_loaded_tasks->do_wp_loaded_tasks();
608
  }
609
+
610
  public function admin_library() {
611
  //Only loaded on selective swpm admin menu page rendering.
612
  $this->common_library();
classes/class.swpm-auth.php CHANGED
@@ -48,7 +48,7 @@ class SwpmAuth {
48
  $wp_profile_page = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL . '/wp-admin/profile.php';
49
  $error_msg = '';
50
  $error_msg .= '<p>' . SwpmUtils::_('Warning! Simple Membership plugin cannot process this login request to prevent you from getting logged out of WP Admin accidentally.') . '</p>';
51
- $error_msg .= '<p><a href="'.$wp_profile_page.'" target="_blank">' . SwpmUtils::_('Click here') .'</a>'. SwpmUtils::_(' to see the profile you are currently logged into in this browser.') . '</p>';
52
  $error_msg .= '<p>' . SwpmUtils::_('You are logged into the site as an ADMIN user in this browser. First, logout from WP Admin then you will be able to log in as a normal member.') . '</p>';
53
  $error_msg .= '<p>' . SwpmUtils::_('Alternatively, you can use a different browser (where you are not logged-in as ADMIN) to test the membership login.') . '</p>';
54
  $error_msg .= '<p>' . SwpmUtils::_('Your normal visitors or members will never see this message. This message is ONLY for ADMIN user.') . '</p>';
@@ -176,6 +176,24 @@ class SwpmAuth {
176
  return $this->check_password($password, $this->get('password'));
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  public function login($user, $pass, $remember = '', $secure = '') {
180
  SwpmLog::log_auth_debug("SwpmAuth::login()", true);
181
  if ($this->isLoggedIn) {
@@ -212,7 +230,7 @@ class SwpmAuth {
212
  }
213
 
214
  $expire = apply_filters('swpm_auth_cookie_expiry_value', $expire);
215
-
216
  setcookie("swpm_in_use", "swpm_in_use", $expire, COOKIEPATH, COOKIE_DOMAIN);
217
 
218
  $expiration_timestamp = SwpmUtils::get_expiration_timestamp($this->userData);
@@ -270,7 +288,7 @@ class SwpmAuth {
270
  if ($hmac != $hash) {
271
  $this->lastStatusMsg = SwpmUtils::_("Please login again.");
272
  SwpmLog::log_auth_debug("validate() - Bad Hash", true);
273
- wp_logout();//Force logout of WP user session to clear the bad hash.
274
  return false;
275
  }
276
 
48
  $wp_profile_page = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL . '/wp-admin/profile.php';
49
  $error_msg = '';
50
  $error_msg .= '<p>' . SwpmUtils::_('Warning! Simple Membership plugin cannot process this login request to prevent you from getting logged out of WP Admin accidentally.') . '</p>';
51
+ $error_msg .= '<p><a href="' . $wp_profile_page . '" target="_blank">' . SwpmUtils::_('Click here') . '</a>' . SwpmUtils::_(' to see the profile you are currently logged into in this browser.') . '</p>';
52
  $error_msg .= '<p>' . SwpmUtils::_('You are logged into the site as an ADMIN user in this browser. First, logout from WP Admin then you will be able to log in as a normal member.') . '</p>';
53
  $error_msg .= '<p>' . SwpmUtils::_('Alternatively, you can use a different browser (where you are not logged-in as ADMIN) to test the membership login.') . '</p>';
54
  $error_msg .= '<p>' . SwpmUtils::_('Your normal visitors or members will never see this message. This message is ONLY for ADMIN user.') . '</p>';
176
  return $this->check_password($password, $this->get('password'));
177
  }
178
 
179
+ public function login_to_swpm_using_wp_user($user) {
180
+ if ($this->isLoggedIn) {
181
+ return false;
182
+ }
183
+ $email = $user->user_email;
184
+ $member = SwpmMemberUtils::get_user_by_email($email);
185
+ if (empty($member)) {
186
+ //There is no swpm profile with this email.
187
+ return false;
188
+ }
189
+ $this->userData = $member;
190
+ $this->isLoggedIn = true;
191
+ $this->set_cookie();
192
+ SwpmLog::log_auth_debug('Member has been logged in using WP User object.', true);
193
+ $this->check_constraints();
194
+ return true;
195
+ }
196
+
197
  public function login($user, $pass, $remember = '', $secure = '') {
198
  SwpmLog::log_auth_debug("SwpmAuth::login()", true);
199
  if ($this->isLoggedIn) {
230
  }
231
 
232
  $expire = apply_filters('swpm_auth_cookie_expiry_value', $expire);
233
+
234
  setcookie("swpm_in_use", "swpm_in_use", $expire, COOKIEPATH, COOKIE_DOMAIN);
235
 
236
  $expiration_timestamp = SwpmUtils::get_expiration_timestamp($this->userData);
288
  if ($hmac != $hash) {
289
  $this->lastStatusMsg = SwpmUtils::_("Please login again.");
290
  SwpmLog::log_auth_debug("validate() - Bad Hash", true);
291
+ wp_logout(); //Force logout of WP user session to clear the bad hash.
292
  return false;
293
  }
294
 
classes/class.swpm-init-time-tasks.php CHANGED
@@ -48,9 +48,6 @@ class SwpmInitTimeTasks {
48
  $this->admin_init();
49
  }
50
  }
51
-
52
- //IPN listener
53
- $this->swpm_ipn_listener();
54
  }
55
 
56
  public function admin_init() {
@@ -182,44 +179,4 @@ class SwpmInitTimeTasks {
182
  }
183
  }
184
 
185
- /* Payment Gateway IPN listener */
186
-
187
- public function swpm_ipn_listener() {
188
-
189
- //Listen and handle PayPal IPN
190
- $swpm_process_ipn = filter_input(INPUT_GET, 'swpm_process_ipn');
191
- if ($swpm_process_ipn == '1') {
192
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm_handle_pp_ipn.php');
193
- exit;
194
- }
195
-
196
- //Listen and handle Stripe Buy Now IPN
197
- $swpm_process_stripe_buy_now = filter_input(INPUT_GET, 'swpm_process_stripe_buy_now');
198
- if ($swpm_process_stripe_buy_now == '1') {
199
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-stripe-buy-now-ipn.php');
200
- exit;
201
- }
202
-
203
- //Listen and handle Stripe Subscription IPN
204
- $swpm_process_stripe_subscription = filter_input(INPUT_GET, 'swpm_process_stripe_subscription');
205
- if ($swpm_process_stripe_subscription == '1') {
206
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-stripe-subscription-ipn.php');
207
- exit;
208
- }
209
-
210
- //Listen and handle Braintree Buy Now IPN
211
- $swpm_process_braintree_buy_now = filter_input(INPUT_GET, 'swpm_process_braintree_buy_now');
212
- if ($swpm_process_braintree_buy_now == '1') {
213
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-braintree-buy-now-ipn.php');
214
- exit;
215
- }
216
-
217
- //Listen and handle Braintree Buy Now IPN
218
- if (wp_doing_ajax()) {
219
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-smart-checkout-ipn.php');
220
- add_action('wp_ajax_swpm_process_pp_smart_checkout', 'swpm_pp_smart_checkout_ajax_hanlder');
221
- add_action('wp_ajax_nopriv_swpm_process_pp_smart_checkout', 'swpm_pp_smart_checkout_ajax_hanlder');
222
- }
223
- }
224
-
225
  }
48
  $this->admin_init();
49
  }
50
  }
 
 
 
51
  }
52
 
53
  public function admin_init() {
179
  }
180
  }
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
classes/class.swpm-installation.php CHANGED
@@ -233,6 +233,10 @@ class SwpmInstallation {
233
  //Create the mandatory pages (if they are not there)
234
  SwpmMiscUtils::create_mandatory_wp_pages();
235
  //End of page creation
 
 
 
 
236
  $settings->set_value('reg-complete-mail-subject', stripslashes($reg_email_subject))
237
  ->set_value('reg-complete-mail-body', stripslashes($reg_email_body))
238
  ->set_value('reg-prompt-complete-mail-subject', stripslashes($reg_prompt_email_subject))
@@ -243,7 +247,7 @@ class SwpmInstallation {
243
  ->set_value('reset-mail-body', stripslashes($reset_email_body))
244
  ->set_value('account-change-email-subject', stripslashes($status_change_email_subject))
245
  ->set_value('account-change-email-body', stripslashes($status_change_email_body))
246
- ->set_value('email-from', trim(get_option('admin_email')));
247
 
248
  $settings->set_value('reg-complete-mail-subject-admin', stripslashes($reg_email_subject_admin));
249
  $settings->set_value('reg-complete-mail-body-admin', stripslashes($reg_email_body_admin));
233
  //Create the mandatory pages (if they are not there)
234
  SwpmMiscUtils::create_mandatory_wp_pages();
235
  //End of page creation
236
+
237
+ $example_from_address = 'hello@' . SwpmMiscUtils::get_home_url_without_http_and_www();
238
+ $senders_email_address = get_bloginfo('name') . " <" . $example_from_address . ">";
239
+
240
  $settings->set_value('reg-complete-mail-subject', stripslashes($reg_email_subject))
241
  ->set_value('reg-complete-mail-body', stripslashes($reg_email_body))
242
  ->set_value('reg-prompt-complete-mail-subject', stripslashes($reg_prompt_email_subject))
247
  ->set_value('reset-mail-body', stripslashes($reset_email_body))
248
  ->set_value('account-change-email-subject', stripslashes($status_change_email_subject))
249
  ->set_value('account-change-email-body', stripslashes($status_change_email_body))
250
+ ->set_value('email-from', $senders_email_address);
251
 
252
  $settings->set_value('reg-complete-mail-subject-admin', stripslashes($reg_email_subject_admin));
253
  $settings->set_value('reg-complete-mail-body-admin', stripslashes($reg_email_body_admin));
classes/class.swpm-self-action-handler.php CHANGED
@@ -10,6 +10,18 @@ class SwpmSelfActionHandler {
10
  add_action('swpm_membership_level_changed', array(&$this, 'handle_membership_level_changed_action'));
11
 
12
  add_filter('swpm_after_logout_redirect_url', array(&$this, 'handle_after_logout_redirection'));
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
  public function handle_after_logout_redirection($redirect_url){
10
  add_action('swpm_membership_level_changed', array(&$this, 'handle_membership_level_changed_action'));
11
 
12
  add_filter('swpm_after_logout_redirect_url', array(&$this, 'handle_after_logout_redirection'));
13
+ add_filter('swpm_auth_cookie_expiry_value', array(&$this, 'handle_auth_cookie_expiry_value'));
14
+ }
15
+
16
+ public function handle_auth_cookie_expiry_value($expire){
17
+
18
+ $logout_member_on_browser_close = SwpmSettings::get_instance()->get_value('logout-member-on-browser-close');
19
+ if (!empty($logout_member_on_browser_close)) {
20
+ //This feature is enabled.
21
+ $expire = 0;
22
+ }
23
+
24
+ return $expire;
25
  }
26
 
27
  public function handle_after_logout_redirection($redirect_url){
classes/class.swpm-settings.php CHANGED
@@ -63,7 +63,7 @@ class SwpmSettings {
63
  add_settings_field('show-adminbar-admin-only', SwpmUtils::_('Show Adminbar to Admin'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'show-adminbar-admin-only',
64
  'message' => SwpmUtils::_('Use this option if you want to show the admin toolbar to admin users only. The admin toolbar will be hidden for all other users.')));
65
  add_settings_field('disable-access-to-wp-dashboard', SwpmUtils::_('Disable Access to WP Dashboard'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'disable-access-to-wp-dashboard',
66
- 'message' => SwpmUtils::_('WordPress allows a sandard wp user to be able to go to the wp-admin URL and access his profile from the wp dashbaord. Using this option will prevent any non admin users from going to the wp dashboard.')));
67
 
68
  add_settings_field('default-account-status', SwpmUtils::_('Default Account Status'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'default-account-status',
69
  'options' => SwpmUtils::get_account_state_options(),
@@ -196,7 +196,10 @@ class SwpmSettings {
196
 
197
  add_settings_field('after-logout-redirection-url', SwpmUtils::_('After Logout Redirect URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'after-logout-redirection-url',
198
  'message' => SwpmUtils::_('You can enter an URL here to redirect the members to this page after they click the logout link to logout from your site.')) );
199
-
 
 
 
200
  add_settings_field('allow-account-deletion', SwpmUtils::_('Allow Account Deletion'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'allow-account-deletion',
201
  'message' => SwpmUtils::_('Allow users to delete their accounts.')));
202
 
@@ -486,6 +489,7 @@ class SwpmSettings {
486
  }
487
  $output = $this->settings;
488
  $output['enable-expired-account-login'] = isset($input['enable-expired-account-login']) ? esc_attr($input['enable-expired-account-login']) : "";
 
489
  $output['allow-account-deletion'] = isset($input['allow-account-deletion']) ? esc_attr($input['allow-account-deletion']) : "";
490
  $output['use-wordpress-timezone'] = isset($input['use-wordpress-timezone']) ? esc_attr($input['use-wordpress-timezone']) : "";
491
  $output['delete-pending-account'] = isset($input['delete-pending-account']) ? esc_attr($input['delete-pending-account']) : 0;
@@ -495,7 +499,7 @@ class SwpmSettings {
495
  $output['after-logout-redirection-url'] = esc_url($input['after-logout-redirection-url']);
496
  $output['force-strong-passwords'] = isset($input['force-strong-passwords']) ? esc_attr($input['force-strong-passwords']) : "";
497
  $output['auto-login-after-rego'] = isset($input['auto-login-after-rego']) ? esc_attr($input['auto-login-after-rego']) : "";
498
- $output['force-wp-user-sync'] = isset($input['force-wp-user-sync']) ? esc_attr($input['force-wp-user-sync']) : "";
499
 
500
  //Auto create swpm user related settings
501
  $output['enable-auto-create-swpm-members'] = isset($input['enable-auto-create-swpm-members']) ? esc_attr($input['enable-auto-create-swpm-members']) : "";
63
  add_settings_field('show-adminbar-admin-only', SwpmUtils::_('Show Adminbar to Admin'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'show-adminbar-admin-only',
64
  'message' => SwpmUtils::_('Use this option if you want to show the admin toolbar to admin users only. The admin toolbar will be hidden for all other users.')));
65
  add_settings_field('disable-access-to-wp-dashboard', SwpmUtils::_('Disable Access to WP Dashboard'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'disable-access-to-wp-dashboard',
66
+ 'message' => SwpmUtils::_('WordPress allows a standard wp user to be able to go to the wp-admin URL and access his profile from the wp dashbaord. Using this option will prevent any non admin users from going to the wp dashboard.')));
67
 
68
  add_settings_field('default-account-status', SwpmUtils::_('Default Account Status'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'default-account-status',
69
  'options' => SwpmUtils::get_account_state_options(),
196
 
197
  add_settings_field('after-logout-redirection-url', SwpmUtils::_('After Logout Redirect URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'after-logout-redirection-url',
198
  'message' => SwpmUtils::_('You can enter an URL here to redirect the members to this page after they click the logout link to logout from your site.')) );
199
+
200
+ add_settings_field('logout-member-on-browser-close', SwpmUtils::_('Logout Member on Browser Close'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'logout-member-on-browser-close',
201
+ 'message' => SwpmUtils::_('Enable this option if you want the member to be logged out of the account when he closes the browser.')));
202
+
203
  add_settings_field('allow-account-deletion', SwpmUtils::_('Allow Account Deletion'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'allow-account-deletion',
204
  'message' => SwpmUtils::_('Allow users to delete their accounts.')));
205
 
489
  }
490
  $output = $this->settings;
491
  $output['enable-expired-account-login'] = isset($input['enable-expired-account-login']) ? esc_attr($input['enable-expired-account-login']) : "";
492
+ $output['logout-member-on-browser-close'] = isset($input['logout-member-on-browser-close']) ? esc_attr($input['logout-member-on-browser-close']) : "";
493
  $output['allow-account-deletion'] = isset($input['allow-account-deletion']) ? esc_attr($input['allow-account-deletion']) : "";
494
  $output['use-wordpress-timezone'] = isset($input['use-wordpress-timezone']) ? esc_attr($input['use-wordpress-timezone']) : "";
495
  $output['delete-pending-account'] = isset($input['delete-pending-account']) ? esc_attr($input['delete-pending-account']) : 0;
499
  $output['after-logout-redirection-url'] = esc_url($input['after-logout-redirection-url']);
500
  $output['force-strong-passwords'] = isset($input['force-strong-passwords']) ? esc_attr($input['force-strong-passwords']) : "";
501
  $output['auto-login-after-rego'] = isset($input['auto-login-after-rego']) ? esc_attr($input['auto-login-after-rego']) : "";
502
+ $output['force-wp-user-sync'] = isset($input['force-wp-user-sync']) ? esc_attr($input['force-wp-user-sync']) : "";
503
 
504
  //Auto create swpm user related settings
505
  $output['enable-auto-create-swpm-members'] = isset($input['enable-auto-create-swpm-members']) ? esc_attr($input['enable-auto-create-swpm-members']) : "";
classes/class.swpm-utils-misc.php CHANGED
@@ -181,6 +181,22 @@ class SwpmMiscUtils {
181
  return $pageURL;
182
  }
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  public static function replace_dynamic_tags($msg_body, $member_id, $additional_args = '') {
185
  $settings = SwpmSettings::get_instance();
186
  $user_record = SwpmMemberUtils::get_user_by_id($member_id);
@@ -340,7 +356,7 @@ class SwpmMiscUtils {
340
  $countries = array("Afghanistan", "Albania", "Algeria", "Andorra",
341
  "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia",
342
  "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados",
343
- "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bonaire",
344
  "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria",
345
  "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde",
346
  "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros",
181
  return $pageURL;
182
  }
183
 
184
+ /*
185
+ * Returns just the domain name. Something like example.com
186
+ */
187
+
188
+ public static function get_home_url_without_http_and_www() {
189
+ $site_url = get_site_url();
190
+ $parse = parse_url($site_url);
191
+ $site_url = $parse['host'];
192
+ $site_url = str_replace('https://', '', $site_url);
193
+ $site_url = str_replace('http://', '', $site_url);
194
+ if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $site_url, $regs)) {
195
+ $site_url = $regs['domain'];
196
+ }
197
+ return $site_url;
198
+ }
199
+
200
  public static function replace_dynamic_tags($msg_body, $member_id, $additional_args = '') {
201
  $settings = SwpmSettings::get_instance();
202
  $user_record = SwpmMemberUtils::get_user_by_id($member_id);
356
  $countries = array("Afghanistan", "Albania", "Algeria", "Andorra",
357
  "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia",
358
  "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados",
359
+ "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bonaire",
360
  "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria",
361
  "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde",
362
  "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros",
classes/class.swpm-wp-loaded-tasks.php CHANGED
@@ -13,6 +13,9 @@ class SwpmWpLoadedTasks {
13
  public function do_wp_loaded_tasks() {
14
  $this->synchronise_swpm_logout_for_wp_users();
15
 
 
 
 
16
  }
17
 
18
  /*
@@ -37,4 +40,44 @@ class SwpmWpLoadedTasks {
37
  }
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
13
  public function do_wp_loaded_tasks() {
14
  $this->synchronise_swpm_logout_for_wp_users();
15
 
16
+ //IPN listener
17
+ $this->swpm_ipn_listener();
18
+
19
  }
20
 
21
  /*
40
  }
41
  }
42
 
43
+ /* Payment Gateway IPN listener */
44
+
45
+ public function swpm_ipn_listener() {
46
+
47
+ //Listen and handle PayPal IPN
48
+ $swpm_process_ipn = filter_input(INPUT_GET, 'swpm_process_ipn');
49
+ if ($swpm_process_ipn == '1') {
50
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm_handle_pp_ipn.php');
51
+ exit;
52
+ }
53
+
54
+ //Listen and handle Stripe Buy Now IPN
55
+ $swpm_process_stripe_buy_now = filter_input(INPUT_GET, 'swpm_process_stripe_buy_now');
56
+ if ($swpm_process_stripe_buy_now == '1') {
57
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-stripe-buy-now-ipn.php');
58
+ exit;
59
+ }
60
+
61
+ //Listen and handle Stripe Subscription IPN
62
+ $swpm_process_stripe_subscription = filter_input(INPUT_GET, 'swpm_process_stripe_subscription');
63
+ if ($swpm_process_stripe_subscription == '1') {
64
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-stripe-subscription-ipn.php');
65
+ exit;
66
+ }
67
+
68
+ //Listen and handle Braintree Buy Now IPN
69
+ $swpm_process_braintree_buy_now = filter_input(INPUT_GET, 'swpm_process_braintree_buy_now');
70
+ if ($swpm_process_braintree_buy_now == '1') {
71
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-braintree-buy-now-ipn.php');
72
+ exit;
73
+ }
74
+
75
+ //Listen and handle smart paypal checkout IPN
76
+ if (wp_doing_ajax()) {
77
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm-smart-checkout-ipn.php');
78
+ add_action('wp_ajax_swpm_process_pp_smart_checkout', 'swpm_pp_smart_checkout_ajax_hanlder');
79
+ add_action('wp_ajax_nopriv_swpm_process_pp_smart_checkout', 'swpm_pp_smart_checkout_ajax_hanlder');
80
+ }
81
+ }
82
+
83
  }
images/addons/2fa-addon-icon.png ADDED
Binary file
images/addons/full-page-protection-addon.png ADDED
Binary file
ipn/swpm-smart-checkout-ipn.php CHANGED
@@ -42,6 +42,7 @@ class swpm_smart_checkout_ipn_handler {
42
  if ($payment_status != "Completed" && $payment_status != "Processed" && $payment_status != "Refunded" && $payment_status != "Reversed") {
43
  $error_msg .= 'Funds have not been cleared yet. Transaction will be processed when the funds clear!';
44
  $this->debug_log($error_msg, false);
 
45
  return false;
46
  }
47
  }
@@ -204,11 +205,13 @@ class swpm_smart_checkout_ipn_handler {
204
  $ipn['pay_id'] = $data['id'];
205
  $ipn['create_time'] = $data['create_time'];
206
  $ipn['txn_id'] = $data['transactions'][0]['related_resources'][0]['sale']['id'];
 
207
  $ipn['txn_type'] = 'smart_checkout';
208
  $ipn['payment_status'] = ucfirst($data['transactions'][0]['related_resources'][0]['sale']['state']);
209
  $ipn['transaction_subject'] = '';
210
  $ipn['mc_currency'] = $data['transactions'][0]['amount']['currency'];
211
  $ipn['mc_gross'] = $data['transactions'][0]['amount']['total'];
 
212
  $ipn['receiver_email'] = get_option('cart_paypal_email');
213
  //customer info
214
  $ipn['first_name'] = $data['payer']['payer_info']['first_name'];
@@ -219,16 +222,7 @@ class swpm_smart_checkout_ipn_handler {
219
  $ipn['address_state'] = $data['payer']['payer_info']['shipping_address']['state'];
220
  $ipn['address_zip'] = $data['payer']['payer_info']['shipping_address']['postal_code'];
221
  $ipn['address_country'] = $data['payer']['payer_info']['shipping_address']['country_code'];
222
- //items data
223
- $i = 1;
224
- foreach ($data['transactions'][0]['item_list']['items'] as $item) {
225
- $ipn['item_number' . $i] = '';
226
- $ipn['item_name' . $i] = $item['name'];
227
- $ipn['quantity' . $i] = $item['quantity'];
228
- $ipn['mc_gross_' . $i] = $item['price'] * $item['quantity'];
229
- $i ++;
230
- }
231
- $ipn['num_cart_items'] = $i - 1;
232
  $this->ipn_data = $ipn;
233
  return true;
234
  }
@@ -240,8 +234,8 @@ class swpm_smart_checkout_ipn_handler {
240
  $secret = get_post_meta($this->ipn_data['item_number'], 'pp_smart_checkout_test_sec', true);
241
  $api_base = 'https://api.sandbox.paypal.com';
242
  } else {
243
- $client_id = get_post_meta($this->ipn_data['button_id'], 'pp_smart_checkout_live_id', true);
244
- $secret = get_post_meta($this->ipn_data['button_id'], 'pp_smart_checkout_live_sec', true);
245
  $api_base = 'https://api.paypal.com';
246
  }
247
 
42
  if ($payment_status != "Completed" && $payment_status != "Processed" && $payment_status != "Refunded" && $payment_status != "Reversed") {
43
  $error_msg .= 'Funds have not been cleared yet. Transaction will be processed when the funds clear!';
44
  $this->debug_log($error_msg, false);
45
+ $this->debug_log(json_encode($this->ipn_data), false);
46
  return false;
47
  }
48
  }
205
  $ipn['pay_id'] = $data['id'];
206
  $ipn['create_time'] = $data['create_time'];
207
  $ipn['txn_id'] = $data['transactions'][0]['related_resources'][0]['sale']['id'];
208
+ $ipn['reason_code'] = !empty($data['transactions'][0]['related_resources'][0]['sale']['reason_code']) ? $data['transactions'][0]['related_resources'][0]['sale']['reason_code'] : '';
209
  $ipn['txn_type'] = 'smart_checkout';
210
  $ipn['payment_status'] = ucfirst($data['transactions'][0]['related_resources'][0]['sale']['state']);
211
  $ipn['transaction_subject'] = '';
212
  $ipn['mc_currency'] = $data['transactions'][0]['amount']['currency'];
213
  $ipn['mc_gross'] = $data['transactions'][0]['amount']['total'];
214
+ $ipn['quantity'] = 1;
215
  $ipn['receiver_email'] = get_option('cart_paypal_email');
216
  //customer info
217
  $ipn['first_name'] = $data['payer']['payer_info']['first_name'];
222
  $ipn['address_state'] = $data['payer']['payer_info']['shipping_address']['state'];
223
  $ipn['address_zip'] = $data['payer']['payer_info']['shipping_address']['postal_code'];
224
  $ipn['address_country'] = $data['payer']['payer_info']['shipping_address']['country_code'];
225
+
 
 
 
 
 
 
 
 
 
226
  $this->ipn_data = $ipn;
227
  return true;
228
  }
234
  $secret = get_post_meta($this->ipn_data['item_number'], 'pp_smart_checkout_test_sec', true);
235
  $api_base = 'https://api.sandbox.paypal.com';
236
  } else {
237
+ $client_id = get_post_meta($this->ipn_data['item_number'], 'pp_smart_checkout_live_id', true);
238
+ $secret = get_post_meta($this->ipn_data['item_number'], 'pp_smart_checkout_live_sec', true);
239
  $api_base = 'https://api.paypal.com';
240
  }
241
 
ipn/swpm-stripe-subscription-ipn.php CHANGED
@@ -33,7 +33,7 @@ class SwpmStripeSubscriptionIpnHandler {
33
  SwpmLog::log_simple_debug("Stripe Subscription Webhook received. Processing request...", true);
34
  //Let's form minimal ipn_data array for swpm_handle_subsc_cancel_stand_alone
35
  $customer = $event_json->data->object->customer;
36
- $subscr_id=$event_json->data->object->id;
37
  $ipn_data = array();
38
  $ipn_data['subscr_id'] = $subscr_id;
39
  $ipn_data['parent_txn_id'] = $customer;
@@ -98,6 +98,7 @@ class SwpmStripeSubscriptionIpnHandler {
98
  'email' => $stripe_email,
99
  'source' => $token,
100
  'plan' => $plan_id,
 
101
  ));
102
  } catch (Exception $e) {
103
  SwpmLog::log_simple_debug("Error occurred during Stripe Subscribe. " . $e->getMessage(), false);
33
  SwpmLog::log_simple_debug("Stripe Subscription Webhook received. Processing request...", true);
34
  //Let's form minimal ipn_data array for swpm_handle_subsc_cancel_stand_alone
35
  $customer = $event_json->data->object->customer;
36
+ $subscr_id = $event_json->data->object->id;
37
  $ipn_data = array();
38
  $ipn_data['subscr_id'] = $subscr_id;
39
  $ipn_data['parent_txn_id'] = $customer;
98
  'email' => $stripe_email,
99
  'source' => $token,
100
  'plan' => $plan_id,
101
+ 'trial_from_plan' => 'true',
102
  ));
103
  } catch (Exception $e) {
104
  SwpmLog::log_simple_debug("Error occurred during Stripe Subscribe. " . $e->getMessage(), false);
languages/simple-membership.pot CHANGED
@@ -1387,6 +1387,22 @@ msgstr ""
1387
  msgid "You are not logged-in as a member"
1388
  msgstr ""
1389
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1390
  #: views/add.php:15 views/admin_add.php:19 views/admin_edit.php:44
1391
  #: views/edit.php:22 views/login.php:17
1392
  msgid "Password"
@@ -2080,6 +2096,27 @@ msgstr ""
2080
  msgid "Subscribe Now"
2081
  msgstr ""
2082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2083
  #: Translation strings from addons
2084
 
2085
  #: === Form builder addon strings ===
1387
  msgid "You are not logged-in as a member"
1388
  msgstr ""
1389
 
1390
+ #: classes/shortcode-related/class.swpm-shortcodes-handler.php:113
1391
+ msgid "Logged in as: "
1392
+ msgstr ""
1393
+
1394
+ #: classes/shortcode-related/class.swpm-shortcodes-handler.php:121
1395
+ msgid "Login Here"
1396
+ msgstr ""
1397
+
1398
+ #: classes/shortcode-related/class.swpm-shortcodes-handler.php:122
1399
+ msgid "Not a member? "
1400
+ msgstr ""
1401
+
1402
+ #: classes/shortcode-related/class.swpm-shortcodes-handler.php:123
1403
+ msgid "Join Now"
1404
+ msgstr ""
1405
+
1406
  #: views/add.php:15 views/admin_add.php:19 views/admin_edit.php:44
1407
  #: views/edit.php:22 views/login.php:17
1408
  msgid "Password"
2096
  msgid "Subscribe Now"
2097
  msgstr ""
2098
 
2099
+ msgid "Delete Account"
2100
+ msgstr ""
2101
+
2102
+ msgid "You are about to delete an account. This will delete user data associated with this account. "
2103
+ msgstr ""
2104
+
2105
+ msgid "It will also delete associated WordPress user account."
2106
+ msgstr ""
2107
+
2108
+ msgid "(NOTE: for safety, we do not allow deletion of any associated WordPress account with administrator role)."
2109
+ msgstr ""
2110
+
2111
+ msgid "Continue?"
2112
+ msgstr ""
2113
+
2114
+ msgid "Password: "
2115
+ msgstr ""
2116
+
2117
+ msgid "Confirm Account Deletion"
2118
+ msgstr ""
2119
+
2120
  #: Translation strings from addons
2121
 
2122
  #: === Form builder addon strings ===
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: smp7, wp.insider
3
  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: 4.9
7
- Stable tag: 3.7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -92,6 +92,7 @@ You can create a free forum user account and ask your questions.
92
  * Option force the members to use strong password.
93
  * Option to make the users agree to your terms and conditions before they can register for a member account.
94
  * Option to make the users agree to your privacy policy before they can register for a member account.
 
95
 
96
  = Language Translations =
97
 
@@ -152,6 +153,28 @@ https://simple-membership-plugin.com/
152
 
153
  == Changelog ==
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  = 3.7.0 =
156
  - Added PayPal smart checkout button option. https://simple-membership-plugin.com/creating-paypal-smart-checkout-buttons-for-membership-payment/
157
  - Added a new filter hook swpm_edit_profile_form_before_username
3
  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.0
7
+ Stable tag: 3.7.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
92
  * Option force the members to use strong password.
93
  * Option to make the users agree to your terms and conditions before they can register for a member account.
94
  * Option to make the users agree to your privacy policy before they can register for a member account.
95
+ * Option to automatically logout the members when they close the browser.
96
 
97
  = Language Translations =
98
 
153
 
154
  == Changelog ==
155
 
156
+ = 3.7.4 =
157
+ - Stripe Subscription now considers plan trial period settings.
158
+ - Added CSS class names to the fields in the admin add/edit members interface.
159
+ - Added more translatable strings to the POT file.
160
+ - WordPress 5.0 compatibility
161
+
162
+ = 3.7.3 =
163
+ - Created a new free addon to offer full page style protection. https://simple-membership-plugin.com/full-page-protection-addon-simple-membership/
164
+ - The mini login shortcode output is now translatable
165
+ - Fixed Smart Checkout buttons were not working in live mode under some circumstances
166
+ - Fixed minor display issues for PayPal Smart Checkout buttons
167
+
168
+ = 3.7.2 =
169
+ - Added a new feature that allows you to automatically logout the users when they close the browser.
170
+ - Added support for Two-Factor Authentication addon.
171
+ - Added a new utility function.
172
+ - Improved the social login functionality.
173
+
174
+ = 3.7.1 =
175
+ - Moved the IPN handling code from "init" hook to "wp_loaded" hook for better compatibility.
176
+ - The configuration fields for "Publishable" and "Secret" keys for Stripe has been swapped. This will align them better with how you get the info from your Stripe account.
177
+
178
  = 3.7.0 =
179
  - Added PayPal smart checkout button option. https://simple-membership-plugin.com/creating-paypal-smart-checkout-buttons-for-membership-payment/
180
  - Added a new filter hook swpm_edit_profile_form_before_username
simple-wp-membership.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
- Version: 3.7.0
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.7.0');
23
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
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.7.4
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.7.4');
23
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
24
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
25
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
views/account_delete_warning.php CHANGED
@@ -1,16 +1,16 @@
1
 
2
  <header class="entry-header">
3
- Delete Account
4
  </header>
5
  <?php if (!empty($msg)) echo '<p>' . $msg . '</p>'; ?>
6
  <p style="color:red;">
7
- You are about to delete an account. This will delete user data associated with this account.
8
- It will also delete associated WordPress user account.
9
- (NOTE: for safety, we do not allow deletion of any associated WordPress account with administrator role).
10
- Continue?
11
  </p>
12
  <form method="post">
13
- <p>Password: <input name="account_delete_confirm_pass" type="password"></p>
14
- <p><input type="submit" name="confirm" value="Confirm Account Deletion" /> </p>
15
  <?php wp_nonce_field('swpm_account_delete_confirm', 'account_delete_confirm_nonce'); ?>
16
  </form>
1
 
2
  <header class="entry-header">
3
+ <?php echo SwpmUtils::_('Delete Account'); ?>
4
  </header>
5
  <?php if (!empty($msg)) echo '<p>' . $msg . '</p>'; ?>
6
  <p style="color:red;">
7
+ <?php echo SwpmUtils::_('You are about to delete an account. This will delete user data associated with this account. '); ?>
8
+ <?php echo SwpmUtils::_('It will also delete associated WordPress user account.'); ?>
9
+ <?php echo SwpmUtils::_('(NOTE: for safety, we do not allow deletion of any associated WordPress account with administrator role).'); ?>
10
+ <?php echo SwpmUtils::_('Continue?'); ?>
11
  </p>
12
  <form method="post">
13
+ <p><?php echo SwpmUtils::_('Password: '); ?><input name="account_delete_confirm_pass" type="password"></p>
14
+ <p><input type="submit" name="confirm" value="<?php echo SwpmUtils::_('Confirm Account Deletion'); ?>" /> </p>
15
  <?php wp_nonce_field('swpm_account_delete_confirm', 'account_delete_confirm_nonce'); ?>
16
  </form>
views/admin_add.php CHANGED
@@ -7,15 +7,15 @@
7
  <p><?php echo SwpmUtils::_('Create a brand new user and add it to this site.'); ?></p>
8
  <table class="form-table">
9
  <tbody>
10
- <tr class="form-required">
11
  <th scope="row"><label for="user_name"><?php echo SwpmUtils::_('Username'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
12
  <td><input class="regular-text validate[required,custom[noapostrophe],custom[SWPMUserName],minSize[4],ajax[ajaxUserCall]]" name="user_name" type="text" id="user_name" value="<?php echo esc_attr(stripslashes($user_name)); ?>" aria-required="true" /></td>
13
  </tr>
14
- <tr class="form-required">
15
  <th scope="row"><label for="email"><?php echo SwpmUtils::_('E-mail'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
16
  <td><input name="email" autocomplete="off" class="regular-text validate[required,custom[email],ajax[ajaxEmailCall]]" type="text" id="email" value="<?php echo esc_attr($email); ?>" /></td>
17
  </tr>
18
- <tr class="form-required">
19
  <th scope="row"><label for="password"><?php echo SwpmUtils::_('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(twice, required)'); ?></span></label></th>
20
  <td><input class="regular-text" name="password" type="password" id="pass1" autocomplete="off" />
21
  <br />
@@ -25,7 +25,7 @@
25
  <p class="description indicator-hint"><?php echo SwpmUtils::_('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
26
  </td>
27
  </tr>
28
- <tr>
29
  <th scope="row"><label for="account_state"><?php echo SwpmUtils::_('Account Status'); ?></label></th>
30
  <td><select class="regular-text" name="account_state" id="account_state">
31
  <?php echo SwpmUtils::account_state_dropdown('active'); ?>
7
  <p><?php echo SwpmUtils::_('Create a brand new user and add it to this site.'); ?></p>
8
  <table class="form-table">
9
  <tbody>
10
+ <tr class="form-required swpm-admin-add-username">
11
  <th scope="row"><label for="user_name"><?php echo SwpmUtils::_('Username'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
12
  <td><input class="regular-text validate[required,custom[noapostrophe],custom[SWPMUserName],minSize[4],ajax[ajaxUserCall]]" name="user_name" type="text" id="user_name" value="<?php echo esc_attr(stripslashes($user_name)); ?>" aria-required="true" /></td>
13
  </tr>
14
+ <tr class="form-required swpm-admin-add-email">
15
  <th scope="row"><label for="email"><?php echo SwpmUtils::_('E-mail'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
16
  <td><input name="email" autocomplete="off" class="regular-text validate[required,custom[email],ajax[ajaxEmailCall]]" type="text" id="email" value="<?php echo esc_attr($email); ?>" /></td>
17
  </tr>
18
+ <tr class="form-required swpm-admin-add-password">
19
  <th scope="row"><label for="password"><?php echo SwpmUtils::_('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(twice, required)'); ?></span></label></th>
20
  <td><input class="regular-text" name="password" type="password" id="pass1" autocomplete="off" />
21
  <br />
25
  <p class="description indicator-hint"><?php echo SwpmUtils::_('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
26
  </td>
27
  </tr>
28
+ <tr class="swpm-admin-add-account-state">
29
  <th scope="row"><label for="account_state"><?php echo SwpmUtils::_('Account Status'); ?></label></th>
30
  <td><select class="regular-text" name="account_state" id="account_state">
31
  <?php echo SwpmUtils::account_state_dropdown('active'); ?>
views/admin_add_ons_page.php CHANGED
@@ -59,10 +59,10 @@ echo '<link type="text/css" rel="stylesheet" href="' . SIMPLE_WP_MEMBERSHIP_URL
59
  array_push($addons_data, $addon_6);
60
 
61
  $addon_7 = array(
62
- 'name' => 'Protect Older Posts',
63
- 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-older-posts-protection.png',
64
- 'description' => 'The protect older posts addon allows you to control protection of posts that were published before a member\'s access start date.',
65
- 'page_url' => 'https://simple-membership-plugin.com/simple-membership-protect-older-posts-addon/',
66
  );
67
  array_push($addons_data, $addon_7);
68
 
@@ -107,18 +107,18 @@ echo '<link type="text/css" rel="stylesheet" href="' . SIMPLE_WP_MEMBERSHIP_URL
107
  array_push($addons_data, $addon_12);
108
 
109
  $addon_13 = array(
110
- 'name' => 'Show Member Info',
111
- 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/show-member-info.png',
112
- 'description' => 'Allows you to show various member info using shortcodes.',
113
- 'page_url' => 'https://simple-membership-plugin.com/simple-membership-addon-show-member-info/',
114
  );
115
  array_push($addons_data, $addon_13);
116
 
117
  $addon_14 = array(
118
- 'name' => 'Google First Click Free',
119
- 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/google-first-click-free-addon.png',
120
- 'description' => 'Allows you to integrate with the Google First Click Free feature.',
121
- 'page_url' => 'https://simple-membership-plugin.com/simple-membership-google-first-click-free-integration-addon',
122
  );
123
  array_push($addons_data, $addon_14);
124
 
@@ -137,7 +137,7 @@ echo '<link type="text/css" rel="stylesheet" href="' . SIMPLE_WP_MEMBERSHIP_URL
137
  'page_url' => 'https://simple-membership-plugin.com/apply-partial-section-protection/',
138
  );
139
  array_push($addons_data, $addon_16);
140
-
141
  $addon_17 = array(
142
  'name' => 'Member Data Exporter',
143
  'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-data-exporter-addon.png',
@@ -187,10 +187,10 @@ echo '<link type="text/css" rel="stylesheet" href="' . SIMPLE_WP_MEMBERSHIP_URL
187
  array_push($addons_data, $addon_22);
188
 
189
  $addon_23 = array(
190
- 'name' => 'WooCommerce Payments',
191
- 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-woocommerce-addon.png',
192
- 'description' => 'This addon can be used to accept membership payment via the WooCommerce plugin',
193
- 'page_url' => 'https://simple-membership-plugin.com/woocommerce-simple-membership-plugin-integration/',
194
  );
195
  array_push($addons_data, $addon_23);
196
 
@@ -203,12 +203,28 @@ echo '<link type="text/css" rel="stylesheet" href="' . SIMPLE_WP_MEMBERSHIP_URL
203
  array_push($addons_data, $addon_24);
204
 
205
  $addon_25 = array(
 
 
 
 
 
 
 
 
206
  'name' => 'Expiry Email Notification',
207
  'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/email-notification-and-broadcast-addon.png',
208
  'description' => 'Allows you to configure and send various expiry email notifications for members.',
209
  'page_url' => 'https://simple-membership-plugin.com/simple-membership-email-notification-broadcast-addon/',
210
  );
211
- array_push($addons_data, $addon_25);
 
 
 
 
 
 
 
 
212
 
213
  /*** Show the addons list ***/
214
  foreach ($addons_data as $addon) {
59
  array_push($addons_data, $addon_6);
60
 
61
  $addon_7 = array(
62
+ 'name' => 'WooCommerce Payments',
63
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-woocommerce-addon.png',
64
+ 'description' => 'This addon can be used to accept membership payment via the WooCommerce plugin',
65
+ 'page_url' => 'https://simple-membership-plugin.com/woocommerce-simple-membership-plugin-integration/',
66
  );
67
  array_push($addons_data, $addon_7);
68
 
107
  array_push($addons_data, $addon_12);
108
 
109
  $addon_13 = array(
110
+ 'name' => 'Full Page Protection',
111
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/full-page-protection-addon.png',
112
+ 'description' => 'Allows you to protect the full post or page (header to footer).',
113
+ 'page_url' => 'https://simple-membership-plugin.com/full-page-protection-addon-simple-membership/',
114
  );
115
  array_push($addons_data, $addon_13);
116
 
117
  $addon_14 = array(
118
+ 'name' => 'Protect Older Posts',
119
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-older-posts-protection.png',
120
+ 'description' => 'The protect older posts addon allows you to control protection of posts that were published before a member\'s access start date.',
121
+ 'page_url' => 'https://simple-membership-plugin.com/simple-membership-protect-older-posts-addon/',
122
  );
123
  array_push($addons_data, $addon_14);
124
 
137
  'page_url' => 'https://simple-membership-plugin.com/apply-partial-section-protection/',
138
  );
139
  array_push($addons_data, $addon_16);
140
+
141
  $addon_17 = array(
142
  'name' => 'Member Data Exporter',
143
  'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/swpm-data-exporter-addon.png',
187
  array_push($addons_data, $addon_22);
188
 
189
  $addon_23 = array(
190
+ 'name' => 'Google First Click Free',
191
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/google-first-click-free-addon.png',
192
+ 'description' => 'Allows you to integrate with the Google First Click Free feature.',
193
+ 'page_url' => 'https://simple-membership-plugin.com/simple-membership-google-first-click-free-integration-addon',
194
  );
195
  array_push($addons_data, $addon_23);
196
 
203
  array_push($addons_data, $addon_24);
204
 
205
  $addon_25 = array(
206
+ 'name' => 'Show Member Info',
207
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/show-member-info.png',
208
+ 'description' => 'Allows you to show various member info using shortcodes.',
209
+ 'page_url' => 'https://simple-membership-plugin.com/simple-membership-addon-show-member-info/',
210
+ );
211
+ array_push($addons_data, $addon_25);
212
+
213
+ $addon_26 = array(
214
  'name' => 'Expiry Email Notification',
215
  'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/email-notification-and-broadcast-addon.png',
216
  'description' => 'Allows you to configure and send various expiry email notifications for members.',
217
  'page_url' => 'https://simple-membership-plugin.com/simple-membership-email-notification-broadcast-addon/',
218
  );
219
+ array_push($addons_data, $addon_26);
220
+
221
+ $addon_27 = array(
222
+ 'name' => '2 Factor Authentication',
223
+ 'thumbnail' => SIMPLE_WP_MEMBERSHIP_URL . '/images/addons/2fa-addon-icon.png',
224
+ 'description' => 'This addon adds the 2 factor authentication for member login to increase login security.',
225
+ 'page_url' => 'https://simple-membership-plugin.com/swpm-two-factor-authentication-addon/',
226
+ );
227
+ array_push($addons_data, $addon_27);
228
 
229
  /*** Show the addons list ***/
230
  foreach ($addons_data as $addon) {
views/admin_edit.php CHANGED
@@ -15,7 +15,7 @@
15
  <?php echo esc_attr($member_id); ?>
16
  </p>
17
  <table class="form-table">
18
- <tr class="form-field form-required">
19
  <th scope="row"><label for="user_name"><?php echo SwpmUtils::_('Username'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
20
  <td>
21
  <?php
@@ -36,11 +36,11 @@
36
  ?>
37
  </td>
38
  </tr>
39
- <tr class="form-required">
40
  <th scope="row"><label for="email"><?php echo SwpmUtils::_('E-mail'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
41
  <td><input name="email" autocomplete="off" class="regular-text validate[required,custom[email],ajax[ajaxEmailCall]]" type="text" id="email" value="<?php echo esc_attr($email); ?>" /></td>
42
  </tr>
43
- <tr class="">
44
  <th scope="row"><label for="password"><?php echo SwpmUtils::_('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(twice, leave empty to retain old password)'); ?></span></label></th>
45
  <td><input class="regular-text" name="password" type="password" id="pass1" autocomplete="off" /><br />
46
  <input class="regular-text" name="password_re" type="password" id="pass2" autocomplete="off" />
@@ -49,7 +49,7 @@
49
  <p class="description indicator-hint"><?php echo SwpmUtils::_('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
50
  </td>
51
  </tr>
52
- <tr>
53
  <th scope="row"><label for="account_state"><?php echo SwpmUtils::_('Account Status'); ?></label></th>
54
  <td>
55
  <select class="regular-text" name="account_state" id="account_state">
@@ -62,7 +62,7 @@
62
  </p>
63
  </td>
64
  </tr>
65
- <tr>
66
  <th scope="row"><label for="account_state_change"><?php echo SwpmUtils::_('Notify User'); ?></label></th>
67
  <td><input type="checkbox" id="account_status_change" name="account_status_change" />
68
  <p class="description indicator-hint">
@@ -71,18 +71,18 @@
71
  </td>
72
  </tr>
73
  <?php include('admin_member_form_common_part.php');?>
74
- <tr>
75
  <th scope="row"><label for="subscr_id"><?php echo SwpmUtils::_('Subscriber ID/Reference') ?> </label></th>
76
  <td><input class="regular-text" name="subscr_id" type="text" id="subscr_id" value="<?php echo esc_attr($subscr_id); ?>" /></td>
77
  </tr>
78
- <tr>
79
  <th scope="row"><label for="last_accessed"><?php echo SwpmUtils::_('Last Accessed Date') ?> </label></th>
80
  <td>
81
  <?php echo esc_attr($last_accessed); ?>
82
  <p class="description indicator-hint"><?php echo SwpmUtils::_('This value gets updated when this member logs into your site.') ?></p>
83
  </td>
84
  </tr>
85
- <tr>
86
  <th scope="row"><label for="last_accessed_from_ip"><?php echo SwpmUtils::_('Last Accessed From IP') ?> </label></th>
87
  <td>
88
  <?php echo esc_attr($last_accessed_from_ip); ?>
15
  <?php echo esc_attr($member_id); ?>
16
  </p>
17
  <table class="form-table">
18
+ <tr class="form-field form-required swpm-admin-edit-username">
19
  <th scope="row"><label for="user_name"><?php echo SwpmUtils::_('Username'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
20
  <td>
21
  <?php
36
  ?>
37
  </td>
38
  </tr>
39
+ <tr class="form-required swpm-admin-edit-email">
40
  <th scope="row"><label for="email"><?php echo SwpmUtils::_('E-mail'); ?> <span class="description"><?php echo SwpmUtils::_('(required)'); ?></span></label></th>
41
  <td><input name="email" autocomplete="off" class="regular-text validate[required,custom[email],ajax[ajaxEmailCall]]" type="text" id="email" value="<?php echo esc_attr($email); ?>" /></td>
42
  </tr>
43
+ <tr class="swpm-admin-edit-password">
44
  <th scope="row"><label for="password"><?php echo SwpmUtils::_('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(twice, leave empty to retain old password)'); ?></span></label></th>
45
  <td><input class="regular-text" name="password" type="password" id="pass1" autocomplete="off" /><br />
46
  <input class="regular-text" name="password_re" type="password" id="pass2" autocomplete="off" />
49
  <p class="description indicator-hint"><?php echo SwpmUtils::_('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
50
  </td>
51
  </tr>
52
+ <tr class="swpm-admin-edit-account-state">
53
  <th scope="row"><label for="account_state"><?php echo SwpmUtils::_('Account Status'); ?></label></th>
54
  <td>
55
  <select class="regular-text" name="account_state" id="account_state">
62
  </p>
63
  </td>
64
  </tr>
65
+ <tr class="swpm-admin-edit-notify-user">
66
  <th scope="row"><label for="account_state_change"><?php echo SwpmUtils::_('Notify User'); ?></label></th>
67
  <td><input type="checkbox" id="account_status_change" name="account_status_change" />
68
  <p class="description indicator-hint">
71
  </td>
72
  </tr>
73
  <?php include('admin_member_form_common_part.php');?>
74
+ <tr class="swpm-admin-edit-subscriber-id">
75
  <th scope="row"><label for="subscr_id"><?php echo SwpmUtils::_('Subscriber ID/Reference') ?> </label></th>
76
  <td><input class="regular-text" name="subscr_id" type="text" id="subscr_id" value="<?php echo esc_attr($subscr_id); ?>" /></td>
77
  </tr>
78
+ <tr class="swpm-admin-edit-last-accessed">
79
  <th scope="row"><label for="last_accessed"><?php echo SwpmUtils::_('Last Accessed Date') ?> </label></th>
80
  <td>
81
  <?php echo esc_attr($last_accessed); ?>
82
  <p class="description indicator-hint"><?php echo SwpmUtils::_('This value gets updated when this member logs into your site.') ?></p>
83
  </td>
84
  </tr>
85
+ <tr class="swpm-admin-edit-last-accessed-ip">
86
  <th scope="row"><label for="last_accessed_from_ip"><?php echo SwpmUtils::_('Last Accessed From IP') ?> </label></th>
87
  <td>
88
  <?php echo esc_attr($last_accessed_from_ip); ?>
views/admin_member_form_common_part.php CHANGED
@@ -1,4 +1,4 @@
1
- <tr>
2
  <th scope="row"><label for="membership_level"><?php echo SwpmUtils::_('Membership Level'); ?></label></th>
3
  <td><select class="regular-text" name="membership_level" id="membership_level">
4
  <?php foreach ($levels as $level): ?>
@@ -7,54 +7,54 @@
7
  </select>
8
  </td>
9
  </tr>
10
- <tr>
11
  <th scope="row"><label for="subscription_starts"><?php echo SwpmUtils::_('Access Starts') ?> </label></th>
12
  <td><input class="regular-text" name="subscription_starts" type="text" id="subscription_starts" value="<?php echo esc_attr($subscription_starts); ?>" /></td>
13
  </tr>
14
- <tr>
15
  <th scope="row"><label for="first_name"><?php echo SwpmUtils::_('First Name') ?> </label></th>
16
  <td><input class="regular-text" name="first_name" type="text" id="first_name" value="<?php echo esc_attr($first_name); ?>" /></td>
17
  </tr>
18
- <tr>
19
  <th scope="row"><label for="last_name"><?php echo SwpmUtils::_('Last Name') ?> </label></th>
20
  <td><input class="regular-text" name="last_name" type="text" id="last_name" value="<?php echo esc_attr($last_name); ?>" /></td>
21
  </tr>
22
- <tr>
23
  <th scope="row"><label for="gender"><?php echo SwpmUtils::_('Gender'); ?></label></th>
24
  <td><select class="regular-text" name="gender" id="gender">
25
  <?php echo SwpmUtils::gender_dropdown($gender) ?>
26
  </select>
27
  </td>
28
  </tr>
29
- <tr>
30
  <th scope="row"><label for="phone"><?php echo SwpmUtils::_('Phone') ?> </label></th>
31
  <td><input class="regular-text" name="phone" type="text" id="phone" value="<?php echo esc_attr($phone); ?>" /></td>
32
  </tr>
33
- <tr>
34
  <th scope="row"><label for="address_street"><?php echo SwpmUtils::_('Street') ?> </label></th>
35
  <td><input class="regular-text" name="address_street" type="text" id="address_street" value="<?php echo esc_attr($address_street); ?>" /></td>
36
  </tr>
37
- <tr>
38
  <th scope="row"><label for="address_city"><?php echo SwpmUtils::_('City') ?> </label></th>
39
  <td><input class="regular-text" name="address_city" type="text" id="address_city" value="<?php echo esc_attr($address_city); ?>" /></td>
40
  </tr>
41
- <tr>
42
  <th scope="row"><label for="address_state"><?php echo SwpmUtils::_('State') ?> </label></th>
43
  <td><input class="regular-text" name="address_state" type="text" id="address_state" value="<?php echo esc_attr($address_state); ?>" /></td>
44
  </tr>
45
- <tr>
46
  <th scope="row"><label for="address_zipcode"><?php echo SwpmUtils::_('Zipcode') ?> </label></th>
47
  <td><input class="regular-text" name="address_zipcode" type="text" id="address_zipcode" value="<?php echo esc_attr($address_zipcode); ?>" /></td>
48
  </tr>
49
- <tr>
50
  <th scope="row"><label for="country"><?php echo SwpmUtils::_('Country') ?> </label></th>
51
  <td><select class="regular-text" id="country" name="country"><?php echo SwpmMiscUtils::get_countries_dropdown($country) ?></select></td>
52
  </tr>
53
- <tr>
54
  <th scope="row"><label for="company_name"><?php echo SwpmUtils::_('Company') ?></label></th>
55
  <td><input name="company_name" type="text" id="company_name" class="regular-text" value="<?php echo esc_attr($company_name); ?>" /></td>
56
  </tr>
57
- <tr>
58
  <th scope="row"><label for="member_since"><?php echo SwpmUtils::_('Member Since') ?> </label></th>
59
  <td><input class="regular-text" name="member_since" type="text" id="member_since" value="<?php echo esc_attr($member_since); ?>" /></td>
60
  </tr>
1
+ <tr class="swpm-admin-edit-membership-level">
2
  <th scope="row"><label for="membership_level"><?php echo SwpmUtils::_('Membership Level'); ?></label></th>
3
  <td><select class="regular-text" name="membership_level" id="membership_level">
4
  <?php foreach ($levels as $level): ?>
7
  </select>
8
  </td>
9
  </tr>
10
+ <tr class="swpm-admin-edit-access-starts">
11
  <th scope="row"><label for="subscription_starts"><?php echo SwpmUtils::_('Access Starts') ?> </label></th>
12
  <td><input class="regular-text" name="subscription_starts" type="text" id="subscription_starts" value="<?php echo esc_attr($subscription_starts); ?>" /></td>
13
  </tr>
14
+ <tr class="swpm-admin-edit-first-name">
15
  <th scope="row"><label for="first_name"><?php echo SwpmUtils::_('First Name') ?> </label></th>
16
  <td><input class="regular-text" name="first_name" type="text" id="first_name" value="<?php echo esc_attr($first_name); ?>" /></td>
17
  </tr>
18
+ <tr class="swpm-admin-edit-last-name">
19
  <th scope="row"><label for="last_name"><?php echo SwpmUtils::_('Last Name') ?> </label></th>
20
  <td><input class="regular-text" name="last_name" type="text" id="last_name" value="<?php echo esc_attr($last_name); ?>" /></td>
21
  </tr>
22
+ <tr class="swpm-admin-edit-gender">
23
  <th scope="row"><label for="gender"><?php echo SwpmUtils::_('Gender'); ?></label></th>
24
  <td><select class="regular-text" name="gender" id="gender">
25
  <?php echo SwpmUtils::gender_dropdown($gender) ?>
26
  </select>
27
  </td>
28
  </tr>
29
+ <tr class="swpm-admin-edit-phone">
30
  <th scope="row"><label for="phone"><?php echo SwpmUtils::_('Phone') ?> </label></th>
31
  <td><input class="regular-text" name="phone" type="text" id="phone" value="<?php echo esc_attr($phone); ?>" /></td>
32
  </tr>
33
+ <tr class="swpm-admin-edit-address-street">
34
  <th scope="row"><label for="address_street"><?php echo SwpmUtils::_('Street') ?> </label></th>
35
  <td><input class="regular-text" name="address_street" type="text" id="address_street" value="<?php echo esc_attr($address_street); ?>" /></td>
36
  </tr>
37
+ <tr class="swpm-admin-edit-address-city">
38
  <th scope="row"><label for="address_city"><?php echo SwpmUtils::_('City') ?> </label></th>
39
  <td><input class="regular-text" name="address_city" type="text" id="address_city" value="<?php echo esc_attr($address_city); ?>" /></td>
40
  </tr>
41
+ <tr class="swpm-admin-edit-address-state">
42
  <th scope="row"><label for="address_state"><?php echo SwpmUtils::_('State') ?> </label></th>
43
  <td><input class="regular-text" name="address_state" type="text" id="address_state" value="<?php echo esc_attr($address_state); ?>" /></td>
44
  </tr>
45
+ <tr class="swpm-admin-edit-address-zipcode">
46
  <th scope="row"><label for="address_zipcode"><?php echo SwpmUtils::_('Zipcode') ?> </label></th>
47
  <td><input class="regular-text" name="address_zipcode" type="text" id="address_zipcode" value="<?php echo esc_attr($address_zipcode); ?>" /></td>
48
  </tr>
49
+ <tr class="swpm-admin-edit-address-country">
50
  <th scope="row"><label for="country"><?php echo SwpmUtils::_('Country') ?> </label></th>
51
  <td><select class="regular-text" id="country" name="country"><?php echo SwpmMiscUtils::get_countries_dropdown($country) ?></select></td>
52
  </tr>
53
+ <tr class="swpm-admin-edit-company">
54
  <th scope="row"><label for="company_name"><?php echo SwpmUtils::_('Company') ?></label></th>
55
  <td><input name="company_name" type="text" id="company_name" class="regular-text" value="<?php echo esc_attr($company_name); ?>" /></td>
56
  </tr>
57
+ <tr class="swpm-admin-edit-member-since">
58
  <th scope="row"><label for="member_since"><?php echo SwpmUtils::_('Member Since') ?> </label></th>
59
  <td><input class="regular-text" name="member_since" type="text" id="member_since" value="<?php echo esc_attr($member_since); ?>" /></td>
60
  </tr>
views/payments/payment-gateway/paypal_smart_checkout_button_shortcode_view.php CHANGED
@@ -86,10 +86,17 @@ function swpm_render_pp_smart_checkout_button_sc_output($button_code, $args) {
86
 
87
  $output = '';
88
  ob_start();
 
 
 
 
 
 
 
 
89
  ?>
90
  <div class="swpm-button-wrapper">
91
  <div class="swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>"></div>
92
- <script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>
93
  <script>
94
  paypal.Button.render({
95
 
@@ -130,8 +137,10 @@ function swpm_render_pp_smart_checkout_button_sc_output($button_code, $args) {
130
  alert('<?php echo esc_js(__("Error occured during PayPal Smart Checkout process.", "simple-membership")); ?>\n\n' + error);
131
  },
132
  onAuthorize: function (data, actions) {
133
- jQuery(".swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>").hide();
134
- jQuery('.swpm-pp-sc-spinner-cont').css('display', 'inline-block');
 
 
135
  return actions.payment.execute().then(function (data) {
136
  data.custom_field = '<?php echo $custom_field_value; ?>';
137
  data.button_id = '<?php echo esc_js($button_id); ?>';
@@ -144,15 +153,15 @@ function swpm_render_pp_smart_checkout_button_sc_output($button_code, $args) {
144
  } else {
145
  console.log(result);
146
  alert(result.errMsg)
147
- jQuery(".swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>").show();
148
- jQuery('.swpm-pp-sc-spinner-cont').hide();
149
  }
150
  }
151
  )
152
  .fail(function (result) {
153
  console.log(result);
154
- jQuery(".swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>").show();
155
- jQuery('.swpm-pp-sc-spinner-cont').hide();
156
  alert('<?php echo esc_js(__("HTTP error occured during payment process:", "simple-membership")); ?>' + ' ' + result.status + ' ' + result.statusText);
157
  });
158
  }
@@ -165,7 +174,6 @@ function swpm_render_pp_smart_checkout_button_sc_output($button_code, $args) {
165
  @keyframes swpm-pp-sc-spinner {
166
  to {transform: rotate(360deg);}
167
  }
168
-
169
  .swpm-pp-sc-spinner {
170
  margin: 0 auto;
171
  text-indent: -9999px;
86
 
87
  $output = '';
88
  ob_start();
89
+ $ppCheckoutJs = '<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>';
90
+ //check if checkout.js was already included
91
+ //including it several times on one page causes JS fatal error
92
+ if (!defined('SWPM-PP-SMART-CHECKOUT-SCRIPT-INCLUDED')) {
93
+ //it wasn't. Let's include it and define an indicator that it is included now
94
+ define('SWPM-PP-SMART-CHECKOUT-SCRIPT-INCLUDED', 1);
95
+ echo $ppCheckoutJs;
96
+ }
97
  ?>
98
  <div class="swpm-button-wrapper">
99
  <div class="swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>"></div>
 
100
  <script>
101
  paypal.Button.render({
102
 
137
  alert('<?php echo esc_js(__("Error occured during PayPal Smart Checkout process.", "simple-membership")); ?>\n\n' + error);
138
  },
139
  onAuthorize: function (data, actions) {
140
+ var paymentBtnCont = jQuery('.swpm-pp-smart-checkout-btn-<?php echo $uniqid; ?>');
141
+ var paymentBtnSpinner = paymentBtnCont.siblings('.swpm-pp-sc-spinner-cont');
142
+ paymentBtnCont.hide();
143
+ paymentBtnSpinner.css('display', 'inline-block');
144
  return actions.payment.execute().then(function (data) {
145
  data.custom_field = '<?php echo $custom_field_value; ?>';
146
  data.button_id = '<?php echo esc_js($button_id); ?>';
153
  } else {
154
  console.log(result);
155
  alert(result.errMsg)
156
+ paymentBtnCont.show();
157
+ paymentBtnSpinner.hide();
158
  }
159
  }
160
  )
161
  .fail(function (result) {
162
  console.log(result);
163
+ paymentBtnCont.show();
164
+ paymentBtnSpinner.hide();
165
  alert('<?php echo esc_js(__("HTTP error occured during payment process:", "simple-membership")); ?>' + ' ' + result.status + ' ' + result.statusText);
166
  });
167
  }
174
  @keyframes swpm-pp-sc-spinner {
175
  to {transform: rotate(360deg);}
176
  }
 
177
  .swpm-pp-sc-spinner {
178
  margin: 0 auto;
179
  text-indent: -9999px;