Version Description
- Fixed duplicate ID in login form.
- Fixed user profile update for excluded fields.
- Fixed native WP registration, excluded WP-Members username field in form validation.
- Fixed update post when block status is not changed.
- Rebuilt user interface for post restriction metabox to make it more intuitive.
- Changed "clickable" attribute for field shortcode default to false.
- Added wpmem_user_export_header and wpmem_user_export_row filter for export.
Download this release
Release Info
Developer | cbutlerjr |
Plugin | WP-Members Membership Plugin |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.0 to 3.2.1
- admin/css/admin.css +16 -0
- admin/includes/class-wp-members-admin-api.php +5 -4
- admin/js/admin.js +43 -0
- admin/post.php +40 -29
- admin/user-export.php +40 -29
- inc/class-wp-members-forms.php +2 -2
- inc/class-wp-members-shortcodes.php +5 -4
- inc/class-wp-members-user-profile.php +5 -1
- inc/class-wp-members.php +1 -1
- inc/wp-registration.php +2 -2
- readme.txt +10 -6
- wp-members.php +2 -2
admin/css/admin.css
CHANGED
@@ -58,3 +58,19 @@
|
|
58 |
#sort {
|
59 |
width: 24px;
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
#sort {
|
59 |
width: 24px;
|
60 |
}
|
61 |
+
|
62 |
+
#wpmem_block input {
|
63 |
+
vertical-align: -webkit-baseline-middle;
|
64 |
+
}
|
65 |
+
#wpmem_post_block_status {
|
66 |
+
font-weight: 600;
|
67 |
+
}
|
68 |
+
#wpmem_post_icon_0 {
|
69 |
+
color: red;
|
70 |
+
}
|
71 |
+
#wpmem_post_icon_1 {
|
72 |
+
color: green;
|
73 |
+
}
|
74 |
+
#wpmem_post_icon_2 {
|
75 |
+
color: black;
|
76 |
+
}
|
admin/includes/class-wp-members-admin-api.php
CHANGED
@@ -505,15 +505,16 @@ class WP_Members_Admin_API {
|
|
505 |
* Only loads the js and css on admin screens that use them.
|
506 |
*
|
507 |
* @since 3.1.7
|
508 |
-
* @
|
|
|
509 |
*
|
510 |
* @param str $hook The admin screen hook being loaded.
|
511 |
*/
|
512 |
function dashboard_enqueue_scripts( $hook ) {
|
513 |
-
if (
|
514 |
wp_enqueue_style( 'wpmem-admin', WPMEM_DIR . 'admin/css/admin.css', '', WPMEM_VERSION );
|
515 |
-
}
|
516 |
-
if ( $hook
|
517 |
wp_enqueue_script( 'wpmem-admin', WPMEM_DIR . 'admin/js/admin.js', '', WPMEM_VERSION );
|
518 |
}
|
519 |
}
|
505 |
* Only loads the js and css on admin screens that use them.
|
506 |
*
|
507 |
* @since 3.1.7
|
508 |
+
* @since 3.2.0 Moved into admin object, renamed dashboard_enqueue_scripts().
|
509 |
+
* @since 3.2.1 Load js for post.php hook.
|
510 |
*
|
511 |
* @param str $hook The admin screen hook being loaded.
|
512 |
*/
|
513 |
function dashboard_enqueue_scripts( $hook ) {
|
514 |
+
if ( 'edit.php' == $hook || 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook ) {
|
515 |
wp_enqueue_style( 'wpmem-admin', WPMEM_DIR . 'admin/css/admin.css', '', WPMEM_VERSION );
|
516 |
+
}
|
517 |
+
if ( 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook ) {
|
518 |
wp_enqueue_script( 'wpmem-admin', WPMEM_DIR . 'admin/js/admin.js', '', WPMEM_VERSION );
|
519 |
}
|
520 |
}
|
admin/js/admin.js
CHANGED
@@ -181,3 +181,46 @@
|
|
181 |
});
|
182 |
});
|
183 |
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
});
|
182 |
});
|
183 |
})(jQuery);
|
184 |
+
|
185 |
+
/**
|
186 |
+
* JS for post block status meta box
|
187 |
+
*
|
188 |
+
* @since 3.2.1
|
189 |
+
*/
|
190 |
+
(function($) {
|
191 |
+
$(document).ready(function() {
|
192 |
+
$("#wpmem_block").hide();
|
193 |
+
});
|
194 |
+
$(document).ready(function() {
|
195 |
+
$("#wpmem_edit_block_status").click(function() {
|
196 |
+
$("#wpmem_block").show('normal');
|
197 |
+
$("#wpmem_edit_block_status").hide();
|
198 |
+
});
|
199 |
+
$("#wpmem_cancel_block_status").click(function() {
|
200 |
+
$("#wpmem_block").hide('normal');
|
201 |
+
$("#wpmem_edit_block_status").show();
|
202 |
+
$("#wpmem_post_block_status").text($("input[name=wpmem_block_original_label]").val());
|
203 |
+
$('#wpmem_post_block_status_' + $('input[name=wpmem_block_original_value]')).val().prop("checked", true);
|
204 |
+
});
|
205 |
+
$("#wpmem_ok_block_status").click(function() {
|
206 |
+
$("#wpmem_block").hide('normal');
|
207 |
+
$("#wpmem_edit_block_status").show();
|
208 |
+
$("#wpmem_post_block_status").text($("input[name=wpmem_block]:checked + label").text());
|
209 |
+
if($('#wpmem_block_status_0').is(':checked')) {
|
210 |
+
$("#wpmem_post_icon_0").show();
|
211 |
+
$("#wpmem_post_icon_1").hide();
|
212 |
+
$("#wpmem_post_icon_2").hide();
|
213 |
+
}
|
214 |
+
if($('#wpmem_block_status_1').is(':checked')) {
|
215 |
+
$("#wpmem_post_icon_0").hide();
|
216 |
+
$("#wpmem_post_icon_1").show();
|
217 |
+
$("#wpmem_post_icon_2").hide();
|
218 |
+
}
|
219 |
+
if($('#wpmem_block_status_2').is(':checked')) {
|
220 |
+
$("#wpmem_post_icon_0").hide();
|
221 |
+
$("#wpmem_post_icon_1").hide();
|
222 |
+
$("#wpmem_post_icon_2").show();
|
223 |
+
}
|
224 |
+
});
|
225 |
+
});
|
226 |
+
})(jQuery);
|
admin/post.php
CHANGED
@@ -47,7 +47,7 @@ function wpmem_bulk_posts_action() {
|
|
47 |
jQuery('<option>').val('hide').text('<?php _e( 'Hide', 'wp-members' ) ?>').appendTo("select[name='action']");
|
48 |
jQuery('<option>').val('unblock').text('<?php _e( 'Unblock', 'wp-members' ) ?>').appendTo("select[name='action2']");
|
49 |
jQuery('<option>').val('block').text('<?php _e( 'Block', 'wp-members' ) ?>').appendTo("select[name='action2']");
|
50 |
-
jQuery('<option>').val('hide').text('<?php _e( 'Hide',
|
51 |
});
|
52 |
</script><?php
|
53 |
}
|
@@ -197,34 +197,34 @@ function wpmem_block_meta() {
|
|
197 |
|
198 |
wp_nonce_field( 'wpmem_block_meta_nonce', 'wpmem_block_meta_nonce' );
|
199 |
|
200 |
-
$post_type
|
201 |
-
|
202 |
-
if ( isset( $wpmem->block[ $post->post_type ] ) && $wpmem->block[ $post->post_type ] == 1 ) {
|
203 |
-
$notice_icon = '<span class="dashicons dashicons-lock"></span>';
|
204 |
-
$notice_text = sprintf( __( '%s are blocked by default.', 'wp-members' ), $post_type->labels->name );
|
205 |
-
} else {
|
206 |
-
$notice_icon = '<span class="dashicons dashicons-unlock"></span>';
|
207 |
-
$notice_text = sprintf( __( '%s are not blocked by default.', 'wp-members' ), $post_type->labels->name );
|
208 |
-
}
|
209 |
-
|
210 |
$post_meta_value = get_post_meta( $post->ID, '_wpmem_block', true );
|
211 |
-
|
212 |
$post_meta_value = ( null == $post_meta_value ) ? $wpmem->block[ $post->post_type ] : $post_meta_value;
|
213 |
$post_meta_settings = array(
|
214 |
-
'0' => __( '
|
215 |
-
'1' => __( '
|
216 |
-
'2' => __( '
|
217 |
); ?>
|
218 |
-
<p
|
219 |
-
|
|
|
|
|
|
|
220 |
</p>
|
221 |
<p>
|
222 |
-
<
|
223 |
-
<?php
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
</p>
|
229 |
<?php
|
230 |
/**
|
@@ -306,7 +306,7 @@ function wpmem_post_columns( $columns ) {
|
|
306 |
$post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_text_field( $_REQUEST['post_type'] ) : 'post';
|
307 |
|
308 |
if ( $post_type == 'page' || $post_type == 'post' || array_key_exists( $post_type, $wpmem->post_types ) ) {
|
309 |
-
$columns['wpmem_block'] =
|
310 |
}
|
311 |
return $columns;
|
312 |
}
|
@@ -338,9 +338,20 @@ function wpmem_post_columns_content( $column_name, $post_ID ) {
|
|
338 |
$block_meta = ( $old_block ) ? 1 : ( ( $old_unblock ) ? 0 : $block_meta );
|
339 |
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
}
|
346 |
|
@@ -378,7 +389,7 @@ function wpmem_set_block_status( $status, $post_id, $post_type ) {
|
|
378 |
$prev_value = get_post_meta( $post_id, '_wpmem_block', true );
|
379 |
|
380 |
// Update accordingly.
|
381 |
-
if ( $prev_value && $status != $prev_value ) {
|
382 |
if ( $status == $wpmem->block[ $post_type ] ) {
|
383 |
delete_post_meta( $post_id, '_wpmem_block' );
|
384 |
} else {
|
@@ -386,7 +397,7 @@ function wpmem_set_block_status( $status, $post_id, $post_type ) {
|
|
386 |
}
|
387 |
} elseif ( ! $prev_value && $status != $wpmem->block[ $post_type ] ) {
|
388 |
update_post_meta( $post_id, '_wpmem_block', $status );
|
389 |
-
}
|
390 |
delete_post_meta( $post_id, '_wpmem_block' );
|
391 |
}
|
392 |
|
47 |
jQuery('<option>').val('hide').text('<?php _e( 'Hide', 'wp-members' ) ?>').appendTo("select[name='action']");
|
48 |
jQuery('<option>').val('unblock').text('<?php _e( 'Unblock', 'wp-members' ) ?>').appendTo("select[name='action2']");
|
49 |
jQuery('<option>').val('block').text('<?php _e( 'Block', 'wp-members' ) ?>').appendTo("select[name='action2']");
|
50 |
+
jQuery('<option>').val('hide').text('<?php _e( 'Hide', 'wp-members' ) ?>').appendTo("select[name='action2']");
|
51 |
});
|
52 |
</script><?php
|
53 |
}
|
197 |
|
198 |
wp_nonce_field( 'wpmem_block_meta_nonce', 'wpmem_block_meta_nonce' );
|
199 |
|
200 |
+
$post_type = $wp_post_types[ $post->post_type ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
$post_meta_value = get_post_meta( $post->ID, '_wpmem_block', true );
|
|
|
202 |
$post_meta_value = ( null == $post_meta_value ) ? $wpmem->block[ $post->post_type ] : $post_meta_value;
|
203 |
$post_meta_settings = array(
|
204 |
+
'0' => array( 'text' => __( 'Unblocked', 'wp-members' ), 'icon' => '<span id="wpmem_post_icon_0" class="dashicons dashicons-unlock" ' . ( ( 0 != $post_meta_value ) ? 'style="display:none;"' : '' ) . '></span>' ),
|
205 |
+
'1' => array( 'text' => __( 'Blocked', 'wp-members' ), 'icon' => '<span id="wpmem_post_icon_1" class="dashicons dashicons-lock" ' . ( ( 1 != $post_meta_value ) ? 'style="display:none;"' : '' ) . '></span>' ),
|
206 |
+
'2' => array( 'text' => __( 'Hidden', 'wp-members' ), 'icon' => '<span id="wpmem_post_icon_2" class="dashicons dashicons-hidden" ' . ( ( 2 != $post_meta_value ) ? 'style="display:none;"' : '' ) . '></span>' ),
|
207 |
); ?>
|
208 |
+
<p><?php
|
209 |
+
foreach ( $post_meta_settings as $key => $value ) {
|
210 |
+
echo $value['icon'];
|
211 |
+
} ?> <?php
|
212 |
+
_e( 'Status:', 'wp-members' ); ?> <span id="wpmem_post_block_status"><?php echo $post_meta_settings[ $post_meta_value ]['text']; ?></span> <a href="#" class="hide-if-no-js" id="wpmem_edit_block_status"><?php _e( 'Edit' ); ?></a>
|
213 |
</p>
|
214 |
<p>
|
215 |
+
<div id="wpmem_block">
|
216 |
+
<?php
|
217 |
+
$original_value = ''; $original_label = '';
|
218 |
+
foreach ( $post_meta_settings as $key => $value ) {
|
219 |
+
$original_value = ( $post_meta_value == $key ) ? $key : $original_value;
|
220 |
+
$original_label = ( $post_meta_value == $key ) ? $value['text'] : $original_label;
|
221 |
+
echo '<input type="radio" id="wpmem_block_status_' . $key . '" name="wpmem_block" value="' . $key . '" ' . checked( $post_meta_value, $key, false ) . ' /><label>' . $value['text'] . '</label><br />';
|
222 |
+
}
|
223 |
+
echo '<input type="hidden" id="wpmem_block_original_value" name="wpmem_block_original_value" value="' . $original_value . '" />';
|
224 |
+
echo '<input type="hidden" id="wpmem_block_original_label" name="wpmem_block_original_label" value="' . $original_label . '" />';
|
225 |
+
?>
|
226 |
+
<p><a href="#" class="hide-if-no-js button" id="wpmem_ok_block_status"><?php echo _e( 'OK' ); ?></a> <!--<a href="#" class="hide-if-no-js" id="wpmem_cancel_block_status"><?php _e( 'Cancel' ); ?></a>--></p>
|
227 |
+
</div>
|
228 |
</p>
|
229 |
<?php
|
230 |
/**
|
306 |
$post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_text_field( $_REQUEST['post_type'] ) : 'post';
|
307 |
|
308 |
if ( $post_type == 'page' || $post_type == 'post' || array_key_exists( $post_type, $wpmem->post_types ) ) {
|
309 |
+
$columns['wpmem_block'] = __( 'Status', 'wp-members' );
|
310 |
}
|
311 |
return $columns;
|
312 |
}
|
338 |
$block_meta = ( $old_block ) ? 1 : ( ( $old_unblock ) ? 0 : $block_meta );
|
339 |
}
|
340 |
|
341 |
+
if ( $wpmem->block[ $post_type ] == 1 ) {
|
342 |
+
$block_span = array( 'lock', 'green', 'Blocked' );
|
343 |
+
}
|
344 |
+
if ( $wpmem->block[ $post_type ] == 0 ) {
|
345 |
+
$block_span = array( 'unlock', 'red', 'Unblocked' );
|
346 |
+
}
|
347 |
+
if ( $wpmem->block[ $post_type ] == 1 && $block_meta == '0' ) {
|
348 |
+
$block_span = array( 'unlock', 'red', 'Unblocked' );
|
349 |
+
} elseif ( $wpmem->block[ $post_type ] == 0 && $block_meta == '1' ) {
|
350 |
+
$block_span = array( 'lock', 'green', 'Blocked' );
|
351 |
+
} elseif ( 2 == $block_meta ) {
|
352 |
+
$block_span = array( 'hidden', '', 'Hidden' );
|
353 |
+
}
|
354 |
+
echo '<span class="dashicons dashicons-' . $block_span[0] . '" style="color:' . $block_span[1] . '" title="' . $block_span[2] . '"></span>';
|
355 |
}
|
356 |
}
|
357 |
|
389 |
$prev_value = get_post_meta( $post_id, '_wpmem_block', true );
|
390 |
|
391 |
// Update accordingly.
|
392 |
+
if ( false !== $prev_value && $status != $prev_value ) {
|
393 |
if ( $status == $wpmem->block[ $post_type ] ) {
|
394 |
delete_post_meta( $post_id, '_wpmem_block' );
|
395 |
} else {
|
397 |
}
|
398 |
} elseif ( ! $prev_value && $status != $wpmem->block[ $post_type ] ) {
|
399 |
update_post_meta( $post_id, '_wpmem_block', $status );
|
400 |
+
} elseif ( $status != $prev_value ) {
|
401 |
delete_post_meta( $post_id, '_wpmem_block' );
|
402 |
}
|
403 |
|
admin/user-export.php
CHANGED
@@ -24,6 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
*
|
25 |
* @since 2.9.7
|
26 |
* @since 3.2.0 Updated to use fputcsv.
|
|
|
27 |
*
|
28 |
* @param array $args
|
29 |
* @param array $users
|
@@ -38,7 +39,7 @@ function wpmem_export_users( $args, $users = null ) {
|
|
38 |
$defaults = array(
|
39 |
'export' => 'all',
|
40 |
'filename' => 'wp-members-user-export-' . $today . '.csv',
|
41 |
-
'export_fields' => wpmem_fields(),
|
42 |
'exclude_fields' => array( 'password', 'confirm_password', 'confirm_email' ),
|
43 |
'entity_decode' => false,
|
44 |
);
|
@@ -67,27 +68,36 @@ function wpmem_export_users( $args, $users = null ) {
|
|
67 |
$handle = fopen( 'php://output', 'w' );
|
68 |
fputs( $handle, "\xEF\xBB\xBF" ); // UTF-8 BOM
|
69 |
|
70 |
-
$header =
|
71 |
// Remove excluded fields from $export_fields while setting up $header array.
|
72 |
foreach ( $args['export_fields'] as $meta => $field ) {
|
73 |
if ( in_array( $meta, $args['exclude_fields'] ) ) {
|
74 |
unset( $args['export_fields'][ $meta ] );
|
75 |
} else {
|
76 |
-
$header[] = $field['label'];
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
if ( $wpmem->mod_reg
|
81 |
-
$header[] = __( 'Activated?', 'wp-members');
|
82 |
}
|
83 |
|
84 |
-
if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp
|
85 |
-
$header[] = __( 'Subscription', 'wp-members' );
|
86 |
-
$header[]
|
87 |
}
|
88 |
|
89 |
-
$header[] = __( 'Registered', 'wp-members' );
|
90 |
-
$header[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
fputcsv( $handle, $header );
|
93 |
|
@@ -98,40 +108,41 @@ function wpmem_export_users( $args, $users = null ) {
|
|
98 |
$user_info = get_userdata( $user );
|
99 |
|
100 |
$wp_user_fields = [ 'user_email', 'user_nicename', 'user_url', 'display_name' ];
|
101 |
-
$row = array();
|
102 |
foreach ( $args['export_fields'] as $meta => $field ) {
|
103 |
if ( in_array( $meta, $wp_user_fields ) ) {
|
104 |
-
$row[] = $user_info->{$meta};
|
105 |
} else {
|
106 |
$raw_data = get_user_meta( $user, $meta, true );
|
107 |
-
$row[] = ( $args['entity_decode'] ) ? html_entity_decode( $raw_data ) : $raw_data;
|
108 |
}
|
109 |
}
|
110 |
|
111 |
-
$
|
112 |
-
[
|
113 |
-
$user_info->ID,
|
114 |
-
$user_info->user_login,
|
115 |
-
],
|
116 |
-
$row
|
117 |
-
);
|
118 |
-
|
119 |
-
if ( $wpmem->mod_reg == 1 ) {
|
120 |
-
$row[] = get_user_meta( $user, 'active', 1 ) ? __( 'Yes' ) : __( 'No' );
|
121 |
}
|
122 |
|
123 |
-
if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp
|
124 |
-
$row[] = get_user_meta( $user, 'exp_type', true );
|
125 |
-
$row[]
|
126 |
}
|
127 |
|
128 |
-
$row[] = $user_info->user_registered;
|
129 |
-
$row[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
fputcsv( $handle, $row );
|
132 |
|
133 |
// Update the user record as being exported.
|
134 |
-
if ( 'all' != $args['export'] ){
|
135 |
update_user_meta( $user, 'exported', 1 );
|
136 |
}
|
137 |
}
|
24 |
*
|
25 |
* @since 2.9.7
|
26 |
* @since 3.2.0 Updated to use fputcsv.
|
27 |
+
* @since 3.2.1 Added user data filters.
|
28 |
*
|
29 |
* @param array $args
|
30 |
* @param array $users
|
39 |
$defaults = array(
|
40 |
'export' => 'all',
|
41 |
'filename' => 'wp-members-user-export-' . $today . '.csv',
|
42 |
+
'export_fields' => wpmem_fields(),
|
43 |
'exclude_fields' => array( 'password', 'confirm_password', 'confirm_email' ),
|
44 |
'entity_decode' => false,
|
45 |
);
|
68 |
$handle = fopen( 'php://output', 'w' );
|
69 |
fputs( $handle, "\xEF\xBB\xBF" ); // UTF-8 BOM
|
70 |
|
71 |
+
$header = array( 'ID' => 'User ID', 'username' => 'Username' );
|
72 |
// Remove excluded fields from $export_fields while setting up $header array.
|
73 |
foreach ( $args['export_fields'] as $meta => $field ) {
|
74 |
if ( in_array( $meta, $args['exclude_fields'] ) ) {
|
75 |
unset( $args['export_fields'][ $meta ] );
|
76 |
} else {
|
77 |
+
$header[ $meta ] = $field['label'];
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
if ( 1 == $wpmem->mod_reg ) {
|
82 |
+
$header['active'] = __( 'Activated?', 'wp-members');
|
83 |
}
|
84 |
|
85 |
+
if ( defined( 'WPMEM_EXP_MODULE' ) && 1 == $wpmem->use_exp ) {
|
86 |
+
$header['exp_type'] = __( 'Subscription', 'wp-members' );
|
87 |
+
$header['expires'] = __( 'Expires', 'wp-members' );
|
88 |
}
|
89 |
|
90 |
+
$header['user_registered'] = __( 'Registered', 'wp-members' );
|
91 |
+
$header['wpmem_reg_ip'] = __( 'IP', 'wp-members' );
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Filters user export header row before assembly.
|
95 |
+
*
|
96 |
+
* @since 3.2.1
|
97 |
+
*
|
98 |
+
* @param array $header The header column values
|
99 |
+
*/
|
100 |
+
$header = apply_filters( 'wpmem_user_export_header', $header );
|
101 |
|
102 |
fputcsv( $handle, $header );
|
103 |
|
108 |
$user_info = get_userdata( $user );
|
109 |
|
110 |
$wp_user_fields = [ 'user_email', 'user_nicename', 'user_url', 'display_name' ];
|
111 |
+
$row = array( 'ID' => $user_info->ID, 'username' => $user_info->user_login );
|
112 |
foreach ( $args['export_fields'] as $meta => $field ) {
|
113 |
if ( in_array( $meta, $wp_user_fields ) ) {
|
114 |
+
$row[ $meta ] = $user_info->{$meta};
|
115 |
} else {
|
116 |
$raw_data = get_user_meta( $user, $meta, true );
|
117 |
+
$row[ $meta ] = ( $args['entity_decode'] ) ? html_entity_decode( $raw_data ) : $raw_data;
|
118 |
}
|
119 |
}
|
120 |
|
121 |
+
if ( 1 == $wpmem->mod_reg ) {
|
122 |
+
$row['active'] = get_user_meta( $user, 'active', 1 ) ? __( 'Yes' ) : __( 'No' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
+
if ( defined( 'WPMEM_EXP_MODULE' ) && 1 == $wpmem->use_exp ) {
|
126 |
+
$row['exp_type'] = get_user_meta( $user, 'exp_type', true );
|
127 |
+
$row['expires'] = get_user_meta( $user, 'expires', true );
|
128 |
}
|
129 |
|
130 |
+
$row['user_registered'] = $user_info->user_registered;
|
131 |
+
$row['wpmem_reg_ip'] = get_user_meta( $user, 'wpmem_reg_ip', true );
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Filter the user data before assembly.
|
135 |
+
*
|
136 |
+
* @since 3.2.1
|
137 |
+
*
|
138 |
+
* @param array $row The user data row
|
139 |
+
*/
|
140 |
+
$row = apply_filters( 'wpmem_user_export_row', $row );
|
141 |
|
142 |
fputcsv( $handle, $row );
|
143 |
|
144 |
// Update the user record as being exported.
|
145 |
+
if ( 'all' != $args['export'] ) {
|
146 |
update_user_meta( $user, 'exported', 1 );
|
147 |
}
|
148 |
}
|
inc/class-wp-members-forms.php
CHANGED
@@ -440,7 +440,7 @@ class WP_Members_Forms {
|
|
440 |
'link_span_after' => '</span>',
|
441 |
|
442 |
// classes & ids
|
443 |
-
'form_id' => 'wpmem_' . $arr['action'],
|
444 |
'form_class' => 'form',
|
445 |
'button_id' => '',
|
446 |
'button_class' => 'buttons',
|
@@ -719,7 +719,7 @@ class WP_Members_Forms {
|
|
719 |
'buttons_after' => '</div>',
|
720 |
|
721 |
// Classes & ids.
|
722 |
-
'form_id' => ( 'new' == $tag ) ? '
|
723 |
'form_class' => 'form',
|
724 |
'button_id' => '',
|
725 |
'button_class' => 'buttons',
|
440 |
'link_span_after' => '</span>',
|
441 |
|
442 |
// classes & ids
|
443 |
+
'form_id' => 'wpmem_' . $arr['action'] . '_form',
|
444 |
'form_class' => 'form',
|
445 |
'button_id' => '',
|
446 |
'button_class' => 'buttons',
|
719 |
'buttons_after' => '</div>',
|
720 |
|
721 |
// Classes & ids.
|
722 |
+
'form_id' => ( 'new' == $tag ) ? 'wpmem_register_form' : 'wpmem_profile_form',
|
723 |
'form_class' => 'form',
|
724 |
'button_id' => '',
|
725 |
'button_class' => 'buttons',
|
inc/class-wp-members-shortcodes.php
CHANGED
@@ -507,6 +507,7 @@ class WP_Members_Shortcodes {
|
|
507 |
* @since 3.1.4 Changed to display value rather than stored value for dropdown/multicheck/radio.
|
508 |
* @since 3.1.5 Added display attribute, meta key as a direct attribute, and image/file display.
|
509 |
* @since 3.2.0 Moved to WP_Members_Shortcodes::fields().
|
|
|
510 |
*
|
511 |
* @global object $wpmem The WP_Members object.
|
512 |
* @param array $atts {
|
@@ -518,7 +519,7 @@ class WP_Members_Shortcodes {
|
|
518 |
* @type string $underscores
|
519 |
* @type string $display
|
520 |
* @type string $size
|
521 |
-
* @type string $clickable default:
|
522 |
* }
|
523 |
* @param string $content Any content passed with the shortcode (default:null).
|
524 |
* @param string $tag The shortcode tag (wpmem_form).
|
@@ -594,7 +595,7 @@ class WP_Members_Shortcodes {
|
|
594 |
// Handle date fields.
|
595 |
if ( isset( $field_type ) && 'date' == $field_type ) {
|
596 |
if ( isset( $atts['format'] ) ) {
|
597 |
-
// Formats date:
|
598 |
$result = ( '' != $user_info->{$field} ) ? date( $atts['format'], strtotime( $user_info->{$field} ) ) : '';
|
599 |
} else {
|
600 |
// Formats date to whatever the WP setting is.
|
@@ -609,8 +610,8 @@ class WP_Members_Shortcodes {
|
|
609 |
|
610 |
$content = ( $content ) ? $result . $content : $result;
|
611 |
|
612 |
-
//
|
613 |
-
$content = ( isset( $atts['clickable'] ) && (
|
614 |
|
615 |
return do_shortcode( $content );
|
616 |
}
|
507 |
* @since 3.1.4 Changed to display value rather than stored value for dropdown/multicheck/radio.
|
508 |
* @since 3.1.5 Added display attribute, meta key as a direct attribute, and image/file display.
|
509 |
* @since 3.2.0 Moved to WP_Members_Shortcodes::fields().
|
510 |
+
* @since 3.2.0 Added clickable attribute.
|
511 |
*
|
512 |
* @global object $wpmem The WP_Members object.
|
513 |
* @param array $atts {
|
519 |
* @type string $underscores
|
520 |
* @type string $display
|
521 |
* @type string $size
|
522 |
+
* @type string $clickable default:false
|
523 |
* }
|
524 |
* @param string $content Any content passed with the shortcode (default:null).
|
525 |
* @param string $tag The shortcode tag (wpmem_form).
|
595 |
// Handle date fields.
|
596 |
if ( isset( $field_type ) && 'date' == $field_type ) {
|
597 |
if ( isset( $atts['format'] ) ) {
|
598 |
+
// Formats date: https://secure.php.net/manual/en/function.date.php
|
599 |
$result = ( '' != $user_info->{$field} ) ? date( $atts['format'], strtotime( $user_info->{$field} ) ) : '';
|
600 |
} else {
|
601 |
// Formats date to whatever the WP setting is.
|
610 |
|
611 |
$content = ( $content ) ? $result . $content : $result;
|
612 |
|
613 |
+
// Make it clickable?
|
614 |
+
$content = ( isset( $atts['clickable'] ) && ( true === $atts['clickable'] || 'true' == $atts['clickable'] ) ) ? make_clickable( $content ) : $content;
|
615 |
|
616 |
return do_shortcode( $content );
|
617 |
}
|
inc/class-wp-members-user-profile.php
CHANGED
@@ -236,7 +236,11 @@ class WP_Members_User_Profile {
|
|
236 |
$wpmem_fields = ( 'admin' == $display ) ? wpmem_fields( 'admin_profile_update' ) : wpmem_fields( 'dashboard_profile_update' );
|
237 |
|
238 |
$exclude = wpmem_get_excluded_meta( $display . '-profile' );
|
239 |
-
|
|
|
|
|
|
|
|
|
240 |
// If tos is an active field, this is the dashboard profile, and user has current field value.
|
241 |
if ( isset( $wpmem_fields['tos'] ) && get_user_meta( $user_id, 'tos', true ) == $wpmem_fields['tos']['checked_value'] ) {
|
242 |
unset( $wpmem_fields['tos'] );
|
236 |
$wpmem_fields = ( 'admin' == $display ) ? wpmem_fields( 'admin_profile_update' ) : wpmem_fields( 'dashboard_profile_update' );
|
237 |
|
238 |
$exclude = wpmem_get_excluded_meta( $display . '-profile' );
|
239 |
+
|
240 |
+
foreach ( $exclude as $excluded ) {
|
241 |
+
unset( $wpmem_fields[ $excluded ] );
|
242 |
+
}
|
243 |
+
|
244 |
// If tos is an active field, this is the dashboard profile, and user has current field value.
|
245 |
if ( isset( $wpmem_fields['tos'] ) && get_user_meta( $user_id, 'tos', true ) == $wpmem_fields['tos']['checked_value'] ) {
|
246 |
unset( $wpmem_fields['tos'] );
|
inc/class-wp-members.php
CHANGED
@@ -1085,7 +1085,7 @@ class WP_Members {
|
|
1085 |
// Default excluded fields.
|
1086 |
$excluded_fields = array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' );
|
1087 |
|
1088 |
-
if ( 'update' == $tag ) {
|
1089 |
$excluded_fields[] = 'username';
|
1090 |
}
|
1091 |
|
1085 |
// Default excluded fields.
|
1086 |
$excluded_fields = array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' );
|
1087 |
|
1088 |
+
if ( 'update' == $tag || 'admin-profile' == $tag || 'user-profile' == $tag || 'wp-register' == $tag ) {
|
1089 |
$excluded_fields[] = 'username';
|
1090 |
}
|
1091 |
|
inc/wp-registration.php
CHANGED
@@ -334,7 +334,7 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
|
|
334 |
global $wpmem;
|
335 |
|
336 |
// Get any meta fields that should be excluded.
|
337 |
-
$exclude = wpmem_get_excluded_meta( 'register' );
|
338 |
|
339 |
foreach ( wpmem_fields( 'wp_validate' ) as $meta_key => $field ) {
|
340 |
$is_error = false;
|
@@ -374,7 +374,7 @@ function wpmem_wp_reg_finalize( $user_id ) {
|
|
374 |
$is_woo = ( wpmem_get( 'woocommerce_checkout_place_order' ) || wpmem_get( 'woocommerce-register-nonce' ) ) ? true : false;
|
375 |
if ( $is_native || $is_add_new || $is_woo ) {
|
376 |
// Get any excluded meta fields.
|
377 |
-
$exclude = wpmem_get_excluded_meta( 'register' );
|
378 |
foreach ( wpmem_fields( 'wp_finalize' ) as $meta_key => $field ) {
|
379 |
$value = wpmem_get( $meta_key, false );
|
380 |
if ( $value && ! in_array( $meta_key, $exclude ) && 'file' != $field['type'] && 'image' != $field['type'] ) {
|
334 |
global $wpmem;
|
335 |
|
336 |
// Get any meta fields that should be excluded.
|
337 |
+
$exclude = wpmem_get_excluded_meta( 'wp-register' );
|
338 |
|
339 |
foreach ( wpmem_fields( 'wp_validate' ) as $meta_key => $field ) {
|
340 |
$is_error = false;
|
374 |
$is_woo = ( wpmem_get( 'woocommerce_checkout_place_order' ) || wpmem_get( 'woocommerce-register-nonce' ) ) ? true : false;
|
375 |
if ( $is_native || $is_add_new || $is_woo ) {
|
376 |
// Get any excluded meta fields.
|
377 |
+
$exclude = wpmem_get_excluded_meta( 'wp-register' );
|
378 |
foreach ( wpmem_fields( 'wp_finalize' ) as $meta_key => $field ) {
|
379 |
$value = wpmem_get( $meta_key, false );
|
380 |
if ( $value && ! in_array( $meta_key, $exclude ) && 'file' != $field['type'] && 'image' != $field['type'] ) {
|
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: 4.0
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 3.2.
|
7 |
License: GPLv2
|
8 |
|
9 |
The WP-Members membership plugin turns your WordPress site into a membership site. Restrict premium content, create custom registration fields, and more.
|
@@ -104,7 +104,7 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
|
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
WP-Members 3.2.0 is a major update. See changelog for important details. Minimum WP version is 4.0.
|
107 |
-
WP-Members 3.2.
|
108 |
|
109 |
== Screenshots ==
|
110 |
|
@@ -127,11 +127,15 @@ WP-Members 3.2.0.1 is a minor fix for 3.2.0. See changelog.
|
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
-
= 3.2.
|
131 |
|
132 |
-
*
|
133 |
-
*
|
134 |
-
*
|
|
|
|
|
|
|
|
|
135 |
|
136 |
= 3.2.0 =
|
137 |
|
3 |
Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 3.2.1
|
7 |
License: GPLv2
|
8 |
|
9 |
The WP-Members membership plugin turns your WordPress site into a membership site. Restrict premium content, create custom registration fields, and more.
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
WP-Members 3.2.0 is a major update. See changelog for important details. Minimum WP version is 4.0.
|
107 |
+
WP-Members 3.2.1 is a fix update for 3.2.0. See changelog.
|
108 |
|
109 |
== Screenshots ==
|
110 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 3.2.1 =
|
131 |
|
132 |
+
* Fixed duplicate ID in login form.
|
133 |
+
* Fixed user profile update for excluded fields.
|
134 |
+
* Fixed native WP registration, excluded WP-Members username field in form validation.
|
135 |
+
* Fixed update post when block status is not changed.
|
136 |
+
* Rebuilt user interface for post restriction metabox to make it more intuitive.
|
137 |
+
* Changed "clickable" attribute for field shortcode default to false.
|
138 |
+
* Added wpmem_user_export_header and wpmem_user_export_row filter for export.
|
139 |
|
140 |
= 3.2.0 =
|
141 |
|
wp-members.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Members
|
4 |
Plugin URI: https://rocketgeek.com
|
5 |
Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="https://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.2.
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
Text Domain: wp-members
|
@@ -66,7 +66,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
66 |
}
|
67 |
|
68 |
// Initialize constants.
|
69 |
-
define( 'WPMEM_VERSION', '3.2.
|
70 |
define( 'WPMEM_DEBUG', false );
|
71 |
define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
|
72 |
define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
|
3 |
Plugin Name: WP-Members
|
4 |
Plugin URI: https://rocketgeek.com
|
5 |
Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="https://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.2.1
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
Text Domain: wp-members
|
66 |
}
|
67 |
|
68 |
// Initialize constants.
|
69 |
+
define( 'WPMEM_VERSION', '3.2.1' );
|
70 |
define( 'WPMEM_DEBUG', false );
|
71 |
define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
|
72 |
define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
|