Simple Membership - Version 3.3.1

Version Description

  • Added an option in the advanced settings menu to use the timezone value specified in your WordPress General Settings interface.
  • WordPress 4.6 compatibility.
Download this release

Release Info

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

Code changes from version 3.3.0 to 3.3.1

classes/class.simple-wp-membership.php CHANGED
@@ -74,6 +74,7 @@ class SimpleWpMembership {
74
  add_action('admin_init', array(&$this, 'admin_init_hook'));
75
  add_action('plugins_loaded', array(&$this, "plugins_loaded"));
76
  add_action('password_reset', array(&$this, 'wp_password_reset_hook'), 10, 2);
 
77
  }
78
 
79
  public function wp_head_callback(){
74
  add_action('admin_init', array(&$this, 'admin_init_hook'));
75
  add_action('plugins_loaded', array(&$this, "plugins_loaded"));
76
  add_action('password_reset', array(&$this, 'wp_password_reset_hook'), 10, 2);
77
+
78
  }
79
 
80
  public function wp_head_callback(){
classes/class.swpm-settings.php CHANGED
@@ -184,8 +184,11 @@ class SwpmSettings {
184
  'message' => SwpmUtils::_('You can create a renewal page for your site. Read <a href="https://simple-membership-plugin.com/creating-membership-renewal-button/" target="_blank">this documentation</a> to learn how to create a renewal page.')) );
185
 
186
  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',
187
- 'options' => SwpmUtils::get_account_state_options(),
188
  'message' => SwpmUtils::_('Allow users to delete their accounts.')));
 
 
 
 
189
  add_settings_field('delete-pending-account', SwpmUtils::_('Auto Delete Pending Account'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'delete-pending-account',
190
  'options' => array(0 => 'Do not delete', 1 => 'Older than 1 month', 2 => 'Older than 2 months'),
191
  'default' => '0',
@@ -390,6 +393,7 @@ class SwpmSettings {
390
  $output = $this->settings;
391
  $output['enable-expired-account-login'] = isset($input['enable-expired-account-login']) ? esc_attr($input['enable-expired-account-login']) : "";
392
  $output['allow-account-deletion'] = isset($input['allow-account-deletion']) ? esc_attr($input['allow-account-deletion']) : "";
 
393
  $output['delete-pending-account'] = isset($input['delete-pending-account']) ? esc_attr($input['delete-pending-account']) : 0;
394
  $output['admin-dashboard-access-permission'] = isset($input['admin-dashboard-access-permission']) ? esc_attr($input['admin-dashboard-access-permission']) : '';
395
  $output['renewal-page-url'] = esc_url($input['renewal-page-url']);
184
  'message' => SwpmUtils::_('You can create a renewal page for your site. Read <a href="https://simple-membership-plugin.com/creating-membership-renewal-button/" target="_blank">this documentation</a> to learn how to create a renewal page.')) );
185
 
186
  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',
 
187
  'message' => SwpmUtils::_('Allow users to delete their accounts.')));
188
+
189
+ add_settings_field('use-wordpress-timezone', SwpmUtils::_('Use WordPress Timezone'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'use-wordpress-timezone',
190
+ 'message' => SwpmUtils::_('Use this option if you want to use the timezone value specified in your WordPress General Settings interface.')));
191
+
192
  add_settings_field('delete-pending-account', SwpmUtils::_('Auto Delete Pending Account'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'delete-pending-account',
193
  'options' => array(0 => 'Do not delete', 1 => 'Older than 1 month', 2 => 'Older than 2 months'),
194
  'default' => '0',
393
  $output = $this->settings;
394
  $output['enable-expired-account-login'] = isset($input['enable-expired-account-login']) ? esc_attr($input['enable-expired-account-login']) : "";
395
  $output['allow-account-deletion'] = isset($input['allow-account-deletion']) ? esc_attr($input['allow-account-deletion']) : "";
396
+ $output['use-wordpress-timezone'] = isset($input['use-wordpress-timezone']) ? esc_attr($input['use-wordpress-timezone']) : "";
397
  $output['delete-pending-account'] = isset($input['delete-pending-account']) ? esc_attr($input['delete-pending-account']) : 0;
398
  $output['admin-dashboard-access-permission'] = isset($input['admin-dashboard-access-permission']) ? esc_attr($input['admin-dashboard-access-permission']) : '';
399
  $output['renewal-page-url'] = esc_url($input['renewal-page-url']);
classes/class.swpm-utils-member.php CHANGED
@@ -78,7 +78,7 @@ class SwpmMemberUtils {
78
  public static function get_user_by_email($swpm_email) {
79
  //Retrieves the SWPM user record for the given member email address
80
  global $wpdb;
81
- $query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}swpm_members_tbl WHERE email = %d", $swpm_email);
82
  $result = $wpdb->get_row($query);
83
  return $result;
84
  }
78
  public static function get_user_by_email($swpm_email) {
79
  //Retrieves the SWPM user record for the given member email address
80
  global $wpdb;
81
+ $query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}swpm_members_tbl WHERE email = %s", $swpm_email);
82
  $result = $wpdb->get_row($query);
83
  return $result;
84
  }
classes/class.swpm-utils.php CHANGED
@@ -6,6 +6,31 @@ abstract class SwpmUtils {
6
  return defined('DOING_AJAX') && DOING_AJAX;
7
  }
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  public static function subscription_type_dropdown($selected) {
10
  return '<option ' . (($selected == SwpmMembershipLevel::NO_EXPIRY) ? 'selected="selected"' : "") . ' value="' . SwpmMembershipLevel::NO_EXPIRY . '">No Expiry</option>' .
11
  '<option ' . (($selected == SwpmMembershipLevel::DAYS) ? 'selected="selected"' : "") . ' value="' . SwpmMembershipLevel::DAYS . '">Day(s)</option>' .
6
  return defined('DOING_AJAX') && DOING_AJAX;
7
  }
8
 
9
+ /*
10
+ * This function handles various initial setup tasks that need to be executed very early on (before other functions of the plugin is called).
11
+ */
12
+ public static function do_misc_initial_plugin_setup_tasks(){
13
+
14
+ //Management role/permission setup
15
+ $admin_dashboard_permission = SwpmSettings::get_instance()->get_value('admin-dashboard-access-permission');
16
+ if (empty($admin_dashboard_permission)) {
17
+ //By default only admins can manage/see admin dashboard
18
+ define("SWPM_MANAGEMENT_PERMISSION", "manage_options");
19
+ } else {
20
+ define("SWPM_MANAGEMENT_PERMISSION", $admin_dashboard_permission);
21
+ }
22
+
23
+ //Set timezone preference (if enabled in settings)
24
+ $use_wp_timezone = SwpmSettings::get_instance()->get_value('use-wordpress-timezone');
25
+ if (!empty($use_wp_timezone)){//Set the wp timezone
26
+ $wp_timezone_string = get_option('timezone_string');
27
+ if(!empty($wp_timezone_string)){
28
+ date_default_timezone_set($wp_timezone_string);
29
+ }
30
+ }
31
+
32
+ }
33
+
34
  public static function subscription_type_dropdown($selected) {
35
  return '<option ' . (($selected == SwpmMembershipLevel::NO_EXPIRY) ? 'selected="selected"' : "") . ' value="' . SwpmMembershipLevel::NO_EXPIRY . '">No Expiry</option>' .
36
  '<option ' . (($selected == SwpmMembershipLevel::DAYS) ? 'selected="selected"' : "") . ' value="' . SwpmMembershipLevel::DAYS . '">Day(s)</option>' .
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: smp7, wp.insider, amijanina
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
5
  Requires at least: 3.3
6
- Tested up to: 4.5
7
- Stable tag: 3.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -127,6 +127,11 @@ Please visit the memberhsip plugin page to view screenshots:
127
  https://simple-membership-plugin.com/
128
 
129
  == Changelog ==
 
 
 
 
 
130
  = 3.3.0 =
131
  - Updated the Hungarian language file.
132
  - Improved input sanitization.
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
5
  Requires at least: 3.3
6
+ Tested up to: 4.6
7
+ Stable tag: 3.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
127
  https://simple-membership-plugin.com/
128
 
129
  == Changelog ==
130
+
131
+ = 3.3.1 =
132
+ - Added an option in the advanced settings menu to use the timezone value specified in your WordPress General Settings interface.
133
+ - WordPress 4.6 compatibility.
134
+
135
  = 3.3.0 =
136
  - Updated the Hungarian language file.
137
  - Improved input sanitization.
simple-wp-membership.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
- Version: 3.3.0
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
@@ -17,7 +17,7 @@ include_once('classes/class.simple-wp-membership.php');
17
  include_once('classes/class.swpm-cronjob.php');
18
  include_once('swpm-compat.php');
19
 
20
- define('SIMPLE_WP_MEMBERSHIP_VER', '3.3.0');
21
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
22
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
23
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
@@ -30,14 +30,7 @@ if (!defined('COOKIEHASH')) {
30
  define('SIMPLE_WP_MEMBERSHIP_AUTH', 'simple_wp_membership_' . COOKIEHASH);
31
  define('SIMPLE_WP_MEMBERSHIP_SEC_AUTH', 'simple_wp_membership_sec_' . COOKIEHASH);
32
 
33
- //Management role/permission setup
34
- $admin_dashboard_permission = SwpmSettings::get_instance()->get_value('admin-dashboard-access-permission');
35
- if (empty($admin_dashboard_permission)) {
36
- //By default only admins can manage/see admin dashboard
37
- define("SWPM_MANAGEMENT_PERMISSION", "manage_options");
38
- } else {
39
- define("SWPM_MANAGEMENT_PERMISSION", $admin_dashboard_permission);
40
- }
41
 
42
  register_activation_hook(SIMPLE_WP_MEMBERSHIP_PATH . 'simple-wp-membership.php', 'SimpleWpMembership::activate');
43
  register_deactivation_hook(SIMPLE_WP_MEMBERSHIP_PATH . 'simple-wp-membership.php', 'SimpleWpMembership::deactivate');
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
+ Version: 3.3.1
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
17
  include_once('classes/class.swpm-cronjob.php');
18
  include_once('swpm-compat.php');
19
 
20
+ define('SIMPLE_WP_MEMBERSHIP_VER', '3.3.1');
21
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
22
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
23
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
30
  define('SIMPLE_WP_MEMBERSHIP_AUTH', 'simple_wp_membership_' . COOKIEHASH);
31
  define('SIMPLE_WP_MEMBERSHIP_SEC_AUTH', 'simple_wp_membership_sec_' . COOKIEHASH);
32
 
33
+ SwpmUtils::do_misc_initial_plugin_setup_tasks();
 
 
 
 
 
 
 
34
 
35
  register_activation_hook(SIMPLE_WP_MEMBERSHIP_PATH . 'simple-wp-membership.php', 'SimpleWpMembership::activate');
36
  register_deactivation_hook(SIMPLE_WP_MEMBERSHIP_PATH . 'simple-wp-membership.php', 'SimpleWpMembership::deactivate');