Version Description
- Added reCAPTCHA version 2 as an option. v1 will remain available for now, to be fully deprecated later.
- Fixed widget to use __construct for WP 4.3 compatibility.
- Added error checking for WP reserved names when adding new custom fields.
- Added wpmem_wp_reserved_terms filter for overriding reserved terms list.
- Added trim whitespace to password reset and password change form validation.
Download this release
Release Info
Developer | cbutlerjr |
Plugin | WP-Members Membership Plugin |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- README.md +14 -0
- admin/dialogs.php +5 -3
- admin/tab-captcha.php +51 -11
- admin/tab-fields.php +7 -0
- admin/tab-options.php +1 -0
- admin/user-profile.php +2 -2
- inc/class-wp-members-widget.php +9 -6
- inc/core.php +38 -8
- inc/forms.php +11 -2
- inc/register.php +23 -0
- inc/utilities.php +24 -1
- readme.txt +14 -6
- wp-members.php +2 -2
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# WP-Members #
|
2 |
+
|
3 |
+
WP-Members™ is a free membership management framework for WordPress® that restricts content to registered users.
|
4 |
+
|
5 |
+
## Description ##
|
6 |
+
|
7 |
+
This is the development repository for the WP-Members plugin for WordPress.
|
8 |
+
|
9 |
+
## Usage Information ##
|
10 |
+
|
11 |
+
Keep in mind that the branch here is a development branch, so it should be tested prior to loading to a production site.
|
12 |
+
|
13 |
+
If you are looking for a production ready version of the plugin, use the version hosted here:
|
14 |
+
http://wordpress.org/extend/plugins/wp-members/
|
admin/dialogs.php
CHANGED
@@ -77,9 +77,11 @@ function wpmem_a_do_warnings( $did_update ) {
|
|
77 |
|
78 |
// Haven't entered recaptcha api keys.
|
79 |
if ( $warnings_off && $wpmem->captcha == 1 ) {
|
80 |
-
$wpmem_captcha = get_option('wpmembers_captcha');
|
81 |
-
if (
|
82 |
-
|
|
|
|
|
83 |
}
|
84 |
}
|
85 |
|
77 |
|
78 |
// Haven't entered recaptcha api keys.
|
79 |
if ( $warnings_off && $wpmem->captcha == 1 ) {
|
80 |
+
$wpmem_captcha = get_option( 'wpmembers_captcha' );
|
81 |
+
if ( isset( $wpmem_captcha['recaptcha'] ) ) {
|
82 |
+
if ( ! $wpmem_captcha['recaptcha']['public'] || ! $wpmem_captcha['recaptcha']['private'] ) {
|
83 |
+
wpmem_a_warning_msg(6);
|
84 |
+
}
|
85 |
}
|
86 |
}
|
87 |
|
admin/tab-captcha.php
CHANGED
@@ -57,7 +57,11 @@ function wpmem_a_build_captcha_options() {
|
|
57 |
<table class="form-table">
|
58 |
<?php // if reCAPTCHA is enabled...
|
59 |
if ( $wpmem->captcha == 1 ) {
|
60 |
-
$show_update_button = true;
|
|
|
|
|
|
|
|
|
61 |
<tr>
|
62 |
<td colspan="2">
|
63 |
<p><?php _e( 'reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-members' ); ?></p>
|
@@ -69,22 +73,44 @@ function wpmem_a_build_captcha_options() {
|
|
69 |
<th scope="row"><?php _e( 'reCAPTCHA Keys', 'wp-members' ); ?></th>
|
70 |
<td>
|
71 |
<?php printf( __( 'reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members' ), "<a href=\"https://www.google.com/recaptcha/admin#whyrecaptcha\" target=\"_blank\">", '</a>' ); ?>.<br />
|
72 |
-
<?php _e( 'Public Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $
|
73 |
-
<?php _e( 'Private Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $
|
74 |
</td>
|
75 |
</tr>
|
76 |
<tr valign="top">
|
77 |
<th scope="row"><?php _e( 'Choose Theme', 'wp-members' ); ?></th>
|
78 |
<td>
|
79 |
<select name="wpmem_captcha_theme"><?php
|
80 |
-
echo wpmem_create_formfield( __( 'Red', 'wp-members' ), 'option', 'red', $
|
81 |
-
echo wpmem_create_formfield( __( 'White', 'wp-members' ), 'option', 'white', $
|
82 |
-
echo wpmem_create_formfield( __( 'Black Glass', 'wp-members' ), 'option', 'blackglass', $
|
83 |
-
echo wpmem_create_formfield( __( 'Clean', 'wp-members' ), 'option', 'clean', $
|
84 |
</select>
|
85 |
</td>
|
86 |
</tr>
|
87 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
// If Really Simple CAPTCHA is enabled.
|
89 |
} elseif ( $wpmem->captcha == 2 ) {
|
90 |
|
@@ -160,11 +186,23 @@ function wpmem_a_build_captcha_options() {
|
|
160 |
</tr><?php
|
161 |
}
|
162 |
} // End if RSC is selected.
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
<tr valign="top">
|
165 |
<th scope="row"> </th>
|
166 |
<td>
|
167 |
-
<input type="hidden" name="wpmem_recaptcha_type" value="<?php echo
|
168 |
<input type="hidden" name="wpmem_admin_a" value="update_captcha" />
|
169 |
<input type="submit" name="save" class="button-primary" value="<?php _e( 'Update CAPTCHA Settings', 'wp-members' ); ?> »" />
|
170 |
</td>
|
@@ -197,7 +235,7 @@ function wpmem_update_captcha() {
|
|
197 |
$update_type = $_POST['wpmem_recaptcha_type'];
|
198 |
$new_settings = array();
|
199 |
|
200 |
-
if ( $update_type == 'recaptcha' ) {
|
201 |
if ( array_key_exists( 'really_simple', $settings ) ) {
|
202 |
// Updating recaptcha but need to maintain really_simple.
|
203 |
$new_settings['really_simple'] = $settings['really_simple'];
|
@@ -205,8 +243,10 @@ function wpmem_update_captcha() {
|
|
205 |
$new_settings['recaptcha'] = array(
|
206 |
'public' => $_POST['wpmem_captcha_publickey'],
|
207 |
'private' => $_POST['wpmem_captcha_privatekey'],
|
208 |
-
'theme' => $_POST['wpmem_captcha_theme'],
|
209 |
);
|
|
|
|
|
|
|
210 |
}
|
211 |
|
212 |
if ( $update_type == 'really_simple' ) {
|
57 |
<table class="form-table">
|
58 |
<?php // if reCAPTCHA is enabled...
|
59 |
if ( $wpmem->captcha == 1 ) {
|
60 |
+
$show_update_button = true;
|
61 |
+
$private_key = ( isset( $wpmem_captcha['recaptcha'] ) ) ? $wpmem_captcha['recaptcha']['private'] : '';
|
62 |
+
$public_key = ( isset( $wpmem_captcha['recaptcha'] ) ) ? $wpmem_captcha['recaptcha']['public'] : '';
|
63 |
+
$captcha_theme = ( isset( $wpmem_captcha['recaptcha'] ) ) ? $wpmem_captcha['recaptcha']['theme'] : '';
|
64 |
+
?>
|
65 |
<tr>
|
66 |
<td colspan="2">
|
67 |
<p><?php _e( 'reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-members' ); ?></p>
|
73 |
<th scope="row"><?php _e( 'reCAPTCHA Keys', 'wp-members' ); ?></th>
|
74 |
<td>
|
75 |
<?php printf( __( 'reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members' ), "<a href=\"https://www.google.com/recaptcha/admin#whyrecaptcha\" target=\"_blank\">", '</a>' ); ?>.<br />
|
76 |
+
<?php _e( 'Public Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $public_key; ?>" /><br />
|
77 |
+
<?php _e( 'Private Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $private_key; ?>" />
|
78 |
</td>
|
79 |
</tr>
|
80 |
<tr valign="top">
|
81 |
<th scope="row"><?php _e( 'Choose Theme', 'wp-members' ); ?></th>
|
82 |
<td>
|
83 |
<select name="wpmem_captcha_theme"><?php
|
84 |
+
echo wpmem_create_formfield( __( 'Red', 'wp-members' ), 'option', 'red', $captcha_theme );
|
85 |
+
echo wpmem_create_formfield( __( 'White', 'wp-members' ), 'option', 'white', $captcha_theme );
|
86 |
+
echo wpmem_create_formfield( __( 'Black Glass', 'wp-members' ), 'option', 'blackglass', $captcha_theme );
|
87 |
+
echo wpmem_create_formfield( __( 'Clean', 'wp-members' ), 'option', 'clean', $captcha_theme ); ?>
|
88 |
</select>
|
89 |
</td>
|
90 |
</tr>
|
91 |
<?php
|
92 |
+
// if reCAPTCHA v2 is enabled...
|
93 |
+
} elseif ( $wpmem->captcha == 3 ) {
|
94 |
+
$show_update_button = true;
|
95 |
+
$private_key = ( isset( $wpmem_captcha['recaptcha'] ) ) ? $wpmem_captcha['recaptcha']['private'] : '';
|
96 |
+
$public_key = ( isset( $wpmem_captcha['recaptcha'] ) ) ? $wpmem_captcha['recaptcha']['public'] : '';
|
97 |
+
?>
|
98 |
+
<tr>
|
99 |
+
<td colspan="2">
|
100 |
+
<p><?php _e( 'reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-members' ); ?></p>
|
101 |
+
<p><?php printf( __( 'reCAPTCHA asks commenters to retype two words scanned from a book to prove that they are a human. This verifies that they are not a spambot while also correcting the automatic scans of old books. So you get less spam, and the world gets accurately digitized books. Everybody wins! For details, visit the %s reCAPTCHA website%s', 'wp-members' ), '<a href="http://www.google.com/recaptcha/intro/index.html" target="_blank">', '</a>' ); ?>.</p>
|
102 |
+
<p>
|
103 |
+
</td>
|
104 |
+
</tr>
|
105 |
+
<tr valign="top">
|
106 |
+
<th scope="row"><?php _e( 'reCAPTCHA Keys', 'wp-members' ); ?></th>
|
107 |
+
<td>
|
108 |
+
<?php printf( __( 'reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members' ), "<a href=\"https://www.google.com/recaptcha/admin#whyrecaptcha\" target=\"_blank\">", '</a>' ); ?>.<br />
|
109 |
+
<?php _e( 'Public Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $public_key; ?>" /><br />
|
110 |
+
<?php _e( 'Private Key', 'wp-members' ); ?>: <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $private_key; ?>" />
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
<?php
|
114 |
// If Really Simple CAPTCHA is enabled.
|
115 |
} elseif ( $wpmem->captcha == 2 ) {
|
116 |
|
186 |
</tr><?php
|
187 |
}
|
188 |
} // End if RSC is selected.
|
189 |
+
if ( $show_update_button ) {
|
190 |
+
|
191 |
+
switch ( $wpmem->captcha ) {
|
192 |
+
case 1:
|
193 |
+
$captcha_type = 'recaptcha';
|
194 |
+
break;
|
195 |
+
case 2:
|
196 |
+
$captcha_type = 'really_simple';
|
197 |
+
break;
|
198 |
+
case 3:
|
199 |
+
$captcha_type = 'recaptcha2';
|
200 |
+
break;
|
201 |
+
} ?>
|
202 |
<tr valign="top">
|
203 |
<th scope="row"> </th>
|
204 |
<td>
|
205 |
+
<input type="hidden" name="wpmem_recaptcha_type" value="<?php echo $captcha_type ?>" />
|
206 |
<input type="hidden" name="wpmem_admin_a" value="update_captcha" />
|
207 |
<input type="submit" name="save" class="button-primary" value="<?php _e( 'Update CAPTCHA Settings', 'wp-members' ); ?> »" />
|
208 |
</td>
|
235 |
$update_type = $_POST['wpmem_recaptcha_type'];
|
236 |
$new_settings = array();
|
237 |
|
238 |
+
if ( $update_type == 'recaptcha' || $update_type == 'recaptcha2' ) {
|
239 |
if ( array_key_exists( 'really_simple', $settings ) ) {
|
240 |
// Updating recaptcha but need to maintain really_simple.
|
241 |
$new_settings['really_simple'] = $settings['really_simple'];
|
243 |
$new_settings['recaptcha'] = array(
|
244 |
'public' => $_POST['wpmem_captcha_publickey'],
|
245 |
'private' => $_POST['wpmem_captcha_privatekey'],
|
|
|
246 |
);
|
247 |
+
if ( $update_type == 'recaptcha' && isset( $_POST['wpmem_captcha_theme'] ) ) {
|
248 |
+
$new_settings['recaptcha']['theme'] = $_POST['wpmem_captcha_theme'];
|
249 |
+
}
|
250 |
}
|
251 |
|
252 |
if ( $update_type == 'really_simple' ) {
|
admin/tab-fields.php
CHANGED
@@ -190,6 +190,13 @@ function wpmem_update_fields( $action ) {
|
|
190 |
$chk_fields[] = $field[2];
|
191 |
}
|
192 |
$add_field_err_msg = ( in_array( $_POST['add_option'], $chk_fields ) ) ? __( 'A field with that option name already exists', 'wp-members' ) : $add_field_err_msg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
// Error check option name for spaces and replace with underscores.
|
195 |
$us_option = $_POST['add_option'];
|
190 |
$chk_fields[] = $field[2];
|
191 |
}
|
192 |
$add_field_err_msg = ( in_array( $_POST['add_option'], $chk_fields ) ) ? __( 'A field with that option name already exists', 'wp-members' ) : $add_field_err_msg;
|
193 |
+
|
194 |
+
// Error check for reserved terms.
|
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.
|
202 |
$us_option = $_POST['add_option'];
|
admin/tab-options.php
CHANGED
@@ -162,6 +162,7 @@ function wpmem_a_build_options() {
|
|
162 |
<select name="wpmem_settings_captcha">
|
163 |
<option value="0"<?php echo ( $wpmem->captcha == 0 ) ? ' selected ' : ''; ?>><?php _e( 'None', 'wp-members' ); ?></option>
|
164 |
<option value="1"<?php echo ( $wpmem->captcha == 1 ) ? ' selected ' : ''; ?>>reCAPTCHA</option>
|
|
|
165 |
<option value="2"<?php echo ( $wpmem->captcha == 2 ) ? ' selected ' : ''; ?>>Really Simple CAPTCHA</option>
|
166 |
</select>
|
167 |
</li>
|
162 |
<select name="wpmem_settings_captcha">
|
163 |
<option value="0"<?php echo ( $wpmem->captcha == 0 ) ? ' selected ' : ''; ?>><?php _e( 'None', 'wp-members' ); ?></option>
|
164 |
<option value="1"<?php echo ( $wpmem->captcha == 1 ) ? ' selected ' : ''; ?>>reCAPTCHA</option>
|
165 |
+
<option value="3"<?php echo ( $wpmem->captcha == 3 ) ? ' selected ' : ''; ?>>reCAPTCHA v2</option>
|
166 |
<option value="2"<?php echo ( $wpmem->captcha == 2 ) ? ' selected ' : ''; ?>>Really Simple CAPTCHA</option>
|
167 |
</select>
|
168 |
</li>
|
admin/user-profile.php
CHANGED
@@ -51,7 +51,7 @@ function wpmem_admin_fields() {
|
|
51 |
<table class="form-table">
|
52 |
<?php
|
53 |
// Get fields.
|
54 |
-
$wpmem_fields = get_option( 'wpmembers_fields' );
|
55 |
// Get excluded meta.
|
56 |
$exclude = wpmem_get_excluded_meta( 'admin-profile' );
|
57 |
|
@@ -169,7 +169,7 @@ function wpmem_admin_update() {
|
|
169 |
global $wpmem;
|
170 |
|
171 |
$user_id = $_REQUEST['user_id'];
|
172 |
-
$wpmem_fields = get_option( 'wpmembers_fields' );
|
173 |
|
174 |
/**
|
175 |
* Fires before the user profile is updated.
|
51 |
<table class="form-table">
|
52 |
<?php
|
53 |
// Get fields.
|
54 |
+
$wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' );
|
55 |
// Get excluded meta.
|
56 |
$exclude = wpmem_get_excluded_meta( 'admin-profile' );
|
57 |
|
169 |
global $wpmem;
|
170 |
|
171 |
$user_id = $_REQUEST['user_id'];
|
172 |
+
$wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' );
|
173 |
|
174 |
/**
|
175 |
* Fires before the user profile is updated.
|
inc/class-wp-members-widget.php
CHANGED
@@ -9,12 +9,15 @@ class widget_wpmemwidget extends WP_Widget {
|
|
9 |
/**
|
10 |
* Sets up the WP-Members login widget.
|
11 |
*/
|
12 |
-
function
|
13 |
-
|
14 |
-
'
|
15 |
-
'
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
/**
|
9 |
/**
|
10 |
* Sets up the WP-Members login widget.
|
11 |
*/
|
12 |
+
function __construct() {
|
13 |
+
parent::__construct(
|
14 |
+
'widget_wpmemwidget',
|
15 |
+
'WP-Members Login',
|
16 |
+
array(
|
17 |
+
'classname' => 'wp-members',
|
18 |
+
'description' => __( 'Displays the WP-Members sidebar login.', 'wp-members' ),
|
19 |
+
)
|
20 |
+
);
|
21 |
}
|
22 |
|
23 |
/**
|
inc/core.php
CHANGED
@@ -144,7 +144,11 @@ function wpmem_login() {
|
|
144 |
if ( ! is_wp_error( $user ) ) {
|
145 |
|
146 |
// Determine where to put the user after login.
|
147 |
-
|
|
|
|
|
|
|
|
|
148 |
|
149 |
/**
|
150 |
* Filter the redirect url.
|
@@ -285,8 +289,8 @@ function wpmem_change_password() {
|
|
285 |
global $user_ID;
|
286 |
if ( isset( $_POST['formsubmit'] ) ) {
|
287 |
|
288 |
-
$pass1 = $_POST['pass1'];
|
289 |
-
$pass2 = $_POST['pass2'];
|
290 |
|
291 |
if ( ! $pass1 && ! $pass2 ) { // Check for both fields being empty.
|
292 |
|
@@ -342,8 +346,8 @@ function wpmem_reset_password() {
|
|
342 |
* @param array The username and email.
|
343 |
*/
|
344 |
$arr = apply_filters( 'wpmem_pwdreset_args', array(
|
345 |
-
'user' => ( isset( $_POST['user'] ) ) ? $_POST['user'] : '',
|
346 |
-
'email' => ( isset( $_POST['email'] ) ) ? $_POST['email'] : '',
|
347 |
) );
|
348 |
|
349 |
if ( ! $arr['user'] || ! $arr['email'] ) {
|
@@ -539,6 +543,7 @@ function wpmem_securify_comments( $open ) {
|
|
539 |
return $open;
|
540 |
}
|
541 |
|
|
|
542 |
/**
|
543 |
* Empties the comments array if content is blocked.
|
544 |
*
|
@@ -546,9 +551,34 @@ function wpmem_securify_comments( $open ) {
|
|
546 |
*
|
547 |
* @return array $comments The comments array.
|
548 |
*/
|
549 |
-
function wpmem_securify_comments_array( $comments , $post_id ) {
|
550 |
-
|
|
|
551 |
return $comments;
|
552 |
}
|
553 |
|
554 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
if ( ! is_wp_error( $user ) ) {
|
145 |
|
146 |
// Determine where to put the user after login.
|
147 |
+
if ( isset( $_POST['redirect_to'] ) ) {
|
148 |
+
$redirect_to = trim( $_POST['redirect_to'] );
|
149 |
+
} else {
|
150 |
+
$redirect_to = $_SERVER['REQUEST_URI'] . ( ( isset( $_SERVER['QUERY_STRING'] ) ) ? $_SERVER['QUERY_STRING'] : '' );
|
151 |
+
}
|
152 |
|
153 |
/**
|
154 |
* Filter the redirect url.
|
289 |
global $user_ID;
|
290 |
if ( isset( $_POST['formsubmit'] ) ) {
|
291 |
|
292 |
+
$pass1 = trim( $_POST['pass1'] );
|
293 |
+
$pass2 = trim( $_POST['pass2'] );
|
294 |
|
295 |
if ( ! $pass1 && ! $pass2 ) { // Check for both fields being empty.
|
296 |
|
346 |
* @param array The username and email.
|
347 |
*/
|
348 |
$arr = apply_filters( 'wpmem_pwdreset_args', array(
|
349 |
+
'user' => ( isset( $_POST['user'] ) ) ? trim( $_POST['user'] ) : '',
|
350 |
+
'email' => ( isset( $_POST['email'] ) ) ? trim( $_POST['email'] ) : '',
|
351 |
) );
|
352 |
|
353 |
if ( ! $arr['user'] || ! $arr['email'] ) {
|
543 |
return $open;
|
544 |
}
|
545 |
|
546 |
+
|
547 |
/**
|
548 |
* Empties the comments array if content is blocked.
|
549 |
*
|
551 |
*
|
552 |
* @return array $comments The comments array.
|
553 |
*/
|
554 |
+
function wpmem_securify_comments_array( $comments , $post_id ) {
|
555 |
+
global $wpmem;
|
556 |
+
$comments = ( ! is_user_logged_in() && $wpmem->is_blocked() ) ? array() : $comments;
|
557 |
return $comments;
|
558 |
}
|
559 |
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Redirects a user to defined login page with return redirect.
|
563 |
+
*
|
564 |
+
* @since 3.0.2
|
565 |
+
*/
|
566 |
+
function wpmem_redirect_to_login() {
|
567 |
+
|
568 |
+
global $wpmem;
|
569 |
+
|
570 |
+
if( ! is_user_logged_in() && $wpmem->is_blocked() ) {
|
571 |
+
global $post;
|
572 |
+
// Get the page location.
|
573 |
+
$page = urlencode( "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
|
574 |
+
|
575 |
+
$url = wpmem_chk_qstr( $wpmem->user_pages['login'] ) . 'redirect_to=' . $page;
|
576 |
+
|
577 |
+
wp_redirect( $url );
|
578 |
+
exit();
|
579 |
+
}
|
580 |
+
return;
|
581 |
+
}
|
582 |
+
|
583 |
+
|
584 |
+
// End of File.
|
inc/forms.php
CHANGED
@@ -777,7 +777,7 @@ function wpmem_inc_registration( $toggle = 'new', $heading = '' ) {
|
|
777 |
}
|
778 |
|
779 |
// do recaptcha if enabled
|
780 |
-
if ( $wpmem->captcha == 1 && $toggle != 'edit' ) { // don't show on edit page!
|
781 |
|
782 |
// get the captcha options
|
783 |
$wpmem_captcha = get_option( 'wpmembers_captcha' );
|
@@ -930,7 +930,10 @@ function wpmem_inc_recaptcha( $arr ) {
|
|
930 |
// determine if we need ssl
|
931 |
$http = wpmem_use_ssl();
|
932 |
|
933 |
-
$
|
|
|
|
|
|
|
934 |
var RecaptchaOptions = { theme : \''. $arr['theme'] . '\'' . $lang . ' };
|
935 |
</script>
|
936 |
<script type="text/javascript" src="' . $http . 'www.google.com/recaptcha/api/challenge?k=' . $arr['public'] . '"></script>
|
@@ -940,6 +943,12 @@ function wpmem_inc_recaptcha( $arr ) {
|
|
940 |
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
941 |
</noscript>';
|
942 |
|
|
|
|
|
|
|
|
|
|
|
|
|
943 |
/**
|
944 |
* Filter the reCAPTCHA HTML.
|
945 |
*
|
777 |
}
|
778 |
|
779 |
// do recaptcha if enabled
|
780 |
+
if ( ( $wpmem->captcha == 1 || $wpmem->captcha == 3 ) && $toggle != 'edit' ) { // don't show on edit page!
|
781 |
|
782 |
// get the captcha options
|
783 |
$wpmem_captcha = get_option( 'wpmembers_captcha' );
|
930 |
// determine if we need ssl
|
931 |
$http = wpmem_use_ssl();
|
932 |
|
933 |
+
global $wpmem;
|
934 |
+
if ( $wpmem->captcha == 1 ) {
|
935 |
+
|
936 |
+
$str = '<script type="text/javascript">
|
937 |
var RecaptchaOptions = { theme : \''. $arr['theme'] . '\'' . $lang . ' };
|
938 |
</script>
|
939 |
<script type="text/javascript" src="' . $http . 'www.google.com/recaptcha/api/challenge?k=' . $arr['public'] . '"></script>
|
943 |
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
944 |
</noscript>';
|
945 |
|
946 |
+
} elseif ( $wpmem->captcha == 3 ) {
|
947 |
+
|
948 |
+
$str = '<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
949 |
+
<div class="g-recaptcha" data-sitekey="' . $arr['public'] . '"></div>';
|
950 |
+
}
|
951 |
+
|
952 |
/**
|
953 |
* Filter the reCAPTCHA HTML.
|
954 |
*
|
inc/register.php
CHANGED
@@ -192,6 +192,29 @@ function wpmem_registration( $toggle ) {
|
|
192 |
return "empty"; exit();
|
193 |
}
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
|
197 |
// Check for user defined password.
|
192 |
return "empty"; exit();
|
193 |
}
|
194 |
}
|
195 |
+
} elseif ( $wpmem->captcha == 3 && $wpmem_captcha['recaptcha'] ) {
|
196 |
+
// Get the captcha response.
|
197 |
+
if ( isset( $_POST['g-recaptcha-response'] ) ) {
|
198 |
+
$captcha = $_POST['g-recaptcha-response'];
|
199 |
+
}
|
200 |
+
|
201 |
+
// If there is no captcha value, return error.
|
202 |
+
if ( ! $captcha ) {
|
203 |
+
$wpmem_themsg = __( 'You must complete the CAPTCHA form.', 'wp-members' );
|
204 |
+
return "empty"; exit();
|
205 |
+
}
|
206 |
+
|
207 |
+
// We need the private key for validation.
|
208 |
+
$privatekey = $wpmem_captcha['recaptcha']['private'];
|
209 |
+
|
210 |
+
// Validate the captcha.
|
211 |
+
$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $privatekey . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'] );
|
212 |
+
|
213 |
+
// If captcha validation was unsuccessful.
|
214 |
+
if ( $response['success'] == false ) {
|
215 |
+
$wpmem_themsg = __( 'CAPTCHA was not valid.', 'wp-members' );
|
216 |
+
return "empty"; exit();
|
217 |
+
}
|
218 |
}
|
219 |
|
220 |
// Check for user defined password.
|
inc/utilities.php
CHANGED
@@ -131,7 +131,7 @@ function wpmem_chk_qstr( $url = null ) {
|
|
131 |
$permalink = get_option( 'permalink_structure' );
|
132 |
if ( ! $permalink ) {
|
133 |
$url = ( ! $url ) ? get_option( 'home' ) . "/?" . $_SERVER['QUERY_STRING'] : $url;
|
134 |
-
$return_url = $url . "&
|
135 |
} else {
|
136 |
$url = ( ! $url ) ? get_permalink() : $url;
|
137 |
$return_url = $url . "?";
|
@@ -335,4 +335,27 @@ function wpmem_use_ssl() {
|
|
335 |
return ( is_ssl() ) ? 'https://' : 'http://';
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
/** End of File **/
|
131 |
$permalink = get_option( 'permalink_structure' );
|
132 |
if ( ! $permalink ) {
|
133 |
$url = ( ! $url ) ? get_option( 'home' ) . "/?" . $_SERVER['QUERY_STRING'] : $url;
|
134 |
+
$return_url = $url . "&";
|
135 |
} else {
|
136 |
$url = ( ! $url ) ? get_permalink() : $url;
|
137 |
$return_url = $url . "?";
|
335 |
return ( is_ssl() ) ? 'https://' : 'http://';
|
336 |
}
|
337 |
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Returns an array of WordPress reserved terms.
|
341 |
+
*
|
342 |
+
* @since 3.0.2
|
343 |
+
*
|
344 |
+
* @return array An array of WordPress reserved terms.
|
345 |
+
*/
|
346 |
+
function wpmem_wp_reserved_terms() {
|
347 |
+
$reserved_terms = array( 'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'error', 'exact', 'feed', 'fields', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'theme', 'type', 'w', 'withcomments', 'withoutcomments', 'year' );
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Filter the array of reserved terms.
|
351 |
+
*
|
352 |
+
* @since 3.0.2
|
353 |
+
*
|
354 |
+
* @param array $reserved_terms
|
355 |
+
*/
|
356 |
+
$reserved_terms = apply_filters( 'wpmem_wp_reserved_terms', $reserved_terms );
|
357 |
+
|
358 |
+
return $reserved_terms;
|
359 |
+
}
|
360 |
+
|
361 |
/** End of File **/
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
=== WP-Members ===
|
2 |
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.
|
6 |
-
Stable tag: 3.0.
|
7 |
License: GPLv2
|
8 |
|
9 |
WP-Members™ is a free membership management framework for WordPress® 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.
|
115 |
WP-Members 3.0.0 is a major version release. Please be sure you have reviewed the changelog before upgrading. http://rkt.bz/v30
|
116 |
|
117 |
== Screenshots ==
|
@@ -128,13 +128,21 @@ WP-Members 3.0.0 is a major version release. Please be sure you have reviewed th
|
|
128 |
|
129 |
6. Posts > All Posts - The plugin adds a column to the list of posts and pages to display if a post or page is unblocked or blocked (the opposite of whatver you have set for the plugin's default in the options tab).
|
130 |
|
131 |
-
7. Posts > Edit Post - The plugin adds a meta box to the post/page editor allowing you to set an individual post to be blocked or unblocked (the opposite of
|
132 |
|
133 |
-
8.
|
134 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 3.0.1 =
|
139 |
|
140 |
* Fixed use of wp_signon() for ssl.
|
1 |
+
=== WP-Members: WordPress Membership Framework ===
|
2 |
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
|
6 |
+
Stable tag: 3.0.2
|
7 |
License: GPLv2
|
8 |
|
9 |
WP-Members™ is a free membership management framework for WordPress® that restricts content to registered users.
|
111 |
|
112 |
== Upgrade Notice ==
|
113 |
|
114 |
+
WP-Members 3.0.2 is feature and fix release. See the change log for detail.
|
115 |
WP-Members 3.0.0 is a major version release. Please be sure you have reviewed the changelog before upgrading. http://rkt.bz/v30
|
116 |
|
117 |
== Screenshots ==
|
128 |
|
129 |
6. Posts > All Posts - The plugin adds a column to the list of posts and pages to display if a post or page is unblocked or blocked (the opposite of whatver you have set for the plugin's default in the options tab).
|
130 |
|
131 |
+
7. Posts > Edit Post - The plugin adds a meta box to the post/page editor allowing you to set an individual post to be blocked or unblocked (the opposite of whatver your default setting is).
|
132 |
|
133 |
+
8. Responsive forms.
|
134 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 3.0.2 =
|
139 |
+
|
140 |
+
* Added reCAPTCHA version 2 as an option. v1 will remain available for now, to be fully deprecated later.
|
141 |
+
* Fixed widget to use __construct for WP 4.3 compatibility.
|
142 |
+
* Added error checking for WP reserved names when adding new custom fields.
|
143 |
+
* Added wpmem_wp_reserved_terms filter for overriding reserved terms list.
|
144 |
+
* Added trim whitespace to password reset and password change form validation.
|
145 |
+
|
146 |
= 3.0.1 =
|
147 |
|
148 |
* Fixed use of wp_signon() for ssl.
|
wp-members.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
License: GPLv2
|
@@ -60,7 +60,7 @@ License: GPLv2
|
|
60 |
|
61 |
|
62 |
// Initialize constants.
|
63 |
-
define( 'WPMEM_VERSION', '3.0.
|
64 |
define( 'WPMEM_DEBUG', false );
|
65 |
define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
|
66 |
define( 'WPMEM_PATH', plugin_dir_path( __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.2
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
License: GPLv2
|
60 |
|
61 |
|
62 |
// Initialize constants.
|
63 |
+
define( 'WPMEM_VERSION', '3.0.2' );
|
64 |
define( 'WPMEM_DEBUG', false );
|
65 |
define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
|
66 |
define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
|