WP-Members Membership Plugin - Version 3.0.6

Version Description

  • Updates to localization function - documented plugin_locale filter, wpmem_localization_file filter, and improved load_textdomain logic.
  • Added /lang domain path to plugin header.
  • Fixed a bug in the user export function that broke CSV columns when moderated registration was turned on.
  • Improved current page retrieval in wpmem_redirect_to_login() function.
  • Fixed admin enqueued scripts (post/page screen hook did not load from new location).
Download this release

Release Info

Developer cbutlerjr
Plugin Icon 128x128 WP-Members Membership Plugin
Version 3.0.6
Comparing to
See all releases

Code changes from version 3.0.5 to 3.0.6

admin/admin.php CHANGED
@@ -25,6 +25,7 @@
25
  * - wpmem_admin_tabs
26
  * - wpmem_admin_action
27
  * - wpmem_admin_add_new_user
 
28
  */
29
 
30
 
@@ -33,6 +34,7 @@ include_once( WPMEM_PATH . 'admin/dialogs.php' );
33
 
34
 
35
  /** Actions and Filters */
 
36
  add_action( 'wpmem_admin_do_tab', 'wpmem_admin_do_tab' );
37
  add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
38
  add_action( 'user_new_form', 'wpmem_admin_add_new_user' );
@@ -79,6 +81,7 @@ function wpmem_admin_plugin_links( $links, $file ) {
79
  * Loads the admin javascript and css files.
80
  *
81
  * @since 2.5.1
 
82
  *
83
  * @uses wp_enqueue_script
84
  * @uses wp_enqueue_style
@@ -287,4 +290,24 @@ function wpmem_admin_add_new_user() {
287
  return;
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  // End of File.
25
  * - wpmem_admin_tabs
26
  * - wpmem_admin_action
27
  * - wpmem_admin_add_new_user
28
+ * - wpmem_admin_enqueue_scripts
29
  */
30
 
31
 
34
 
35
 
36
  /** Actions and Filters */
37
+ add_action( 'admin_enqueue_scripts', 'wpmem_admin_enqueue_scripts' );
38
  add_action( 'wpmem_admin_do_tab', 'wpmem_admin_do_tab' );
39
  add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
40
  add_action( 'user_new_form', 'wpmem_admin_add_new_user' );
81
  * Loads the admin javascript and css files.
82
  *
83
  * @since 2.5.1
84
+ * @deprecated 3.0.6
85
  *
86
  * @uses wp_enqueue_script
87
  * @uses wp_enqueue_style
290
  return;
291
  }
292
 
293
+
294
+ /**
295
+ * Enqueues the admin javascript and css files.
296
+ *
297
+ * @since 3.0.6
298
+ *
299
+ * @uses wp_enqueue_script
300
+ * @uses wp_enqueue_style
301
+ *
302
+ * @param str $hook The admin screen hook being loaded.
303
+ */
304
+ function wpmem_admin_enqueue_scripts( $hook ) {
305
+ if ( $hook == 'edit.php' || $hook == 'settings_page_wpmem-settings' ) {
306
+ wp_enqueue_style( 'wpmem-admin', WPMEM_DIR . 'admin/css/admin.css', '', WPMEM_VERSION );
307
+ }
308
+ if ( $hook == 'settings_page_wpmem-settings' ) {
309
+ wp_enqueue_script( 'wpmem-admin', WPMEM_DIR . 'admin/js/admin.js', '', WPMEM_VERSION );
310
+ }
311
+ }
312
+
313
  // End of File.
admin/post.php CHANGED
@@ -304,7 +304,6 @@ function wpmem_post_columns( $columns ) {
304
  $post_type = ( isset( $_REQUEST['post_type'] ) ) ? $_REQUEST['post_type'] : 'post';
305
 
306
  if ( $post_type == 'page' || $post_type == 'post' ) { // @todo - holding off on CPT support.
307
- wp_enqueue_style ( 'wpmem-admin-css', WPMEM_DIR . '/css/admin.css', '', WPMEM_VERSION );
308
  $columns['wpmem_block'] = ( $wpmem->block[ $post_type ] == 1 ) ? __( 'Unblocked?', 'wp-members' ) : __( 'Blocked?', 'wp-members' );
309
  }
310
  return $columns;
304
  $post_type = ( isset( $_REQUEST['post_type'] ) ) ? $_REQUEST['post_type'] : 'post';
305
 
306
  if ( $post_type == 'page' || $post_type == 'post' ) { // @todo - holding off on CPT support.
 
307
  $columns['wpmem_block'] = ( $wpmem->block[ $post_type ] == 1 ) ? __( 'Unblocked?', 'wp-members' ) : __( 'Blocked?', 'wp-members' );
308
  }
309
  return $columns;
admin/tab-fields.php CHANGED
@@ -195,7 +195,7 @@ function wpmem_update_fields( $action ) {
195
  $reserved_terms = wpmem_wp_reserved_terms();
196
  $submitted_term = $_POST['add_option'];
197
  if ( in_array( strtolower( $submitted_term ), $reserved_terms ) ) {
198
- $add_field_err_msg = sprintf( __( 'Sorry, "%s" is a <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms" target="_blank">reserved term</a>. Field was not added.', 'wp-members' ), $submitted_term );
199
  }
200
 
201
  // Error check option name for spaces and replace with underscores.
195
  $reserved_terms = wpmem_wp_reserved_terms();
196
  $submitted_term = $_POST['add_option'];
197
  if ( in_array( strtolower( $submitted_term ), $reserved_terms ) ) {
198
+ $add_field_err_msg = sprintf( __( 'Sorry, "%s" is a <a href="https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms" target="_blank">reserved term</a>. Field was not added.', 'wp-members' ), $submitted_term );
199
  }
200
 
201
  // Error check option name for spaces and replace with underscores.
admin/user-export.php CHANGED
@@ -109,7 +109,7 @@ function wpmem_export_users( $args, $users = null ) {
109
  }
110
  }
111
 
112
- $data .= ( $wpmem->mod_reg == 1 ) ? '"' . ( get_user_meta( $user, 'active', 1 ) ) ? __( 'Yes' ) : __( 'No' ) . '",' : '';
113
  $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "exp_type", true ) . '",' : '';
114
  $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "expires", true ) . '",' : '';
115
 
109
  }
110
  }
111
 
112
+ $data .= ( $wpmem->mod_reg == 1 ) ? '"' . ( get_user_meta( $user, 'active', 1 ) ? __( 'Yes' ) : __( 'No' ) ) . '",' : '';
113
  $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "exp_type", true ) . '",' : '';
114
  $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "expires", true ) . '",' : '';
115
 
inc/core.php CHANGED
@@ -567,14 +567,15 @@ function wpmem_securify_comments_array( $comments , $post_id ) {
567
  */
568
  function wpmem_redirect_to_login() {
569
 
570
- global $wpmem;
571
 
572
  if( ! is_user_logged_in() && $wpmem->is_blocked() ) {
573
- global $post;
574
- // Get the page location.
575
- $page = urlencode( "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
576
 
577
- $url = wpmem_chk_qstr( $wpmem->user_pages['login'] ) . 'redirect_to=' . $page;
 
 
 
 
578
 
579
  wp_redirect( $url );
580
  exit();
567
  */
568
  function wpmem_redirect_to_login() {
569
 
570
+ global $wp, $post, $wpmem;
571
 
572
  if( ! is_user_logged_in() && $wpmem->is_blocked() ) {
 
 
 
573
 
574
+ // Get current page location.
575
+ $current_page = home_url( add_query_arg( array(), $wp->request ) );
576
+ $redirect_to = urlencode( $current_page );
577
+
578
+ $url = wpmem_chk_qstr( $wpmem->user_pages['login'] ) . 'redirect_to=' . $redirect_to;
579
 
580
  wp_redirect( $url );
581
  exit();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.1
5
  Tested up to: 4.3.1
6
- Stable tag: 3.0.5
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
@@ -111,7 +111,7 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
111
 
112
  == Upgrade Notice ==
113
 
114
- WP-Members 3.0.5 is a functional improvement release with minimal core changes.
115
  WP-Members 3.0.0 is a major version release. Please review the changelog: http://rkt.bz/v30
116
 
117
  == Screenshots ==
@@ -135,6 +135,14 @@ WP-Members 3.0.0 is a major version release. Please review the changelog: http:/
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
138
  = 3.0.5 =
139
 
140
  * Updated wpmem_pwd_change and wpmem_pwd_reset action hooks to include password as a parameter.
@@ -337,4 +345,4 @@ Miscellaneous Changes
337
  * Updated autoexcerpt function
338
  * New filter hooks for post editor meta box titles: wpmem_admin_post_meta_title, wpmem_admin_page_meta_title
339
  * Some updates to existing stylesheets
340
- * Added new stylesheets, including two with non-floated elements. Generic, non-floated stylesheet new default for fresh installs
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.1
5
  Tested up to: 4.3.1
6
+ Stable tag: 3.0.6
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
111
 
112
  == Upgrade Notice ==
113
 
114
+ WP-Members 3.0.6 is a functional improvement release with minimal core changes.
115
  WP-Members 3.0.0 is a major version release. Please review the changelog: http://rkt.bz/v30
116
 
117
  == Screenshots ==
135
 
136
  == Changelog ==
137
 
138
+ = 3.0.6 =
139
+
140
+ * Updates to localization function - documented plugin_locale filter, wpmem_localization_file filter, and improved load_textdomain logic.
141
+ * Added /lang domain path to plugin header.
142
+ * Fixed a bug in the user export function that broke CSV columns when moderated registration was turned on.
143
+ * Improved current page retrieval in wpmem_redirect_to_login() function.
144
+ * Fixed admin enqueued scripts (post/page screen hook did not load from new location).
145
+
146
  = 3.0.5 =
147
 
148
  * Updated wpmem_pwd_change and wpmem_pwd_reset action hooks to include password as a parameter.
345
  * Updated autoexcerpt function
346
  * New filter hooks for post editor meta box titles: wpmem_admin_post_meta_title, wpmem_admin_page_meta_title
347
  * Some updates to existing stylesheets
348
+ * Added new stylesheets, including two with non-floated elements. Generic, non-floated stylesheet new default for fresh installs
wp-members.php CHANGED
@@ -3,10 +3,11 @@
3
  Plugin Name: WP-Members
4
  Plugin URI: http://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
- Version: 3.0.5
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
 
10
  License: GPLv2
11
  */
12
 
@@ -61,7 +62,7 @@ License: GPLv2
61
 
62
 
63
  // Initialize constants.
64
- define( 'WPMEM_VERSION', '3.0.5' );
65
  define( 'WPMEM_DEBUG', false );
66
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
67
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
@@ -218,7 +219,6 @@ function wpmem_chk_admin() {
218
  function wpmem_admin_options() {
219
  if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
220
  $plugin_page = add_options_page ( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
221
- add_action( 'load-'.$plugin_page, 'wpmem_load_admin_js' ); // enqueues javascript for admin
222
  }
223
  }
224
 
@@ -284,20 +284,29 @@ function wpmem_load_textdomain() {
284
 
285
  // @todo See: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
286
 
 
287
  $domain = 'wp-members';
288
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
289
 
 
 
 
 
290
  /**
291
  * Filter translation file.
292
  *
 
 
 
 
 
293
  * @since 3.0.0
294
  *
295
  * @param string $file The translation file to load.
296
  */
297
  $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo' );
298
-
299
- $loaded = true;
300
- if ( $loaded == load_textdomain( $domain, $file ) ) {
301
  return $loaded;
302
  } else {
303
 
@@ -314,4 +323,4 @@ function wpmem_load_textdomain() {
314
  return;
315
  }
316
 
317
- // End of File.
3
  Plugin Name: WP-Members
4
  Plugin URI: http://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
+ Version: 3.0.6
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
10
+ Domain Path: /lang
11
  License: GPLv2
12
  */
13
 
62
 
63
 
64
  // Initialize constants.
65
+ define( 'WPMEM_VERSION', '3.0.6' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
219
  function wpmem_admin_options() {
220
  if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
221
  $plugin_page = add_options_page ( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
 
222
  }
223
  }
224
 
284
 
285
  // @todo See: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
286
 
287
+ // Plugin textdomain.
288
  $domain = 'wp-members';
 
289
 
290
+ // Wordpress locale.
291
+ /** This filter is documented in wp-includes/l10n.php */
292
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
293
+
294
  /**
295
  * Filter translation file.
296
  *
297
+ * If the translate.wordpress.org language pack is available, it will
298
+ * be /wp-content/languages/plugins/wp-members-{locale}.mo by default.
299
+ * You can filter this if you want to load a language pack from a
300
+ * different location (or different file name).
301
+ *
302
  * @since 3.0.0
303
  *
304
  * @param string $file The translation file to load.
305
  */
306
  $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo' );
307
+
308
+ $loaded = load_textdomain( $domain, $file );
309
+ if ( $loaded ) {
310
  return $loaded;
311
  } else {
312
 
323
  return;
324
  }
325
 
326
+ // End of File.