Version Description
- Update membership product expiration to allow for a "no gap" expiration (i.e. renewal begins from expiration date, optional) or default (renewal begins from today or expiration date, whichever is later).
- Update user activation to use wp_set_password().
- Update display of membership product slugs to text (instead of a form input). They can't be edited.
- Added empty /inc/dialogs.php for customizations and plugins that try to include the legacy dialogs file.
- Updates to user profile screen which allows users with 'edit_users' capability (admins) to edit their own profile.
- Fixes a bug that caused the user profile display for a new user to say "reactivate" instead of "activate".
- Fixes a bug in the membership renewal that sets the individual date meta forward two periods instead of one.
- Fixes a bug in the hidden fields lookup that caused hidden posts with a membership limitation to not display to users who had a matching membership.
- Changed custom menu options to use wp_nav_menu_item_custom_fields action hook. This is a "made up" hook that is not actually part of WP. But somewhere along the line, some menu-focused plugins began using it in their custom walkers. By not using it in WP-Members, that caused some problems for users who also used one of those other plugins or themes. This updates shifts to use this "non-standard" action hook these other themes and plugins are using in order to apply some level of compatibility.
Including all 3.3.0.x patches: * Provides a workaround for a bug in the dialogs setting when custom dialogs are applied. This targets an issue specifically affecting users with the WP-Members Security extension installed. (3.3.0.4) * Fixes a bug when products are enabled but no default is set. Allows for no default membership assigned at registration. (3.3.0.4) * Fixes a bug that caused the post restricted message to display on the short form when it was in password reset and forgot username state. (3.3.0.4) * Added wpmem_get_hidden_posts() API function to return an array of post IDs marked as hidden. (3.3.0.4) * Fixes a shortcode issue for the [wpmem_logged_in] shortcode when using the meta_key attribute. 3.3.0 added a "compare" attribute, and with this addition, it broke the original default use of the shortcode. (3.3.0.3) * Fixes an issue with registration/profile form fields when used in the profile. It was intended to introduce separate selection of fields for registration and profile update in 3.3.0. However, there is an issue that causes profile fields to both (1) not correctly display and (2) if they do, they do not update correctly. (3.3.0.2) * Fixes issue when updating where the stylesheet selector indicates "use_custom" but the actual URL is to a default stylesheet. The problem can be corrected manually, but this fix applies the custom URL to the new standard setting for the defaults. (3.3.0.1) * Fixes bug where any stylesheet other than the default reverts to the default ("no float"). This was due to the database version being wiped when settings were updated. This fix correctly applies the database version when updating settings. (3.3.0.1) * Fixes bug when captcha is used (unknown validate() function). The validate() function should have been declared and used as a static method. This fix declares validate() as static and then uses it as such. (3.3.0.1) * Fixes undefined string variable when successful registration is executed. (3.3.0.1)
Release Info
Developer | cbutlerjr |
Plugin | WP-Members Membership Plugin |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.3.0 to 3.3.1
- inc/dialogs.php +9 -0
- includes/admin/api.php +0 -21
- includes/admin/class-wp-members-admin-api.php +1 -0
- includes/admin/class-wp-members-products-admin.php +27 -13
- includes/admin/tabs/class-wp-members-admin-tab-options.php +652 -651
- includes/admin/tabs/class-wp-members-fields-table.php +2 -2
- includes/api/api-users.php +2 -7
- includes/api/api.php +35 -0
- includes/class-wp-members-captcha.php +1 -1
- includes/class-wp-members-forms.php +11 -3
- includes/class-wp-members-menus.php +1 -1
- includes/class-wp-members-products.php +1 -2
- includes/class-wp-members-shortcodes.php +1 -2
- includes/class-wp-members-user-profile.php +37 -33
- includes/class-wp-members-user.php +53 -10
- includes/class-wp-members.php +4 -3
- includes/install.php +10 -0
- includes/legacy/dialogs.php +11 -5
- includes/walkers/class-wp-members-walker-nav-menu.php +18 -17
- readme.txt +27 -2
- wp-members.php +2 -2
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Included for legacy reasons: backward compatibility with
|
4 |
+
* WP-Members Advanced Options. Those will actually still
|
5 |
+
* function, and there is no front end issue, but removing
|
6 |
+
* this file causes a PHP notice for certain configurations.
|
7 |
+
*
|
8 |
+
* Remove later.
|
9 |
+
*/
|
@@ -44,27 +44,6 @@ function wpmem_add_custom_email( $tag, $heading, $subject_input, $message_input
|
|
44 |
$wpmem->admin->add_email( $args );
|
45 |
}
|
46 |
|
47 |
-
/**
|
48 |
-
* Wrapper function for adding custom dialogs.
|
49 |
-
*
|
50 |
-
* @since 3.1.1
|
51 |
-
*
|
52 |
-
* @param array $dialogs Dialog settings array.
|
53 |
-
* @param string $tag Slug for dialog to be added.
|
54 |
-
* @param string $msg The dialog message.
|
55 |
-
* @param string $label Label for admin panel.
|
56 |
-
* @return array $dialogs Dialog settings array with prepped custom dialog added.
|
57 |
-
*/
|
58 |
-
function wpmem_add_custom_dialog( $dialogs, $tag, $msg, $label ) {
|
59 |
-
$msg = ( ! isset( $dialogs[ $tag ] ) ) ? $msg : $dialogs[ $tag ];
|
60 |
-
$dialogs[ $tag ] = array(
|
61 |
-
'name' => $tag,
|
62 |
-
'label' => $label,
|
63 |
-
'value' => $msg,
|
64 |
-
);
|
65 |
-
return $dialogs;
|
66 |
-
}
|
67 |
-
|
68 |
/**
|
69 |
* Checks the current tab being displayed in the admin panel.
|
70 |
*
|
44 |
$wpmem->admin->add_email( $args );
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* Checks the current tab being displayed in the admin panel.
|
49 |
*
|
@@ -136,6 +136,7 @@ class WP_Members_Admin_API {
|
|
136 |
add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
|
137 |
add_action( 'profile_update', array( 'WP_Members_User_Profile', 'update' ) );
|
138 |
add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', '_profile_tabs' ), 99 );
|
|
|
139 |
|
140 |
if ( current_user_can( 'list_users' ) ) {
|
141 |
add_action( 'admin_footer-users.php', array( 'WP_Members_Admin_Users', 'bulk_user_action' ) );
|
136 |
add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
|
137 |
add_action( 'profile_update', array( 'WP_Members_User_Profile', 'update' ) );
|
138 |
add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', '_profile_tabs' ), 99 );
|
139 |
+
add_action( 'show_user_profile', array( 'WP_Members_User_Profile', '_profile_tabs' ), 99 );
|
140 |
|
141 |
if ( current_user_can( 'list_users' ) ) {
|
142 |
add_action( 'admin_footer-users.php', array( 'WP_Members_Admin_Users', 'bulk_user_action' ) );
|
@@ -42,8 +42,6 @@ class WP_Members_Products_Admin {
|
|
42 |
add_action( 'manage_' . $key . '_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
|
43 |
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
add_filter( 'wpmem_user_profile_tabs', array( $this, 'user_profile_tabs' ), 1 );
|
48 |
add_action( 'wpmem_user_profile_tabs_content', array( $this, 'user_profile_tab_content' ), 10 );
|
49 |
}
|
@@ -158,7 +156,8 @@ class WP_Members_Products_Admin {
|
|
158 |
$product_default = $this->get_meta( 'wpmem_product_default' );
|
159 |
$product_expires = $this->get_meta( 'wpmem_product_expires' );
|
160 |
$product_role = $this->get_meta( 'wpmem_product_role' );
|
161 |
-
|
|
|
162 |
$product_expires = ( false !== $product_expires ) ? $product_expires[0] : $product_expires;
|
163 |
|
164 |
$periods = array( __( 'Period', 'wp-members' ) . '|', __( 'Day', 'wp-members' ) . '|day', __( 'Week', 'wp-members' ) . '|week', __( 'Month', 'wp-members' ) . '|month', __( 'Year', 'wp-members' ) . '|year' );
|
@@ -166,16 +165,13 @@ class WP_Members_Products_Admin {
|
|
166 |
$show_exp_detail = ( false !== $product_expires ) ? 'show' : 'hide'; ?>
|
167 |
|
168 |
<?php wp_nonce_field( '_wpmem_product_nonce', 'wpmem_product_nonce' ); ?>
|
|
|
169 |
<p>
|
170 |
-
<
|
171 |
-
<input type="text" name="wpmem_product_name" id="wpmem_product_name" value="<?php echo esc_attr( $post->post_name ); ?>">
|
172 |
-
</p>
|
173 |
-
<p>
|
174 |
-
<input type="checkbox" name="wpmem_product_default" id="wpmem_product_default" value="1" <?php echo ( 1 == $product_default ) ? 'checked' : ''; ?>>
|
175 |
<label for="wpmem_product_default"><?php _e( 'Assign as default at registration? (optional)', 'wp-members' ); ?></label>
|
176 |
</p>
|
177 |
<p>
|
178 |
-
<input type="checkbox" name="wpmem_product_role_required" id="wpmem_product_role_required" value="role-required" <?php echo ( false !== $product_role ) ? 'checked' : '';
|
179 |
<label for="wpmem_product_role_required"><?php _e( 'Role Required? (optional)', 'wp-members' ); ?></label>
|
180 |
<label for="wpmem_product_role"></label>
|
181 |
<select name="wpmem_product_role" id="wpmem_product_role">
|
@@ -184,7 +180,7 @@ class WP_Members_Products_Admin {
|
|
184 |
</select>
|
185 |
</p>
|
186 |
<p>
|
187 |
-
<input type="checkbox" name="wpmem_product_expires" id="wpmem_product_expires" value="expires" <?php echo ( false !== $product_expires ) ? 'checked' : '';
|
188 |
<label for="wpmem_product_expires"><?php _e( 'Expires (optional)', 'wp-members' ); ?></label>
|
189 |
<span id="wpmem_product_expires_wrap">
|
190 |
<label for="wpmem_product_number_of_periods" style="display:none;"><?php _e( 'Number', 'wp-members' ); ?></label>
|
@@ -192,6 +188,8 @@ class WP_Members_Products_Admin {
|
|
192 |
<input type="text" name="wpmem_product_number_of_periods" id="wpmem_product_number_of_periods" value="<?php echo esc_attr( $period[0] ); ?>" class="small-text" placeholder="<?php _e( 'Number', 'membership_product' ); ?>" style="width:66px;height:28px;vertical-align:middle;">
|
193 |
<label for="wpmem_product_time_period" style="display:none;"><?php _e( 'Period', 'wp-members' ); ?></label>
|
194 |
<?php echo wpmem_form_field( array( 'name'=>'wpmem_product_time_period', 'type'=>'select', 'value'=>$periods, 'compare'=>( ( isset( $period[1] ) ) ? $period[1] : '' ) ) ); ?>
|
|
|
|
|
195 |
</span>
|
196 |
</p>
|
197 |
<script>
|
@@ -253,8 +251,16 @@ class WP_Members_Products_Admin {
|
|
253 |
if ( ! $expires ) {
|
254 |
update_post_meta( $post_id, 'wpmem_product_expires', false );
|
255 |
} else {
|
256 |
-
$
|
|
|
|
|
|
|
257 |
update_post_meta( $post_id, 'wpmem_product_expires', $expires_array );
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
}
|
260 |
|
@@ -436,14 +442,22 @@ class WP_Members_Products_Admin {
|
|
436 |
*
|
437 |
* @since 3.2.0
|
438 |
*
|
|
|
439 |
* @global object $wpmem
|
440 |
* @param string $key
|
441 |
*/
|
442 |
public function user_profile_tab_content( $key ) {
|
443 |
// If product enabled
|
444 |
if ( 'memberships' == $key ) {
|
445 |
-
global $wpmem;
|
446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
$user_products = $wpmem->user->get_user_products( $user_id );
|
448 |
echo '<h3>' . __( 'Product Access', 'wp-members' ) . '</h3>';
|
449 |
echo '<table>
|
42 |
add_action( 'manage_' . $key . '_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
|
43 |
}
|
44 |
|
|
|
|
|
45 |
add_filter( 'wpmem_user_profile_tabs', array( $this, 'user_profile_tabs' ), 1 );
|
46 |
add_action( 'wpmem_user_profile_tabs_content', array( $this, 'user_profile_tab_content' ), 10 );
|
47 |
}
|
156 |
$product_default = $this->get_meta( 'wpmem_product_default' );
|
157 |
$product_expires = $this->get_meta( 'wpmem_product_expires' );
|
158 |
$product_role = $this->get_meta( 'wpmem_product_role' );
|
159 |
+
$product_no_gap = $this->get_meta( 'wpmem_product_no_gap' );
|
160 |
+
|
161 |
$product_expires = ( false !== $product_expires ) ? $product_expires[0] : $product_expires;
|
162 |
|
163 |
$periods = array( __( 'Period', 'wp-members' ) . '|', __( 'Day', 'wp-members' ) . '|day', __( 'Week', 'wp-members' ) . '|week', __( 'Month', 'wp-members' ) . '|month', __( 'Year', 'wp-members' ) . '|year' );
|
165 |
$show_exp_detail = ( false !== $product_expires ) ? 'show' : 'hide'; ?>
|
166 |
|
167 |
<?php wp_nonce_field( '_wpmem_product_nonce', 'wpmem_product_nonce' ); ?>
|
168 |
+
<p><?php _e( 'Name (slug)', 'wp-members' ); ?>: <?php echo esc_attr( $post->post_name ); ?></p>
|
169 |
<p>
|
170 |
+
<input type="checkbox" name="wpmem_product_default" id="wpmem_product_default" value="1" <?php echo ( 1 == $product_default ) ? 'checked' : ''; ?> />
|
|
|
|
|
|
|
|
|
171 |
<label for="wpmem_product_default"><?php _e( 'Assign as default at registration? (optional)', 'wp-members' ); ?></label>
|
172 |
</p>
|
173 |
<p>
|
174 |
+
<input type="checkbox" name="wpmem_product_role_required" id="wpmem_product_role_required" value="role-required" <?php echo ( false !== $product_role ) ? 'checked' : ''; ?> />
|
175 |
<label for="wpmem_product_role_required"><?php _e( 'Role Required? (optional)', 'wp-members' ); ?></label>
|
176 |
<label for="wpmem_product_role"></label>
|
177 |
<select name="wpmem_product_role" id="wpmem_product_role">
|
180 |
</select>
|
181 |
</p>
|
182 |
<p>
|
183 |
+
<input type="checkbox" name="wpmem_product_expires" id="wpmem_product_expires" value="expires" <?php echo ( false !== $product_expires ) ? 'checked' : ''; ?> />
|
184 |
<label for="wpmem_product_expires"><?php _e( 'Expires (optional)', 'wp-members' ); ?></label>
|
185 |
<span id="wpmem_product_expires_wrap">
|
186 |
<label for="wpmem_product_number_of_periods" style="display:none;"><?php _e( 'Number', 'wp-members' ); ?></label>
|
188 |
<input type="text" name="wpmem_product_number_of_periods" id="wpmem_product_number_of_periods" value="<?php echo esc_attr( $period[0] ); ?>" class="small-text" placeholder="<?php _e( 'Number', 'membership_product' ); ?>" style="width:66px;height:28px;vertical-align:middle;">
|
189 |
<label for="wpmem_product_time_period" style="display:none;"><?php _e( 'Period', 'wp-members' ); ?></label>
|
190 |
<?php echo wpmem_form_field( array( 'name'=>'wpmem_product_time_period', 'type'=>'select', 'value'=>$periods, 'compare'=>( ( isset( $period[1] ) ) ? $period[1] : '' ) ) ); ?>
|
191 |
+
<label><?php esc_html_e( 'Use "no gap" renewal', 'wp-members' ); ?></label>
|
192 |
+
<?php echo wpmem_form_field( array( 'name'=>'wpmem_product_no_gap', 'type'=>'checkbox', 'value'=>'1', 'compare'=>( ( isset( $product_no_gap ) ) && 1 == $product_no_gap ) ? $product_no_gap : '' ) ); ?>
|
193 |
</span>
|
194 |
</p>
|
195 |
<script>
|
251 |
if ( ! $expires ) {
|
252 |
update_post_meta( $post_id, 'wpmem_product_expires', false );
|
253 |
} else {
|
254 |
+
$number = sanitize_text_field( wpmem_get( 'wpmem_product_number_of_periods' ) );
|
255 |
+
$period = sanitize_text_field( wpmem_get( 'wpmem_product_time_period' ) );
|
256 |
+
$no_gap = sanitize_text_field( wpmem_get( 'wpmem_product_no_gap' ) );
|
257 |
+
$expires_array = array( $number . "|" . $period );
|
258 |
update_post_meta( $post_id, 'wpmem_product_expires', $expires_array );
|
259 |
+
if ( $no_gap ) {
|
260 |
+
update_post_meta( $post_id, 'wpmem_product_no_gap', 1 );
|
261 |
+
} else {
|
262 |
+
delete_post_meta( $post_id, 'wpmem_product_no_gap' );
|
263 |
+
}
|
264 |
}
|
265 |
}
|
266 |
|
442 |
*
|
443 |
* @since 3.2.0
|
444 |
*
|
445 |
+
* @global string $pagenow
|
446 |
* @global object $wpmem
|
447 |
* @param string $key
|
448 |
*/
|
449 |
public function user_profile_tab_content( $key ) {
|
450 |
// If product enabled
|
451 |
if ( 'memberships' == $key ) {
|
452 |
+
global $pagenow, $wpmem;
|
453 |
+
/*
|
454 |
+
* If an admin is editing their provile, we need their ID,
|
455 |
+
* otherwise, it's the user_id param from the URL. It's a
|
456 |
+
* little more complicated than it sounds since you can't just
|
457 |
+
* check if the user is logged in, because the admin is always
|
458 |
+
* logged in when checking profiles.
|
459 |
+
*/
|
460 |
+
$user_id = ( 'profile' == $pagenow && current_user_can( 'edit_users' ) ) ? get_current_user_id() : sanitize_text_field( wpmem_get( 'user_id', false, 'get' ) );
|
461 |
$user_products = $wpmem->user->get_user_products( $user_id );
|
462 |
echo '<h3>' . __( 'Product Access', 'wp-members' ) . '</h3>';
|
463 |
echo '<table>
|
@@ -1,652 +1,653 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WP-Members Admin functions
|
4 |
-
*
|
5 |
-
* Static functions to manage the plugin options tab.
|
6 |
-
*
|
7 |
-
* This file is part of the WP-Members plugin by Chad Butler
|
8 |
-
* You can find out more about this plugin at https://rocketgeek.com
|
9 |
-
* Copyright (c) 2006-2019 Chad Butler
|
10 |
-
* WP-Members(tm) is a trademark of butlerblog.com
|
11 |
-
*
|
12 |
-
* @package WP-Members
|
13 |
-
* @author Chad Butler
|
14 |
-
* @copyright 2006-2019
|
15 |
-
*/
|
16 |
-
|
17 |
-
// Exit if accessed directly.
|
18 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
-
exit();
|
20 |
-
}
|
21 |
-
|
22 |
-
class WP_Members_Admin_Tab_Options {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Creates the tab.
|
26 |
-
*
|
27 |
-
* @since 3.2.0
|
28 |
-
* @since 3.3.0 Ported from wpmem_a_options_tab().
|
29 |
-
*
|
30 |
-
* @param string $tab The admin tab being displayed.
|
31 |
-
* @return string|bool The about tab, otherwise false.
|
32 |
-
*/
|
33 |
-
static function do_tab( $tab ) {
|
34 |
-
if ( $tab == 'options' || ! $tab ) {
|
35 |
-
// Render the about tab.
|
36 |
-
return self::build_settings();
|
37 |
-
} else {
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Builds the settings panel.
|
44 |
-
*
|
45 |
-
* @since 2.2.2
|
46 |
-
* @since 3.3.0 Ported from wpmem_a_build_options().
|
47 |
-
*
|
48 |
-
* @global object $wpmem The WP_Members Object.
|
49 |
-
*/
|
50 |
-
static function build_settings() {
|
51 |
-
|
52 |
-
global $wpmem;
|
53 |
-
|
54 |
-
/** This filter is documented in wp-members/inc/email.php */
|
55 |
-
$admin_email = apply_filters( 'wpmem_notify_addr', get_option( 'admin_email' ) );
|
56 |
-
$chg_email = sprintf( __( '%sChange%s or %sFilter%s this address', 'wp-members' ), '<a href="' . site_url( 'wp-admin/options-general.php', 'admin' ) . '">', '</a>', '<a href="https://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_notify_addr/">', '</a>' );
|
57 |
-
$help_link = sprintf( __( 'See the %sUsers Guide on plugin options%s.', 'wp-members' ), '<a href="https://rocketgeek.com/plugins/wp-members/users-guide/plugin-settings/options/" target="_blank">', '</a>' );
|
58 |
-
|
59 |
-
// Build an array of post types
|
60 |
-
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
|
61 |
-
$post_arr = array(
|
62 |
-
'post' => __( 'Posts' ),
|
63 |
-
'page' => __( 'Pages' ),
|
64 |
-
);
|
65 |
-
if ( $post_types ) {
|
66 |
-
foreach ( $post_types as $post_type ) {
|
67 |
-
$cpt_obj = get_post_type_object( $post_type );
|
68 |
-
$post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
|
69 |
-
}
|
70 |
-
} ?>
|
71 |
-
|
72 |
-
<div class="metabox-holder has-right-sidebar">
|
73 |
-
|
74 |
-
<div class="inner-sidebar">
|
75 |
-
<?php wpmem_a_meta_box(); ?>
|
76 |
-
<?php wpmem_a_rating_box(); ?>
|
77 |
-
<div class="postbox">
|
78 |
-
<h3><span><?php _e( 'Need help?', 'wp-members' ); ?></span></h3>
|
79 |
-
<div class="inside">
|
80 |
-
<p><strong><i><?php echo $help_link; ?></i></strong></p>
|
81 |
-
<p><button id="opener">Get Settings Information</button></p>
|
82 |
-
</div>
|
83 |
-
</div>
|
84 |
-
<?php wpmem_a_rss_box(); ?>
|
85 |
-
</div> <!-- .inner-sidebar -->
|
86 |
-
|
87 |
-
<div id="post-body">
|
88 |
-
<div id="post-body-content">
|
89 |
-
<div class="postbox">
|
90 |
-
<h3><span><?php _e( 'Manage Options', 'wp-members' ); ?></span></h3>
|
91 |
-
<div class="inside">
|
92 |
-
<form name="updatesettings" id="updatesettings" method="post" action="<?php echo wpmem_admin_form_post_url(); ?>">
|
93 |
-
<?php wp_nonce_field( 'wpmem-update-settings' ); ?>
|
94 |
-
<h3><?php _e( 'Content', 'wp-members' ); ?></h3>
|
95 |
-
<ul>
|
96 |
-
<?php
|
97 |
-
|
98 |
-
// Content Blocking option group.
|
99 |
-
$i = 0;
|
100 |
-
$len = count( $post_arr );
|
101 |
-
foreach ( $post_arr as $key => $val ) {
|
102 |
-
if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
|
103 |
-
?>
|
104 |
-
<li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
|
105 |
-
<label><?php echo ( $i == 0 ) ? __( 'Content Blocking', 'wp-members' ) : ' '; ?></label>
|
106 |
-
<?php
|
107 |
-
$block = ( isset( $wpmem->block[ $key ] ) ) ? $wpmem->block[ $key ] : '';
|
108 |
-
$values = array(
|
109 |
-
__( 'Do not block', 'wp-members' ) . '|0',
|
110 |
-
__( 'Block', 'wp-members' ) . '|1',
|
111 |
-
// @todo Future development. __( 'Hide', 'wp-members' ) . '|2',
|
112 |
-
);
|
113 |
-
echo wpmem_create_formfield( 'wpmem_block_' . $key, 'select', $values, $block ); ?>
|
114 |
-
<span><?php echo $val; ?></span><?php // @todo - this needs to be translatable. ?>
|
115 |
-
</li>
|
116 |
-
<?php $i++;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
// Show Excerpts, Login Form, and Registration Form option groups.
|
121 |
-
|
122 |
-
$option_group_array = array(
|
123 |
-
'show_excerpt' => __( 'Show Excerpts', 'wp-members' ),
|
124 |
-
'show_login' => __( 'Show Login Form', 'wp-members' ),
|
125 |
-
'show_reg' => __( 'Show Registration Form', 'wp-members' ),
|
126 |
-
'autoex' => __( 'Auto Excerpt:', 'wp-members' ),
|
127 |
-
);
|
128 |
-
|
129 |
-
foreach ( $option_group_array as $item_key => $item_val ) {
|
130 |
-
$i = 0;
|
131 |
-
$len = count( $post_arr );
|
132 |
-
foreach ( $post_arr as $key => $val ) {
|
133 |
-
if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
|
134 |
-
?>
|
135 |
-
<li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
|
136 |
-
<label><?php echo ( $i == 0 ) ? $item_val : ' '; ?></label>
|
137 |
-
<?php if ( 'autoex' == $item_key ) {
|
138 |
-
if ( isset( $wpmem->{$item_key}[ $key ] ) && $wpmem->{$item_key}[ $key ]['enabled'] == 1 ) {
|
139 |
-
$setting = 1;
|
140 |
-
$ex_len = $wpmem->{$item_key}[ $key ]['length'];
|
141 |
-
$ex_text = ( isset( $wpmem->{$item_key}[ $key ]['text'] ) ) ? $wpmem->{$item_key}[ $key ]['text'] : '';
|
142 |
-
} else {
|
143 |
-
$setting = 0;
|
144 |
-
$ex_len = '';
|
145 |
-
$ex_text = '';
|
146 |
-
}
|
147 |
-
echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
|
148 |
-
<span><?php _e( 'Number of words in excerpt:', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_len" type="text" size="5" value="<?php echo $ex_len; ?>" />
|
149 |
-
<span><?php _e( 'Custom read more link (optional):', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_text" type="text" size="5" value="<?php echo $ex_text; ?>" />
|
150 |
-
<?php } else {
|
151 |
-
$setting = ( isset( $wpmem->{$item_key}[ $key ] ) ) ? $wpmem->{$item_key}[ $key ] : 0;
|
152 |
-
echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
|
153 |
-
<?php } ?>
|
154 |
-
</li>
|
155 |
-
<?php $i++;
|
156 |
-
}
|
157 |
-
}
|
158 |
-
} ?>
|
159 |
-
</ul>
|
160 |
-
<?php
|
161 |
-
if ( WPMEM_EXP_MODULE == true ) {
|
162 |
-
$arr = array(
|
163 |
-
array(__('Time-based expiration','wp-members'),'wpmem_settings_time_exp',__('Allows for access to expire','wp-members'),'use_exp'),
|
164 |
-
array(__('Trial period','wp-members'),'wpmem_settings_trial',__('Allows for a trial period','wp-members'),'use_trial'),
|
165 |
-
); ?>
|
166 |
-
<h3><?php _e( 'Subscription Settings', 'wp-members' ); ?></h3>
|
167 |
-
<ul><?php
|
168 |
-
for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
|
169 |
-
<li>
|
170 |
-
<label><?php echo $arr[ $row ][0]; ?></label>
|
171 |
-
<?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[ $row ][3]} ); ?>
|
172 |
-
<?php if ( $arr[ $row ][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
|
173 |
-
</li>
|
174 |
-
<?php }
|
175 |
-
}?></ul>
|
176 |
-
<h3><?php _e( 'Other Settings', 'wp-members' ); ?></h3>
|
177 |
-
<ul>
|
178 |
-
<?php
|
179 |
-
/** This filter is defined in class-wp-members.php */
|
180 |
-
$dropin_dir = apply_filters( 'wpmem_dropin_dir', $wpmem->dropin_dir );
|
181 |
-
$arr = array(
|
182 |
-
array(__('Enable Products', 'wp-members'),'wpmem_settings_products',__('Enables creation of different membership products','wp-members'),'enable_products'),
|
183 |
-
array(__('Clone menus','wp-members'),'wpmem_settings_menus',__('Enables logged in menus','wp-members'),'clone_menus'),
|
184 |
-
array(__('Notify admin','wp-members'),'wpmem_settings_notify',sprintf(__('Notify %s for each new registration? %s','wp-members'),$admin_email,$chg_email),'notify'),
|
185 |
-
array(__('Moderate registration','wp-members'),'wpmem_settings_moderate',__('Holds new registrations for admin approval','wp-members'),'mod_reg'),
|
186 |
-
array(__('Ignore warning messages','wp-members'),'wpmem_settings_ignore_warnings',__('Ignores WP-Members warning messages in the admin panel','wp-members'),'warnings'),
|
187 |
-
//array(__('Enable dropins', 'wp-members'),'wpmem_settings_enable_dropins',sprintf(__('Enables dropins in %s', 'wp-members'), $dropin_dir),'dropins'),
|
188 |
-
);
|
189 |
-
for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
|
190 |
-
<li>
|
191 |
-
<label><?php echo $arr[ $row ][0]; ?></label>
|
192 |
-
<?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[$row][3]} ); ?>
|
193 |
-
<?php if ( $arr[$row][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
|
194 |
-
</li>
|
195 |
-
<?php } ?>
|
196 |
-
<li>
|
197 |
-
<label><?php _e( 'Attribution', 'wp-members' ); ?></label>
|
198 |
-
<?php echo wpmem_create_formfield( 'attribution', 'checkbox', '1', $wpmem->attrib ); ?>
|
199 |
-
<span class="description"><?php _e( 'Attribution is appreciated! Display "powered by" link on register form?', 'wp-members' ); ?></span>
|
200 |
-
</li>
|
201 |
-
<li>
|
202 |
-
<label><?php _e( 'Enable CAPTCHA', 'wp-members' ); ?></label>
|
203 |
-
<?php $captcha = array( __( 'None', 'wp-members' ) . '|0' );
|
204 |
-
if ( 1 == $wpmem->captcha ) {
|
205 |
-
$wpmem->captcha = 3; // reCAPTCHA v1 is fully obsolete. Change it to v2.
|
206 |
-
}
|
207 |
-
$captcha[] = __( 'reCAPTCHA v2', 'wp-members' ) . '|3';
|
208 |
-
$captcha[] = __( 'reCAPTCHA v3', 'wp-members' ) . '|4';
|
209 |
-
$captcha[] = __( 'Really Simple CAPTCHA', 'wp-members' ) . '|2';
|
210 |
-
echo wpmem_create_formfield( 'wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha ); ?>
|
211 |
-
</li>
|
212 |
-
<h3><?php _e( 'Pages' ); ?></h3>
|
213 |
-
<?php $wpmem_logurl = $wpmem->user_pages['login'];
|
214 |
-
if ( ! $wpmem_logurl ) { $wpmem_logurl = wpmem_use_ssl(); } ?>
|
215 |
-
<li>
|
216 |
-
<label><?php _e( 'Login Page:', 'wp-members' ); ?></label>
|
217 |
-
<select name="wpmem_settings_logpage" id="wpmem_logpage_select">
|
218 |
-
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_logurl ); ?>
|
219 |
-
</select> <span class="description"><?php _e( 'Specify a login page (optional)', 'wp-members' ); ?></span><br />
|
220 |
-
<div id="wpmem_logpage_custom">
|
221 |
-
<label> </label>
|
222 |
-
<input class="regular-text code" type="text" name="wpmem_settings_logurl" value="<?php echo $wpmem_logurl; ?>" size="50" />
|
223 |
-
</div>
|
224 |
-
</li>
|
225 |
-
<?php $wpmem_regurl = $wpmem->user_pages['register'];
|
226 |
-
if ( ! $wpmem_regurl ) { $wpmem_regurl = wpmem_use_ssl(); } ?>
|
227 |
-
<li>
|
228 |
-
<label><?php _e( 'Register Page:', 'wp-members' ); ?></label>
|
229 |
-
<select name="wpmem_settings_regpage" id="wpmem_regpage_select">
|
230 |
-
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_regurl ); ?>
|
231 |
-
</select> <span class="description"><?php _e( 'For creating a register link in the login form', 'wp-members' ); ?></span><br />
|
232 |
-
<div id="wpmem_regpage_custom">
|
233 |
-
<label> </label>
|
234 |
-
<input class="regular-text code" type="text" name="wpmem_settings_regurl" value="<?php echo $wpmem_regurl; ?>" size="50" />
|
235 |
-
</div>
|
236 |
-
</li>
|
237 |
-
<?php $wpmem_msurl = $wpmem->user_pages['profile'];
|
238 |
-
if ( ! $wpmem_msurl ) { $wpmem_msurl = wpmem_use_ssl(); } ?>
|
239 |
-
<li>
|
240 |
-
<label><?php _e( 'User Profile Page:', 'wp-members' ); ?></label>
|
241 |
-
<select name="wpmem_settings_mspage" id="wpmem_mspage_select">
|
242 |
-
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_msurl ); ?>
|
243 |
-
</select> <span class="description"><?php _e( 'For creating a forgot password link in the login form', 'wp-members' ); ?></span><br />
|
244 |
-
<div id="wpmem_mspage_custom">
|
245 |
-
<label> </label>
|
246 |
-
<input class="regular-text code" type="text" name="wpmem_settings_msurl" value="<?php echo $wpmem_msurl; ?>" size="50" />
|
247 |
-
</div>
|
248 |
-
</li>
|
249 |
-
<h3><?php _e( 'Stylesheet' ); ?></h3>
|
250 |
-
<li>
|
251 |
-
<label><?php _e( 'Stylesheet' ); ?>:</label>
|
252 |
-
<select name="wpmem_settings_style" id="wpmem_stylesheet_select">
|
253 |
-
<?php WP_Members_Admin_Tab_Options::style_list( $wpmem->select_style ); ?>
|
254 |
-
</select>
|
255 |
-
</li>
|
256 |
-
<?php $wpmem_cssurl = $wpmem->cssurl;
|
257 |
-
if ( ! $wpmem_cssurl ) { $wpmem_cssurl = wpmem_use_ssl(); } ?>
|
258 |
-
<div id="wpmem_stylesheet_custom">
|
259 |
-
<li>
|
260 |
-
<label><?php _e( 'Custom Stylesheet:', 'wp-members' ); ?></label>
|
261 |
-
<input class="regular-text code" type="text" name="wpmem_settings_cssurl" value="<?php echo $wpmem_cssurl; ?>" size="50" />
|
262 |
-
</li>
|
263 |
-
</div>
|
264 |
-
<input type="hidden" name="wpmem_admin_a" value="update_settings">
|
265 |
-
<?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?>
|
266 |
-
</ul>
|
267 |
-
</form>
|
268 |
-
<p>If you like <strong>WP-Members</strong> please give it a <a href="https://wordpress.org/support/plugin/wp-members/reviews?rate=5#new-post">★★★★★</a> rating. Thanks!!</p>
|
269 |
-
</div><!-- .inside -->
|
270 |
-
</div>
|
271 |
-
<?php if ( $post_types ) { ?>
|
272 |
-
<div class="postbox">
|
273 |
-
<h3><span><?php _e( 'Custom Post Types', 'wp-members' ); ?></span></h3>
|
274 |
-
<div class="inside">
|
275 |
-
<form name="updatecpts" id="updatecpts" method="post" action="<?php echo wpmem_admin_form_post_url(); ?>">
|
276 |
-
<?php wp_nonce_field( 'wpmem-update-cpts' ); ?>
|
277 |
-
<table class="form-table">
|
278 |
-
<tr>
|
279 |
-
<th scope="row"><?php _e( 'Add to WP-Members Settings', 'wp-members' ); ?></th>
|
280 |
-
<td><fieldset><?php
|
281 |
-
foreach ( $post_arr as $key => $val ) {
|
282 |
-
if ( 'post' != $key && 'page' != $key && 'wpmem_product' != $key ) {
|
283 |
-
$checked = ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ? ' checked' : '';
|
284 |
-
echo '<label for="' . $key . '"><input type="checkbox" name="wpmembers_handle_cpts[]" value="' . $key . '"' . $checked . ' />' . $val . '</label><br />';
|
285 |
-
}
|
286 |
-
}
|
287 |
-
?></fieldset>
|
288 |
-
</td>
|
289 |
-
</tr>
|
290 |
-
<tr>
|
291 |
-
<input type="hidden" name="wpmem_admin_a" value="update_cpts" />
|
292 |
-
<td colspan="2"><?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?></td>
|
293 |
-
</tr>
|
294 |
-
</table>
|
295 |
-
</form>
|
296 |
-
</div>
|
297 |
-
</div>
|
298 |
-
<?php } ?>
|
299 |
-
</div><!-- #post-body-content -->
|
300 |
-
</div><!-- #post-body -->
|
301 |
-
</div><!-- .metabox-holder -->
|
302 |
-
<script>
|
303 |
-
jQuery(document).ready(function($){
|
304 |
-
$(function() {
|
305 |
-
$("#dialog-message" ).dialog({
|
306 |
-
autoOpen: false,
|
307 |
-
modal: true,
|
308 |
-
height: "auto",
|
309 |
-
width: 600,
|
310 |
-
buttons: {
|
311 |
-
"<?php _e( 'Close', 'wp-members' ); ?>": function() {
|
312 |
-
$( this ).dialog( "close" );
|
313 |
-
}
|
314 |
-
}
|
315 |
-
});
|
316 |
-
$( "#opener" ).on( "click", function() {
|
317 |
-
$( "#dialog-message" ).dialog( "open" );
|
318 |
-
});
|
319 |
-
} );
|
320 |
-
$("#select_all").click(function(){
|
321 |
-
$("textarea").select();
|
322 |
-
document.execCommand('copy');
|
323 |
-
});
|
324 |
-
$(window).resize(function() {
|
325 |
-
$("#dialog-message").dialog("option", "position", {my: "center", at: "center", of: window});
|
326 |
-
});
|
327 |
-
});
|
328 |
-
</script>
|
329 |
-
<div id="dialog-message" title="<?php _e( 'WP-Members Settings', 'wp-members' ); ?>">
|
330 |
-
<h3><span><?php _e( 'WP-Members Settings', 'wp-members' ); ?></span></h3>
|
331 |
-
<p><?php _e( 'The following is your WP-Members settings information if needed for support.', 'wp-members' ); ?></p>
|
332 |
-
<pre>
|
333 |
-
<textarea cols=80 rows=10 align=left wrap=soft style="width:80%;" id="supportinfo" wrap="soft"><?php
|
334 |
-
global $wp_version, $wpdb, $wpmem;
|
335 |
-
echo "WP Version: " . $wp_version . "\r\n";
|
336 |
-
echo "PHP Version: " . phpversion() . "\r\n";
|
337 |
-
echo "MySQL Version: " . $wpdb->db_version() . "\r\n";
|
338 |
-
wpmem_fields();
|
339 |
-
print_r( $wpmem );
|
340 |
-
|
341 |
-
echo '***************** Plugin Info *******************' . "\r\n";
|
342 |
-
$all_plugins = get_plugins();
|
343 |
-
$active_plugins = get_option( 'active_plugins' );
|
344 |
-
$active_display = ''; $inactive_display = '';
|
345 |
-
foreach ( $all_plugins as $key => $value ) {
|
346 |
-
if ( in_array( $key, $active_plugins ) ) {
|
347 |
-
$active_display.= $key . " | " . $value['Name'] . " | Version: " . $value['Version'] . "\r\n";
|
348 |
-
} else {
|
349 |
-
$inactive_display.= $key . " | " . $value['Name'] . " | Version: " . $value['Version'] . "\r\n";
|
350 |
-
}
|
351 |
-
}
|
352 |
-
echo "*************** Active Plugins **************** \r\n";
|
353 |
-
echo $active_display;
|
354 |
-
echo "*************** Inactive Plugins **************** \r\n";
|
355 |
-
echo $inactive_display;
|
356 |
-
?></textarea>
|
357 |
-
</pre>
|
358 |
-
<button id="select_all" class="ui-button-text"><?php _e( 'Click to Copy', 'wp-members' ); ?></button>
|
359 |
-
</div>
|
360 |
-
<?php
|
361 |
-
}
|
362 |
-
|
363 |
-
/**
|
364 |
-
* Updates the plugin options.
|
365 |
-
*
|
366 |
-
* @since 2.8.0
|
367 |
-
* @since 3.3.0 Ported from wpmem_update_options() and wpmem_update_cpts().
|
368 |
-
*
|
369 |
-
* @global object $wpmem The WP_Members object.
|
370 |
-
* @param string $action
|
371 |
-
* @return string The options updated message.
|
372 |
-
*/
|
373 |
-
static function update( $action ) {
|
374 |
-
|
375 |
-
if ( 'update_cpts' == $action ) {
|
376 |
-
|
377 |
-
// Check nonce.
|
378 |
-
check_admin_referer( 'wpmem-update-cpts' );
|
379 |
-
|
380 |
-
// Get the main settings array as it stands.
|
381 |
-
$wpmem_newsettings = get_option( 'wpmembers_settings' );
|
382 |
-
|
383 |
-
// Assemble CPT settings.
|
384 |
-
$cpts = array();
|
385 |
-
|
386 |
-
$post_arr = array();
|
387 |
-
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
|
388 |
-
if ( $post_types ) {
|
389 |
-
foreach ( $post_types as $post_type ) {
|
390 |
-
$cpt_obj = get_post_type_object( $post_type );
|
391 |
-
if ( $cpt_obj->labels->name != 'wpmem_product' ) {
|
392 |
-
$post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
|
393 |
-
}
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
$post_vals = ( isset( $_POST['wpmembers_handle_cpts'] ) ) ? $_POST['wpmembers_handle_cpts'] : false;
|
398 |
-
if ( $post_vals ) {
|
399 |
-
foreach ( $post_vals as $val ) {
|
400 |
-
$cpts[ $val ] = sanitize_text_field( $post_arr[ $val ] );
|
401 |
-
}
|
402 |
-
} else {
|
403 |
-
$cpts = array();
|
404 |
-
}
|
405 |
-
$wpmem_newsettings['post_types'] = $cpts;
|
406 |
-
|
407 |
-
// Update settings, remove or add CPTs.
|
408 |
-
$chk_settings = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
|
409 |
-
foreach ( $chk_settings as $chk ) {
|
410 |
-
// Handle removing unmanaged CPTs.
|
411 |
-
foreach ( $wpmem_newsettings[ $chk ] as $key => $val ) {
|
412 |
-
if ( 'post' != $key && 'page' != $key ) {
|
413 |
-
// If the $key is not in managed CPTs, remove it.
|
414 |
-
if ( ! array_key_exists( $key, $cpts ) ) {
|
415 |
-
unset( $wpmem_newsettings[ $chk ][ $key ] );
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
// Handle adding managed CPTs.
|
420 |
-
foreach ( $cpts as $key => $val ) {
|
421 |
-
if ( ! array_key_exists( $key, $wpmem_newsettings[ $chk ] ) ) {
|
422 |
-
if ( 'autoex' == $chk ) {
|
423 |
-
// Auto excerpt is an array.
|
424 |
-
$wpmem_newsettings[ $chk ][ $key ] = array(
|
425 |
-
'enabled' => 0,
|
426 |
-
'length' => '',
|
427 |
-
);
|
428 |
-
} else {
|
429 |
-
// All other settings are 0|1.
|
430 |
-
$wpmem_newsettings[ $chk ][ $key ] = 0;
|
431 |
-
}
|
432 |
-
}
|
433 |
-
}
|
434 |
-
}
|
435 |
-
|
436 |
-
WP_Members_Admin_Tab_Options::save_settings( $wpmem_newsettings );
|
437 |
-
|
438 |
-
return __( 'Custom Post Type settings were updated', 'wp-members' );
|
439 |
-
|
440 |
-
} else {
|
441 |
-
|
442 |
-
global $wpmem;
|
443 |
-
|
444 |
-
// Check nonce.
|
445 |
-
check_admin_referer( 'wpmem-update-settings' );
|
446 |
-
|
447 |
-
$wpmem_settings_msurl = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_msurl'] ) : '';
|
448 |
-
$wpmem_settings_mspage = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_mspage'], FILTER_SANITIZE_NUMBER_INT );
|
449 |
-
if ( $wpmem_settings_msurl != wpmem_use_ssl() && $wpmem_settings_msurl != 'use_custom' && ! $wpmem_settings_mspage ) {
|
450 |
-
$msurl = trim( $wpmem_settings_msurl );
|
451 |
-
} else {
|
452 |
-
$msurl = $wpmem_settings_mspage;
|
453 |
-
}
|
454 |
-
|
455 |
-
$wpmem_settings_regurl = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_regurl'] ) : '';
|
456 |
-
$wpmem_settings_regpage = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_regpage'], FILTER_SANITIZE_NUMBER_INT );
|
457 |
-
if ( $wpmem_settings_regurl != wpmem_use_ssl() && $wpmem_settings_regurl != 'use_custom' && ! $wpmem_settings_regpage ) {
|
458 |
-
$regurl = trim( $wpmem_settings_regurl );
|
459 |
-
} else {
|
460 |
-
$regurl = $wpmem_settings_regpage;
|
461 |
-
}
|
462 |
-
|
463 |
-
$wpmem_settings_logurl = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_logurl'] ) : '';
|
464 |
-
$wpmem_settings_logpage = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_logpage'], FILTER_SANITIZE_NUMBER_INT );
|
465 |
-
if ( $wpmem_settings_logurl != wpmem_use_ssl() && $wpmem_settings_logurl != 'use_custom' && ! $wpmem_settings_logpage ) {
|
466 |
-
$logurl = trim( $wpmem_settings_logurl );
|
467 |
-
} else {
|
468 |
-
$logurl = $wpmem_settings_logpage;
|
469 |
-
}
|
470 |
-
|
471 |
-
$wpmem_settings_cssurl = esc_url( $_POST['wpmem_settings_cssurl'] );
|
472 |
-
$cssurl = ( $wpmem_settings_cssurl != wpmem_use_ssl() ) ? trim( $wpmem_settings_cssurl ) : '';
|
473 |
-
|
474 |
-
$wpmem_settings_style = ( isset( $_POST['wpmem_settings_style'] ) ) ? sanitize_text_field( $_POST['wpmem_settings_style'] ) : false;
|
475 |
-
|
476 |
-
$wpmem_newsettings = array(
|
477 |
-
'version' => $wpmem->version,
|
478 |
-
'
|
479 |
-
'
|
480 |
-
'
|
481 |
-
'
|
482 |
-
'
|
483 |
-
'
|
484 |
-
'
|
485 |
-
'
|
486 |
-
'
|
487 |
-
'
|
488 |
-
|
489 |
-
'
|
490 |
-
'
|
491 |
-
|
492 |
-
|
493 |
-
'
|
494 |
-
'
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
$arr[ $post_type ]['
|
521 |
-
$arr[ $post_type ]['
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
*
|
533 |
-
*
|
534 |
-
*
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
*
|
552 |
-
*
|
553 |
-
* @since 3.
|
554 |
-
*
|
555 |
-
*
|
556 |
-
* @
|
557 |
-
* @
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
*
|
579 |
-
*
|
580 |
-
* @since
|
581 |
-
*
|
582 |
-
*
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
'
|
589 |
-
'
|
590 |
-
'Twenty
|
591 |
-
'Twenty Fifteen
|
592 |
-
'Twenty
|
593 |
-
'Twenty Fourteen
|
594 |
-
|
595 |
-
//'Twenty
|
596 |
-
//'Twenty
|
597 |
-
//'Twenty
|
598 |
-
//'
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
*
|
604 |
-
*
|
605 |
-
* @
|
606 |
-
*
|
607 |
-
*
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
*
|
625 |
-
*
|
626 |
-
* @since
|
627 |
-
*
|
628 |
-
*
|
629 |
-
*
|
630 |
-
*
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
$
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
$
|
642 |
-
$option
|
643 |
-
$option .=
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
|
|
652 |
} // End of file.
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WP-Members Admin functions
|
4 |
+
*
|
5 |
+
* Static functions to manage the plugin options tab.
|
6 |
+
*
|
7 |
+
* This file is part of the WP-Members plugin by Chad Butler
|
8 |
+
* You can find out more about this plugin at https://rocketgeek.com
|
9 |
+
* Copyright (c) 2006-2019 Chad Butler
|
10 |
+
* WP-Members(tm) is a trademark of butlerblog.com
|
11 |
+
*
|
12 |
+
* @package WP-Members
|
13 |
+
* @author Chad Butler
|
14 |
+
* @copyright 2006-2019
|
15 |
+
*/
|
16 |
+
|
17 |
+
// Exit if accessed directly.
|
18 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
class WP_Members_Admin_Tab_Options {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Creates the tab.
|
26 |
+
*
|
27 |
+
* @since 3.2.0
|
28 |
+
* @since 3.3.0 Ported from wpmem_a_options_tab().
|
29 |
+
*
|
30 |
+
* @param string $tab The admin tab being displayed.
|
31 |
+
* @return string|bool The about tab, otherwise false.
|
32 |
+
*/
|
33 |
+
static function do_tab( $tab ) {
|
34 |
+
if ( $tab == 'options' || ! $tab ) {
|
35 |
+
// Render the about tab.
|
36 |
+
return self::build_settings();
|
37 |
+
} else {
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Builds the settings panel.
|
44 |
+
*
|
45 |
+
* @since 2.2.2
|
46 |
+
* @since 3.3.0 Ported from wpmem_a_build_options().
|
47 |
+
*
|
48 |
+
* @global object $wpmem The WP_Members Object.
|
49 |
+
*/
|
50 |
+
static function build_settings() {
|
51 |
+
|
52 |
+
global $wpmem;
|
53 |
+
|
54 |
+
/** This filter is documented in wp-members/inc/email.php */
|
55 |
+
$admin_email = apply_filters( 'wpmem_notify_addr', get_option( 'admin_email' ) );
|
56 |
+
$chg_email = sprintf( __( '%sChange%s or %sFilter%s this address', 'wp-members' ), '<a href="' . site_url( 'wp-admin/options-general.php', 'admin' ) . '">', '</a>', '<a href="https://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_notify_addr/">', '</a>' );
|
57 |
+
$help_link = sprintf( __( 'See the %sUsers Guide on plugin options%s.', 'wp-members' ), '<a href="https://rocketgeek.com/plugins/wp-members/users-guide/plugin-settings/options/" target="_blank">', '</a>' );
|
58 |
+
|
59 |
+
// Build an array of post types
|
60 |
+
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
|
61 |
+
$post_arr = array(
|
62 |
+
'post' => __( 'Posts' ),
|
63 |
+
'page' => __( 'Pages' ),
|
64 |
+
);
|
65 |
+
if ( $post_types ) {
|
66 |
+
foreach ( $post_types as $post_type ) {
|
67 |
+
$cpt_obj = get_post_type_object( $post_type );
|
68 |
+
$post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
|
69 |
+
}
|
70 |
+
} ?>
|
71 |
+
|
72 |
+
<div class="metabox-holder has-right-sidebar">
|
73 |
+
|
74 |
+
<div class="inner-sidebar">
|
75 |
+
<?php wpmem_a_meta_box(); ?>
|
76 |
+
<?php wpmem_a_rating_box(); ?>
|
77 |
+
<div class="postbox">
|
78 |
+
<h3><span><?php _e( 'Need help?', 'wp-members' ); ?></span></h3>
|
79 |
+
<div class="inside">
|
80 |
+
<p><strong><i><?php echo $help_link; ?></i></strong></p>
|
81 |
+
<p><button id="opener">Get Settings Information</button></p>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
<?php wpmem_a_rss_box(); ?>
|
85 |
+
</div> <!-- .inner-sidebar -->
|
86 |
+
|
87 |
+
<div id="post-body">
|
88 |
+
<div id="post-body-content">
|
89 |
+
<div class="postbox">
|
90 |
+
<h3><span><?php _e( 'Manage Options', 'wp-members' ); ?></span></h3>
|
91 |
+
<div class="inside">
|
92 |
+
<form name="updatesettings" id="updatesettings" method="post" action="<?php echo wpmem_admin_form_post_url(); ?>">
|
93 |
+
<?php wp_nonce_field( 'wpmem-update-settings' ); ?>
|
94 |
+
<h3><?php _e( 'Content', 'wp-members' ); ?></h3>
|
95 |
+
<ul>
|
96 |
+
<?php
|
97 |
+
|
98 |
+
// Content Blocking option group.
|
99 |
+
$i = 0;
|
100 |
+
$len = count( $post_arr );
|
101 |
+
foreach ( $post_arr as $key => $val ) {
|
102 |
+
if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
|
103 |
+
?>
|
104 |
+
<li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
|
105 |
+
<label><?php echo ( $i == 0 ) ? __( 'Content Blocking', 'wp-members' ) : ' '; ?></label>
|
106 |
+
<?php
|
107 |
+
$block = ( isset( $wpmem->block[ $key ] ) ) ? $wpmem->block[ $key ] : '';
|
108 |
+
$values = array(
|
109 |
+
__( 'Do not block', 'wp-members' ) . '|0',
|
110 |
+
__( 'Block', 'wp-members' ) . '|1',
|
111 |
+
// @todo Future development. __( 'Hide', 'wp-members' ) . '|2',
|
112 |
+
);
|
113 |
+
echo wpmem_create_formfield( 'wpmem_block_' . $key, 'select', $values, $block ); ?>
|
114 |
+
<span><?php echo $val; ?></span><?php // @todo - this needs to be translatable. ?>
|
115 |
+
</li>
|
116 |
+
<?php $i++;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
// Show Excerpts, Login Form, and Registration Form option groups.
|
121 |
+
|
122 |
+
$option_group_array = array(
|
123 |
+
'show_excerpt' => __( 'Show Excerpts', 'wp-members' ),
|
124 |
+
'show_login' => __( 'Show Login Form', 'wp-members' ),
|
125 |
+
'show_reg' => __( 'Show Registration Form', 'wp-members' ),
|
126 |
+
'autoex' => __( 'Auto Excerpt:', 'wp-members' ),
|
127 |
+
);
|
128 |
+
|
129 |
+
foreach ( $option_group_array as $item_key => $item_val ) {
|
130 |
+
$i = 0;
|
131 |
+
$len = count( $post_arr );
|
132 |
+
foreach ( $post_arr as $key => $val ) {
|
133 |
+
if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
|
134 |
+
?>
|
135 |
+
<li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
|
136 |
+
<label><?php echo ( $i == 0 ) ? $item_val : ' '; ?></label>
|
137 |
+
<?php if ( 'autoex' == $item_key ) {
|
138 |
+
if ( isset( $wpmem->{$item_key}[ $key ] ) && $wpmem->{$item_key}[ $key ]['enabled'] == 1 ) {
|
139 |
+
$setting = 1;
|
140 |
+
$ex_len = $wpmem->{$item_key}[ $key ]['length'];
|
141 |
+
$ex_text = ( isset( $wpmem->{$item_key}[ $key ]['text'] ) ) ? $wpmem->{$item_key}[ $key ]['text'] : '';
|
142 |
+
} else {
|
143 |
+
$setting = 0;
|
144 |
+
$ex_len = '';
|
145 |
+
$ex_text = '';
|
146 |
+
}
|
147 |
+
echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
|
148 |
+
<span><?php _e( 'Number of words in excerpt:', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_len" type="text" size="5" value="<?php echo $ex_len; ?>" />
|
149 |
+
<span><?php _e( 'Custom read more link (optional):', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_text" type="text" size="5" value="<?php echo $ex_text; ?>" />
|
150 |
+
<?php } else {
|
151 |
+
$setting = ( isset( $wpmem->{$item_key}[ $key ] ) ) ? $wpmem->{$item_key}[ $key ] : 0;
|
152 |
+
echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
|
153 |
+
<?php } ?>
|
154 |
+
</li>
|
155 |
+
<?php $i++;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
} ?>
|
159 |
+
</ul>
|
160 |
+
<?php
|
161 |
+
if ( WPMEM_EXP_MODULE == true ) {
|
162 |
+
$arr = array(
|
163 |
+
array(__('Time-based expiration','wp-members'),'wpmem_settings_time_exp',__('Allows for access to expire','wp-members'),'use_exp'),
|
164 |
+
array(__('Trial period','wp-members'),'wpmem_settings_trial',__('Allows for a trial period','wp-members'),'use_trial'),
|
165 |
+
); ?>
|
166 |
+
<h3><?php _e( 'Subscription Settings', 'wp-members' ); ?></h3>
|
167 |
+
<ul><?php
|
168 |
+
for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
|
169 |
+
<li>
|
170 |
+
<label><?php echo $arr[ $row ][0]; ?></label>
|
171 |
+
<?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[ $row ][3]} ); ?>
|
172 |
+
<?php if ( $arr[ $row ][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
|
173 |
+
</li>
|
174 |
+
<?php }
|
175 |
+
}?></ul>
|
176 |
+
<h3><?php _e( 'Other Settings', 'wp-members' ); ?></h3>
|
177 |
+
<ul>
|
178 |
+
<?php
|
179 |
+
/** This filter is defined in class-wp-members.php */
|
180 |
+
$dropin_dir = apply_filters( 'wpmem_dropin_dir', $wpmem->dropin_dir );
|
181 |
+
$arr = array(
|
182 |
+
array(__('Enable Products', 'wp-members'),'wpmem_settings_products',__('Enables creation of different membership products','wp-members'),'enable_products'),
|
183 |
+
array(__('Clone menus','wp-members'),'wpmem_settings_menus',__('Enables logged in menus','wp-members'),'clone_menus'),
|
184 |
+
array(__('Notify admin','wp-members'),'wpmem_settings_notify',sprintf(__('Notify %s for each new registration? %s','wp-members'),$admin_email,$chg_email),'notify'),
|
185 |
+
array(__('Moderate registration','wp-members'),'wpmem_settings_moderate',__('Holds new registrations for admin approval','wp-members'),'mod_reg'),
|
186 |
+
array(__('Ignore warning messages','wp-members'),'wpmem_settings_ignore_warnings',__('Ignores WP-Members warning messages in the admin panel','wp-members'),'warnings'),
|
187 |
+
//array(__('Enable dropins', 'wp-members'),'wpmem_settings_enable_dropins',sprintf(__('Enables dropins in %s', 'wp-members'), $dropin_dir),'dropins'),
|
188 |
+
);
|
189 |
+
for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
|
190 |
+
<li>
|
191 |
+
<label><?php echo $arr[ $row ][0]; ?></label>
|
192 |
+
<?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[$row][3]} ); ?>
|
193 |
+
<?php if ( $arr[$row][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
|
194 |
+
</li>
|
195 |
+
<?php } ?>
|
196 |
+
<li>
|
197 |
+
<label><?php _e( 'Attribution', 'wp-members' ); ?></label>
|
198 |
+
<?php echo wpmem_create_formfield( 'attribution', 'checkbox', '1', $wpmem->attrib ); ?>
|
199 |
+
<span class="description"><?php _e( 'Attribution is appreciated! Display "powered by" link on register form?', 'wp-members' ); ?></span>
|
200 |
+
</li>
|
201 |
+
<li>
|
202 |
+
<label><?php _e( 'Enable CAPTCHA', 'wp-members' ); ?></label>
|
203 |
+
<?php $captcha = array( __( 'None', 'wp-members' ) . '|0' );
|
204 |
+
if ( 1 == $wpmem->captcha ) {
|
205 |
+
$wpmem->captcha = 3; // reCAPTCHA v1 is fully obsolete. Change it to v2.
|
206 |
+
}
|
207 |
+
$captcha[] = __( 'reCAPTCHA v2', 'wp-members' ) . '|3';
|
208 |
+
$captcha[] = __( 'reCAPTCHA v3', 'wp-members' ) . '|4';
|
209 |
+
$captcha[] = __( 'Really Simple CAPTCHA', 'wp-members' ) . '|2';
|
210 |
+
echo wpmem_create_formfield( 'wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha ); ?>
|
211 |
+
</li>
|
212 |
+
<h3><?php _e( 'Pages' ); ?></h3>
|
213 |
+
<?php $wpmem_logurl = $wpmem->user_pages['login'];
|
214 |
+
if ( ! $wpmem_logurl ) { $wpmem_logurl = wpmem_use_ssl(); } ?>
|
215 |
+
<li>
|
216 |
+
<label><?php _e( 'Login Page:', 'wp-members' ); ?></label>
|
217 |
+
<select name="wpmem_settings_logpage" id="wpmem_logpage_select">
|
218 |
+
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_logurl ); ?>
|
219 |
+
</select> <span class="description"><?php _e( 'Specify a login page (optional)', 'wp-members' ); ?></span><br />
|
220 |
+
<div id="wpmem_logpage_custom">
|
221 |
+
<label> </label>
|
222 |
+
<input class="regular-text code" type="text" name="wpmem_settings_logurl" value="<?php echo $wpmem_logurl; ?>" size="50" />
|
223 |
+
</div>
|
224 |
+
</li>
|
225 |
+
<?php $wpmem_regurl = $wpmem->user_pages['register'];
|
226 |
+
if ( ! $wpmem_regurl ) { $wpmem_regurl = wpmem_use_ssl(); } ?>
|
227 |
+
<li>
|
228 |
+
<label><?php _e( 'Register Page:', 'wp-members' ); ?></label>
|
229 |
+
<select name="wpmem_settings_regpage" id="wpmem_regpage_select">
|
230 |
+
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_regurl ); ?>
|
231 |
+
</select> <span class="description"><?php _e( 'For creating a register link in the login form', 'wp-members' ); ?></span><br />
|
232 |
+
<div id="wpmem_regpage_custom">
|
233 |
+
<label> </label>
|
234 |
+
<input class="regular-text code" type="text" name="wpmem_settings_regurl" value="<?php echo $wpmem_regurl; ?>" size="50" />
|
235 |
+
</div>
|
236 |
+
</li>
|
237 |
+
<?php $wpmem_msurl = $wpmem->user_pages['profile'];
|
238 |
+
if ( ! $wpmem_msurl ) { $wpmem_msurl = wpmem_use_ssl(); } ?>
|
239 |
+
<li>
|
240 |
+
<label><?php _e( 'User Profile Page:', 'wp-members' ); ?></label>
|
241 |
+
<select name="wpmem_settings_mspage" id="wpmem_mspage_select">
|
242 |
+
<?php WP_Members_Admin_Tab_Options::page_list( $wpmem_msurl ); ?>
|
243 |
+
</select> <span class="description"><?php _e( 'For creating a forgot password link in the login form', 'wp-members' ); ?></span><br />
|
244 |
+
<div id="wpmem_mspage_custom">
|
245 |
+
<label> </label>
|
246 |
+
<input class="regular-text code" type="text" name="wpmem_settings_msurl" value="<?php echo $wpmem_msurl; ?>" size="50" />
|
247 |
+
</div>
|
248 |
+
</li>
|
249 |
+
<h3><?php _e( 'Stylesheet' ); ?></h3>
|
250 |
+
<li>
|
251 |
+
<label><?php _e( 'Stylesheet' ); ?>:</label>
|
252 |
+
<select name="wpmem_settings_style" id="wpmem_stylesheet_select">
|
253 |
+
<?php WP_Members_Admin_Tab_Options::style_list( $wpmem->select_style ); ?>
|
254 |
+
</select>
|
255 |
+
</li>
|
256 |
+
<?php $wpmem_cssurl = $wpmem->cssurl;
|
257 |
+
if ( ! $wpmem_cssurl ) { $wpmem_cssurl = wpmem_use_ssl(); } ?>
|
258 |
+
<div id="wpmem_stylesheet_custom">
|
259 |
+
<li>
|
260 |
+
<label><?php _e( 'Custom Stylesheet:', 'wp-members' ); ?></label>
|
261 |
+
<input class="regular-text code" type="text" name="wpmem_settings_cssurl" value="<?php echo $wpmem_cssurl; ?>" size="50" />
|
262 |
+
</li>
|
263 |
+
</div>
|
264 |
+
<input type="hidden" name="wpmem_admin_a" value="update_settings">
|
265 |
+
<?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?>
|
266 |
+
</ul>
|
267 |
+
</form>
|
268 |
+
<p>If you like <strong>WP-Members</strong> please give it a <a href="https://wordpress.org/support/plugin/wp-members/reviews?rate=5#new-post">★★★★★</a> rating. Thanks!!</p>
|
269 |
+
</div><!-- .inside -->
|
270 |
+
</div>
|
271 |
+
<?php if ( $post_types ) { ?>
|
272 |
+
<div class="postbox">
|
273 |
+
<h3><span><?php _e( 'Custom Post Types', 'wp-members' ); ?></span></h3>
|
274 |
+
<div class="inside">
|
275 |
+
<form name="updatecpts" id="updatecpts" method="post" action="<?php echo wpmem_admin_form_post_url(); ?>">
|
276 |
+
<?php wp_nonce_field( 'wpmem-update-cpts' ); ?>
|
277 |
+
<table class="form-table">
|
278 |
+
<tr>
|
279 |
+
<th scope="row"><?php _e( 'Add to WP-Members Settings', 'wp-members' ); ?></th>
|
280 |
+
<td><fieldset><?php
|
281 |
+
foreach ( $post_arr as $key => $val ) {
|
282 |
+
if ( 'post' != $key && 'page' != $key && 'wpmem_product' != $key ) {
|
283 |
+
$checked = ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ? ' checked' : '';
|
284 |
+
echo '<label for="' . $key . '"><input type="checkbox" name="wpmembers_handle_cpts[]" value="' . $key . '"' . $checked . ' />' . $val . '</label><br />';
|
285 |
+
}
|
286 |
+
}
|
287 |
+
?></fieldset>
|
288 |
+
</td>
|
289 |
+
</tr>
|
290 |
+
<tr>
|
291 |
+
<input type="hidden" name="wpmem_admin_a" value="update_cpts" />
|
292 |
+
<td colspan="2"><?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?></td>
|
293 |
+
</tr>
|
294 |
+
</table>
|
295 |
+
</form>
|
296 |
+
</div>
|
297 |
+
</div>
|
298 |
+
<?php } ?>
|
299 |
+
</div><!-- #post-body-content -->
|
300 |
+
</div><!-- #post-body -->
|
301 |
+
</div><!-- .metabox-holder -->
|
302 |
+
<script>
|
303 |
+
jQuery(document).ready(function($){
|
304 |
+
$(function() {
|
305 |
+
$("#dialog-message" ).dialog({
|
306 |
+
autoOpen: false,
|
307 |
+
modal: true,
|
308 |
+
height: "auto",
|
309 |
+
width: 600,
|
310 |
+
buttons: {
|
311 |
+
"<?php _e( 'Close', 'wp-members' ); ?>": function() {
|
312 |
+
$( this ).dialog( "close" );
|
313 |
+
}
|
314 |
+
}
|
315 |
+
});
|
316 |
+
$( "#opener" ).on( "click", function() {
|
317 |
+
$( "#dialog-message" ).dialog( "open" );
|
318 |
+
});
|
319 |
+
} );
|
320 |
+
$("#select_all").click(function(){
|
321 |
+
$("textarea").select();
|
322 |
+
document.execCommand('copy');
|
323 |
+
});
|
324 |
+
$(window).resize(function() {
|
325 |
+
$("#dialog-message").dialog("option", "position", {my: "center", at: "center", of: window});
|
326 |
+
});
|
327 |
+
});
|
328 |
+
</script>
|
329 |
+
<div id="dialog-message" title="<?php _e( 'WP-Members Settings', 'wp-members' ); ?>">
|
330 |
+
<h3><span><?php _e( 'WP-Members Settings', 'wp-members' ); ?></span></h3>
|
331 |
+
<p><?php _e( 'The following is your WP-Members settings information if needed for support.', 'wp-members' ); ?></p>
|
332 |
+
<pre>
|
333 |
+
<textarea cols=80 rows=10 align=left wrap=soft style="width:80%;" id="supportinfo" wrap="soft"><?php
|
334 |
+
global $wp_version, $wpdb, $wpmem;
|
335 |
+
echo "WP Version: " . $wp_version . "\r\n";
|
336 |
+
echo "PHP Version: " . phpversion() . "\r\n";
|
337 |
+
echo "MySQL Version: " . $wpdb->db_version() . "\r\n";
|
338 |
+
wpmem_fields();
|
339 |
+
print_r( $wpmem );
|
340 |
+
|
341 |
+
echo '***************** Plugin Info *******************' . "\r\n";
|
342 |
+
$all_plugins = get_plugins();
|
343 |
+
$active_plugins = get_option( 'active_plugins' );
|
344 |
+
$active_display = ''; $inactive_display = '';
|
345 |
+
foreach ( $all_plugins as $key => $value ) {
|
346 |
+
if ( in_array( $key, $active_plugins ) ) {
|
347 |
+
$active_display.= $key . " | " . $value['Name'] . " | Version: " . $value['Version'] . "\r\n";
|
348 |
+
} else {
|
349 |
+
$inactive_display.= $key . " | " . $value['Name'] . " | Version: " . $value['Version'] . "\r\n";
|
350 |
+
}
|
351 |
+
}
|
352 |
+
echo "*************** Active Plugins **************** \r\n";
|
353 |
+
echo $active_display;
|
354 |
+
echo "*************** Inactive Plugins **************** \r\n";
|
355 |
+
echo $inactive_display;
|
356 |
+
?></textarea>
|
357 |
+
</pre>
|
358 |
+
<button id="select_all" class="ui-button-text"><?php _e( 'Click to Copy', 'wp-members' ); ?></button>
|
359 |
+
</div>
|
360 |
+
<?php
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Updates the plugin options.
|
365 |
+
*
|
366 |
+
* @since 2.8.0
|
367 |
+
* @since 3.3.0 Ported from wpmem_update_options() and wpmem_update_cpts().
|
368 |
+
*
|
369 |
+
* @global object $wpmem The WP_Members object.
|
370 |
+
* @param string $action
|
371 |
+
* @return string The options updated message.
|
372 |
+
*/
|
373 |
+
static function update( $action ) {
|
374 |
+
|
375 |
+
if ( 'update_cpts' == $action ) {
|
376 |
+
|
377 |
+
// Check nonce.
|
378 |
+
check_admin_referer( 'wpmem-update-cpts' );
|
379 |
+
|
380 |
+
// Get the main settings array as it stands.
|
381 |
+
$wpmem_newsettings = get_option( 'wpmembers_settings' );
|
382 |
+
|
383 |
+
// Assemble CPT settings.
|
384 |
+
$cpts = array();
|
385 |
+
|
386 |
+
$post_arr = array();
|
387 |
+
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
|
388 |
+
if ( $post_types ) {
|
389 |
+
foreach ( $post_types as $post_type ) {
|
390 |
+
$cpt_obj = get_post_type_object( $post_type );
|
391 |
+
if ( $cpt_obj->labels->name != 'wpmem_product' ) {
|
392 |
+
$post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
$post_vals = ( isset( $_POST['wpmembers_handle_cpts'] ) ) ? $_POST['wpmembers_handle_cpts'] : false;
|
398 |
+
if ( $post_vals ) {
|
399 |
+
foreach ( $post_vals as $val ) {
|
400 |
+
$cpts[ $val ] = sanitize_text_field( $post_arr[ $val ] );
|
401 |
+
}
|
402 |
+
} else {
|
403 |
+
$cpts = array();
|
404 |
+
}
|
405 |
+
$wpmem_newsettings['post_types'] = $cpts;
|
406 |
+
|
407 |
+
// Update settings, remove or add CPTs.
|
408 |
+
$chk_settings = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
|
409 |
+
foreach ( $chk_settings as $chk ) {
|
410 |
+
// Handle removing unmanaged CPTs.
|
411 |
+
foreach ( $wpmem_newsettings[ $chk ] as $key => $val ) {
|
412 |
+
if ( 'post' != $key && 'page' != $key ) {
|
413 |
+
// If the $key is not in managed CPTs, remove it.
|
414 |
+
if ( ! array_key_exists( $key, $cpts ) ) {
|
415 |
+
unset( $wpmem_newsettings[ $chk ][ $key ] );
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
// Handle adding managed CPTs.
|
420 |
+
foreach ( $cpts as $key => $val ) {
|
421 |
+
if ( ! array_key_exists( $key, $wpmem_newsettings[ $chk ] ) ) {
|
422 |
+
if ( 'autoex' == $chk ) {
|
423 |
+
// Auto excerpt is an array.
|
424 |
+
$wpmem_newsettings[ $chk ][ $key ] = array(
|
425 |
+
'enabled' => 0,
|
426 |
+
'length' => '',
|
427 |
+
);
|
428 |
+
} else {
|
429 |
+
// All other settings are 0|1.
|
430 |
+
$wpmem_newsettings[ $chk ][ $key ] = 0;
|
431 |
+
}
|
432 |
+
}
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
WP_Members_Admin_Tab_Options::save_settings( $wpmem_newsettings );
|
437 |
+
|
438 |
+
return __( 'Custom Post Type settings were updated', 'wp-members' );
|
439 |
+
|
440 |
+
} else {
|
441 |
+
|
442 |
+
global $wpmem;
|
443 |
+
|
444 |
+
// Check nonce.
|
445 |
+
check_admin_referer( 'wpmem-update-settings' );
|
446 |
+
|
447 |
+
$wpmem_settings_msurl = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_msurl'] ) : '';
|
448 |
+
$wpmem_settings_mspage = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_mspage'], FILTER_SANITIZE_NUMBER_INT );
|
449 |
+
if ( $wpmem_settings_msurl != wpmem_use_ssl() && $wpmem_settings_msurl != 'use_custom' && ! $wpmem_settings_mspage ) {
|
450 |
+
$msurl = trim( $wpmem_settings_msurl );
|
451 |
+
} else {
|
452 |
+
$msurl = $wpmem_settings_mspage;
|
453 |
+
}
|
454 |
+
|
455 |
+
$wpmem_settings_regurl = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_regurl'] ) : '';
|
456 |
+
$wpmem_settings_regpage = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_regpage'], FILTER_SANITIZE_NUMBER_INT );
|
457 |
+
if ( $wpmem_settings_regurl != wpmem_use_ssl() && $wpmem_settings_regurl != 'use_custom' && ! $wpmem_settings_regpage ) {
|
458 |
+
$regurl = trim( $wpmem_settings_regurl );
|
459 |
+
} else {
|
460 |
+
$regurl = $wpmem_settings_regpage;
|
461 |
+
}
|
462 |
+
|
463 |
+
$wpmem_settings_logurl = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? esc_url( $_POST['wpmem_settings_logurl'] ) : '';
|
464 |
+
$wpmem_settings_logpage = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? '' : filter_var( $_POST['wpmem_settings_logpage'], FILTER_SANITIZE_NUMBER_INT );
|
465 |
+
if ( $wpmem_settings_logurl != wpmem_use_ssl() && $wpmem_settings_logurl != 'use_custom' && ! $wpmem_settings_logpage ) {
|
466 |
+
$logurl = trim( $wpmem_settings_logurl );
|
467 |
+
} else {
|
468 |
+
$logurl = $wpmem_settings_logpage;
|
469 |
+
}
|
470 |
+
|
471 |
+
$wpmem_settings_cssurl = esc_url( $_POST['wpmem_settings_cssurl'] );
|
472 |
+
$cssurl = ( $wpmem_settings_cssurl != wpmem_use_ssl() ) ? trim( $wpmem_settings_cssurl ) : '';
|
473 |
+
|
474 |
+
$wpmem_settings_style = ( isset( $_POST['wpmem_settings_style'] ) ) ? sanitize_text_field( $_POST['wpmem_settings_style'] ) : false;
|
475 |
+
|
476 |
+
$wpmem_newsettings = array(
|
477 |
+
'version' => $wpmem->version,
|
478 |
+
'db_version' => $wpmem->db_version,
|
479 |
+
'enable_products' => filter_var( wpmem_get( 'wpmem_settings_products', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
480 |
+
'clone_menus' => filter_var( wpmem_get( 'wpmem_settings_menus', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
481 |
+
'notify' => filter_var( wpmem_get( 'wpmem_settings_notify', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
482 |
+
'mod_reg' => filter_var( wpmem_get( 'wpmem_settings_moderate', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
483 |
+
'captcha' => filter_var( wpmem_get( 'wpmem_settings_captcha', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
484 |
+
'use_exp' => filter_var( wpmem_get( 'wpmem_settings_time_exp', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
485 |
+
'use_trial' => filter_var( wpmem_get( 'wpmem_settings_trial', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
486 |
+
'warnings' => filter_var( wpmem_get( 'wpmem_settings_ignore_warnings', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
487 |
+
'dropins' => filter_var( wpmem_get( 'wpmem_settings_enable_dropins', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
488 |
+
'user_pages' => array(
|
489 |
+
'profile' => ( $msurl ) ? $msurl : '',
|
490 |
+
'register' => ( $regurl ) ? $regurl : '',
|
491 |
+
'login' => ( $logurl ) ? $logurl : '',
|
492 |
+
),
|
493 |
+
'cssurl' => ( $cssurl ) ? $cssurl : '',
|
494 |
+
'select_style' => $wpmem_settings_style,
|
495 |
+
'attrib' => filter_var( wpmem_get( 'attribution', 0 ), FILTER_SANITIZE_NUMBER_INT ),
|
496 |
+
);
|
497 |
+
|
498 |
+
// Build an array of post types
|
499 |
+
$post_arr = array( 'post', 'page' );
|
500 |
+
if ( isset( $wpmem->post_types ) ) {
|
501 |
+
$wpmem_newsettings['post_types'] = $wpmem->post_types;
|
502 |
+
foreach ( $wpmem_newsettings['post_types'] as $key => $val ) {
|
503 |
+
$post_arr[] = $key;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
// Leave form tag settings alone.
|
508 |
+
if ( isset( $wpmem->form_tags ) ) {
|
509 |
+
$wpmem_newsettings['form_tags'] = $wpmem->form_tags;
|
510 |
+
}
|
511 |
+
|
512 |
+
// Get settings for blocking, excerpts, show login, and show registration for posts, pages, and custom post types.
|
513 |
+
$option_group_array = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
|
514 |
+
foreach ( $option_group_array as $option_group_item ) {
|
515 |
+
$arr = array();
|
516 |
+
foreach ( $post_arr as $post_type ) {
|
517 |
+
$post_var = 'wpmem_' . $option_group_item . '_' . $post_type;
|
518 |
+
if ( $option_group_item == 'autoex' ) {
|
519 |
+
// Auto excerpt is an array.
|
520 |
+
$arr[ $post_type ]['enabled'] = ( isset( $_POST[ $post_var ] ) ) ? filter_var( $_POST[ $post_var ], FILTER_SANITIZE_NUMBER_INT ) : 0;
|
521 |
+
$arr[ $post_type ]['length'] = ( isset( $_POST[ $post_var . '_len' ] ) ) ? ( ( $_POST[ $post_var . '_len' ] == '' ) ? 0 : filter_var( $_POST[ $post_var . '_len' ], FILTER_SANITIZE_NUMBER_INT ) ) : '';
|
522 |
+
$arr[ $post_type ]['text'] = ( isset( $_POST[ $post_var . '_text' ] ) ) ? sanitize_text_field( $_POST[ $post_var . '_text' ] ) : '';
|
523 |
+
} else {
|
524 |
+
// All other settings are 0|1.
|
525 |
+
$arr[ $post_type ] = ( isset( $_POST[ $post_var ] ) ) ? filter_var( $_POST[ $post_var ], FILTER_SANITIZE_NUMBER_INT ) : 0;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
$wpmem_newsettings[ $option_group_item ] = $arr;
|
529 |
+
}
|
530 |
+
|
531 |
+
/*
|
532 |
+
* If we are setting registration to be moderated,
|
533 |
+
* check to see if the current admin has been
|
534 |
+
* activated so they don't accidentally lock themselves
|
535 |
+
* out later.
|
536 |
+
*/
|
537 |
+
if ( isset( $_POST['wpmem_settings_moderate'] ) == 1 ) {
|
538 |
+
global $current_user;
|
539 |
+
wp_get_current_user();
|
540 |
+
$user_ID = $current_user->ID;
|
541 |
+
update_user_meta( $user_ID, 'active', 1 );
|
542 |
+
}
|
543 |
+
|
544 |
+
WP_Members_Admin_Tab_Options::save_settings( $wpmem_newsettings );
|
545 |
+
|
546 |
+
return __( 'WP-Members settings were updated', 'wp-members' );
|
547 |
+
}
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Puts new settings into the current object.
|
552 |
+
*
|
553 |
+
* @since 3.0.9
|
554 |
+
* @since 3.3.0 Ported from wpmem_admin_new_settings().
|
555 |
+
*
|
556 |
+
* @global $wpmem
|
557 |
+
* @param $new
|
558 |
+
* @return $settings
|
559 |
+
*/
|
560 |
+
static function save_settings( $new ) {
|
561 |
+
|
562 |
+
// Update saved settings.
|
563 |
+
update_option( 'wpmembers_settings', $new );
|
564 |
+
|
565 |
+
// Update the current WP_Members object with the new settings.
|
566 |
+
global $wpmem;
|
567 |
+
foreach ( $new as $key => $val ) {
|
568 |
+
if ( 'user_pages' == $key ) {
|
569 |
+
foreach ( $val as $subkey => $subval ) {
|
570 |
+
$val[ $subkey ] = ( is_numeric( $subval ) ) ? get_page_link( $subval ) : $subval;
|
571 |
+
}
|
572 |
+
}
|
573 |
+
$wpmem->{$key} = $val;
|
574 |
+
}
|
575 |
+
}
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Create the stylesheet dropdown selection.
|
579 |
+
*
|
580 |
+
* @since 2.8.0
|
581 |
+
* @since 3.3.0 Ported from wpmem_admin_style_list().
|
582 |
+
*
|
583 |
+
* @param $style string The stored stylesheet setting.
|
584 |
+
*/
|
585 |
+
static function style_list( $style ) {
|
586 |
+
|
587 |
+
$list = array(
|
588 |
+
'No Float' => 'generic-no-float',
|
589 |
+
'Rigid' => 'generic-rigid',
|
590 |
+
'Twenty Sixteen - no float' => 'wp-members-2016-no-float',
|
591 |
+
'Twenty Fifteen' => 'wp-members-2015',
|
592 |
+
'Twenty Fifteen - no float' => 'wp-members-2015-no-float',
|
593 |
+
'Twenty Fourteen' => 'wp-members-2014',
|
594 |
+
'Twenty Fourteen - no float' => 'wp-members-2014-no-float',
|
595 |
+
//'Twenty Thirteen' => WPMEM_DIR . 'css/wp-members-2013.css',
|
596 |
+
//'Twenty Twelve' => WPMEM_DIR . 'css/wp-members-2012.css',
|
597 |
+
//'Twenty Eleven' => WPMEM_DIR . 'css/wp-members-2011.css',
|
598 |
+
//'Twenty Ten' => WPMEM_DIR . 'css/wp-members.css',
|
599 |
+
//'Kubrick' => WPMEM_DIR . 'css/wp-members-kubrick.css',
|
600 |
+
);
|
601 |
+
|
602 |
+
/**
|
603 |
+
* Filters the list of stylesheets in the plugin options dropdown.
|
604 |
+
*
|
605 |
+
* @since 2.8.0
|
606 |
+
* @deprecated 3.3.0 There is no way to manage custom values in the dropdown with the new setting rules.
|
607 |
+
*
|
608 |
+
* @param array $list An array of stylesheets that can be applied to the plugin's forms.
|
609 |
+
*/
|
610 |
+
//$list = apply_filters( 'wpmem_admin_style_list', $list );
|
611 |
+
|
612 |
+
$selected = false;
|
613 |
+
foreach ( $list as $name => $location ) {
|
614 |
+
$selected = ( $location == $style ) ? true : $selected;
|
615 |
+
echo '<option value="' . $location . '" ' . selected( $location, $style ) . '>' . $name . "</option>\n";
|
616 |
+
}
|
617 |
+
$selected = ( ! $selected ) ? ' selected' : '';
|
618 |
+
echo '<option value="use_custom"' . $selected . '>' . __( 'USE CUSTOM URL BELOW', 'wp-members' ) . '</option>';
|
619 |
+
|
620 |
+
return;
|
621 |
+
}
|
622 |
+
|
623 |
+
/**
|
624 |
+
* Create a dropdown selection of pages.
|
625 |
+
*
|
626 |
+
* @since 2.8.1
|
627 |
+
* @since 3.3.0 Ported from wpmem_admin_page_list().
|
628 |
+
*
|
629 |
+
* @todo Consider wp_dropdown_pages. Can be retrieved as HTML (echo=false) and str_replaced to add custom values.
|
630 |
+
*
|
631 |
+
* @param string $val
|
632 |
+
*/
|
633 |
+
static function page_list( $val, $show_custom_url = true ) {
|
634 |
+
|
635 |
+
$selected = ( $val == 'http://' || $val == 'https://' ) ? 'select a page' : false;
|
636 |
+
$pages = get_pages();
|
637 |
+
|
638 |
+
echo '<option value=""'; echo ( $selected == 'select a page' ) ? ' selected' : ''; echo '>'; echo esc_attr( __( 'Select a page', 'wp-members' ) ); echo '</option>';
|
639 |
+
|
640 |
+
foreach ( $pages as $page ) {
|
641 |
+
$selected = ( get_page_link( $page->ID ) == $val ) ? true : $selected; //echo "VAL: " . $val . ' PAGE LINK: ' . get_page_link( $page->ID );
|
642 |
+
$option = '<option value="' . $page->ID . '"' . selected( get_page_link( $page->ID ), $val, 'select' ) . '>';
|
643 |
+
$option .= $page->post_title;
|
644 |
+
$option .= '</option>';
|
645 |
+
echo $option;
|
646 |
+
}
|
647 |
+
if ( $show_custom_url ) {
|
648 |
+
$selected = ( ! $selected ) ? ' selected' : '';
|
649 |
+
echo '<option value="use_custom"' . $selected . '>' . __( 'USE CUSTOM URL BELOW', 'wp-members' ) . '</option>';
|
650 |
+
}
|
651 |
+
}
|
652 |
+
|
653 |
} // End of file.
|
@@ -57,9 +57,9 @@ class WP_Members_Fields_Table extends WP_List_Table {
|
|
57 |
'label' => __( 'Display Label', 'wp-members' ),
|
58 |
'meta' => __( 'Meta Key', 'wp-members' ),
|
59 |
'type' => __( 'Field Type', 'wp-members' ),
|
60 |
-
'display' => __( 'Registration', 'wp-members' ),
|
61 |
'req' => __( 'Required', 'wp-members' ),
|
62 |
-
'profile' => __( 'Profile', 'wp-members' ),
|
63 |
'userscrn' => __( 'Users Screen', 'wp-members' ),
|
64 |
'usearch' => __( 'Users Search', 'wp-members' ),
|
65 |
'edit' => __( 'Edit', 'wp-members' ),
|
57 |
'label' => __( 'Display Label', 'wp-members' ),
|
58 |
'meta' => __( 'Meta Key', 'wp-members' ),
|
59 |
'type' => __( 'Field Type', 'wp-members' ),
|
60 |
+
'display' => __( 'Display?', 'wp-members' ), // __( 'Registration', 'wp-members' ), @todo Wait until fix
|
61 |
'req' => __( 'Required', 'wp-members' ),
|
62 |
+
//'profile' => __( 'Profile', 'wp-members' ), @todo Wait until fix
|
63 |
'userscrn' => __( 'Users Screen', 'wp-members' ),
|
64 |
'usearch' => __( 'Users Search', 'wp-members' ),
|
65 |
'edit' => __( 'Edit', 'wp-members' ),
|
@@ -127,7 +127,7 @@ function wpmem_user_has_meta( $meta, $value = false, $user_id = false ) {
|
|
127 |
|
128 |
// Get field type.
|
129 |
$fields = wpmem_fields();
|
130 |
-
$multi = ( 'multicheckbox' == $fields[ $meta ]['type'] || 'multiselect' == $fields[ $meta ]['type'] ) ? true : false;
|
131 |
|
132 |
// Get meta.
|
133 |
$has_meta = false;
|
@@ -428,13 +428,8 @@ function wpmem_activate_user( $user_id ) {
|
|
428 |
|
429 |
// If passwords are user defined skip this.
|
430 |
if ( ! wpmem_user_sets_password() ) {
|
431 |
-
// Generates a password to send the user.
|
432 |
$new_pass = wp_generate_password();
|
433 |
-
|
434 |
-
|
435 |
-
// Update the user with the new password.
|
436 |
-
global $wpdb;
|
437 |
-
$wpdb->update( $wpdb->users, array( 'user_pass' => $new_hash ), array( 'ID' => $user_id ), array( '%s' ), array( '%d' ) );
|
438 |
}
|
439 |
|
440 |
// @todo this should be taken out, use the wpmem_user_activated hook instead.
|
127 |
|
128 |
// Get field type.
|
129 |
$fields = wpmem_fields();
|
130 |
+
$multi = ( ( isset( $fields[ $meta ] ) ) && ( 'multicheckbox' == $fields[ $meta ]['type'] || 'multiselect' == $fields[ $meta ]['type'] ) ) ? true : false;
|
131 |
|
132 |
// Get meta.
|
133 |
$has_meta = false;
|
428 |
|
429 |
// If passwords are user defined skip this.
|
430 |
if ( ! wpmem_user_sets_password() ) {
|
|
|
431 |
$new_pass = wp_generate_password();
|
432 |
+
wp_set_password( $new_pass, $user_id );
|
|
|
|
|
|
|
|
|
433 |
}
|
434 |
|
435 |
// @todo this should be taken out, use the wpmem_user_activated hook instead.
|
@@ -344,4 +344,39 @@ function wpmem_display_message( $tag, $echo = true ) {
|
|
344 |
}
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
// End of file.
|
344 |
}
|
345 |
}
|
346 |
|
347 |
+
/**
|
348 |
+
* Wrapper function for adding custom dialogs.
|
349 |
+
*
|
350 |
+
* @since 3.1.1
|
351 |
+
* @since 3.3.0 Moved to main API.
|
352 |
+
*
|
353 |
+
* @param array $dialogs Dialog settings array.
|
354 |
+
* @param string $tag Slug for dialog to be added.
|
355 |
+
* @param string $msg The dialog message.
|
356 |
+
* @param string $label Label for admin panel.
|
357 |
+
* @return array $dialogs Dialog settings array with prepped custom dialog added.
|
358 |
+
*/
|
359 |
+
function wpmem_add_custom_dialog( $dialogs, $tag, $msg, $label ) {
|
360 |
+
$msg = ( ! isset( $dialogs[ $tag ] ) ) ? $msg : $dialogs[ $tag ];
|
361 |
+
$dialogs[ $tag ] = array(
|
362 |
+
'name' => $tag,
|
363 |
+
'label' => $label,
|
364 |
+
'value' => $msg,
|
365 |
+
);
|
366 |
+
return $dialogs;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Gets an array of hidden post IDs.
|
371 |
+
*
|
372 |
+
* @since 3.3.0.4
|
373 |
+
*
|
374 |
+
* @global stdClass $wpmem
|
375 |
+
* @return array
|
376 |
+
*/
|
377 |
+
function wpmem_get_hidden_posts() {
|
378 |
+
global $wpmem;
|
379 |
+
return $wpmem->get_hidden_posts();
|
380 |
+
}
|
381 |
+
|
382 |
// End of file.
|
@@ -144,7 +144,7 @@ class WP_Members_Captcha {
|
|
144 |
* @global $wpmem_themsg
|
145 |
* @return $string
|
146 |
*/
|
147 |
-
function validate() {
|
148 |
|
149 |
global $wpmem, $wpmem_themsg;
|
150 |
|
144 |
* @global $wpmem_themsg
|
145 |
* @return $string
|
146 |
*/
|
147 |
+
static function validate() {
|
148 |
|
149 |
global $wpmem, $wpmem_themsg;
|
150 |
|
@@ -578,7 +578,12 @@ class WP_Members_Forms {
|
|
578 |
// Build the input rows.
|
579 |
foreach ( $arr['inputs'] as $input ) {
|
580 |
$label = '<label for="' . esc_attr( $input['tag'] ) . '">' . $input['name'] . '</label>';
|
581 |
-
$field =
|
|
|
|
|
|
|
|
|
|
|
582 |
$field_before = ( $args['wrap_inputs'] ) ? '<div class="' . $this->sanitize_class( $input['div'] ) . '">' : '';
|
583 |
$field_after = ( $args['wrap_inputs'] ) ? '</div>' : '';
|
584 |
$rows[] = array(
|
@@ -924,7 +929,8 @@ class WP_Members_Forms {
|
|
924 |
$val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
|
925 |
|
926 |
// If the field is set to display and we aren't skipping, construct the row.
|
927 |
-
if ( ( 'new' == $tag && $field['register'] ) || ( 'edit' == $tag && $field['profile'] ) ) {
|
|
|
928 |
|
929 |
// Handle hidden fields
|
930 |
if ( 'hidden' == $field['type'] ) {
|
@@ -1885,7 +1891,7 @@ class WP_Members_Forms {
|
|
1885 |
|
1886 |
$msg = '';
|
1887 |
|
1888 |
-
if (
|
1889 |
$msg = $this->add_restricted_msg();
|
1890 |
}
|
1891 |
|
@@ -2022,6 +2028,8 @@ class WP_Members_Forms {
|
|
2022 |
private function add_restricted_msg() {
|
2023 |
|
2024 |
global $wpmem;
|
|
|
|
|
2025 |
|
2026 |
if ( $wpmem->regchk != "success" ) {
|
2027 |
|
578 |
// Build the input rows.
|
579 |
foreach ( $arr['inputs'] as $input ) {
|
580 |
$label = '<label for="' . esc_attr( $input['tag'] ) . '">' . $input['name'] . '</label>';
|
581 |
+
$field = wpmem_form_field( array(
|
582 |
+
'name' => $input['tag'],
|
583 |
+
'type' => $input['type'],
|
584 |
+
'class' => $input['class'],
|
585 |
+
'required' => true,
|
586 |
+
) );
|
587 |
$field_before = ( $args['wrap_inputs'] ) ? '<div class="' . $this->sanitize_class( $input['div'] ) . '">' : '';
|
588 |
$field_after = ( $args['wrap_inputs'] ) ? '</div>' : '';
|
589 |
$rows[] = array(
|
929 |
$val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
|
930 |
|
931 |
// If the field is set to display and we aren't skipping, construct the row.
|
932 |
+
// if ( ( 'new' == $tag && $field['register'] ) || ( 'edit' == $tag && $field['profile'] ) ) { // @todo Wait for profile fix
|
933 |
+
if ( $field['register'] ) {
|
934 |
|
935 |
// Handle hidden fields
|
936 |
if ( 'hidden' == $field['type'] ) {
|
1891 |
|
1892 |
$msg = '';
|
1893 |
|
1894 |
+
if ( "login" == $form && "page" == $page ) {
|
1895 |
$msg = $this->add_restricted_msg();
|
1896 |
}
|
1897 |
|
2028 |
private function add_restricted_msg() {
|
2029 |
|
2030 |
global $wpmem;
|
2031 |
+
|
2032 |
+
$str = '';
|
2033 |
|
2034 |
if ( $wpmem->regchk != "success" ) {
|
2035 |
|
@@ -65,9 +65,9 @@ class WP_Members_Menus {
|
|
65 |
add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ) );
|
66 |
add_action( 'wp_update_nav_menu_item', array( $this, 'update_nav_menu_item' ), 10, 2 );
|
67 |
add_filter( 'wp_setup_nav_menu_item', array( $this, 'setup_nav_menu_item' ) );
|
68 |
-
add_action( 'wp_nav_menu_item_fields', array( $this, 'nav_menu_item_fields' ), 10, 4 );
|
69 |
add_action( 'admin_enqueue_scripts' , array( $this, 'enqueue_scripts' ) );
|
70 |
|
|
|
71 |
add_action( 'wpmem_nav_menu_logged_in_criteria', array( $this, 'add_product_criteria' ) );
|
72 |
|
73 |
// Handles removing front end menu items.
|
65 |
add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ) );
|
66 |
add_action( 'wp_update_nav_menu_item', array( $this, 'update_nav_menu_item' ), 10, 2 );
|
67 |
add_filter( 'wp_setup_nav_menu_item', array( $this, 'setup_nav_menu_item' ) );
|
|
|
68 |
add_action( 'admin_enqueue_scripts' , array( $this, 'enqueue_scripts' ) );
|
69 |
|
70 |
+
add_action( 'wp_nav_menu_item_custom_fields', array( $this, 'nav_menu_item_fields' ), 5, 4 );
|
71 |
add_action( 'wpmem_nav_menu_logged_in_criteria', array( $this, 'add_product_criteria' ) );
|
72 |
|
73 |
// Handles removing front end menu items.
|
@@ -159,12 +159,11 @@ class WP_Members_Products {
|
|
159 |
'fields' => array( 'post_name' ),
|
160 |
);
|
161 |
$default_products = get_posts( $args );
|
|
|
162 |
if ( $default_products ) {
|
163 |
foreach ( $default_products as $product ) {
|
164 |
$defaults[] = $product->post_name;
|
165 |
}
|
166 |
-
} else {
|
167 |
-
$defaults = false;
|
168 |
}
|
169 |
return $defaults;
|
170 |
}
|
159 |
'fields' => array( 'post_name' ),
|
160 |
);
|
161 |
$default_products = get_posts( $args );
|
162 |
+
$defaults = array();
|
163 |
if ( $default_products ) {
|
164 |
foreach ( $default_products as $product ) {
|
165 |
$defaults[] = $product->post_name;
|
166 |
}
|
|
|
|
|
167 |
}
|
168 |
return $defaults;
|
169 |
}
|
@@ -278,7 +278,7 @@ class WP_Members_Shortcodes {
|
|
278 |
|
279 |
// If there is a meta key attribute.
|
280 |
if ( isset( $atts['meta_key'] ) ) {
|
281 |
-
$
|
282 |
$value = ( isset( $atts['meta_value'] ) ) ? $atts['meta_value'] : false;
|
283 |
if ( ! isset( $atts['compare'] ) || "=" == $atts['compare'] ) {
|
284 |
if ( wpmem_user_has_meta( $atts['meta_key'], $value ) ) {
|
@@ -290,7 +290,6 @@ class WP_Members_Shortcodes {
|
|
290 |
$do_return = true;
|
291 |
}
|
292 |
}
|
293 |
-
$do_return = false;
|
294 |
}
|
295 |
|
296 |
// If there is a product attribute.
|
278 |
|
279 |
// If there is a meta key attribute.
|
280 |
if ( isset( $atts['meta_key'] ) ) {
|
281 |
+
$do_return = false;
|
282 |
$value = ( isset( $atts['meta_value'] ) ) ? $atts['meta_value'] : false;
|
283 |
if ( ! isset( $atts['compare'] ) || "=" == $atts['compare'] ) {
|
284 |
if ( wpmem_user_has_meta( $atts['meta_key'], $value ) ) {
|
290 |
$do_return = true;
|
291 |
}
|
292 |
}
|
|
|
293 |
}
|
294 |
|
295 |
// If there is a product attribute.
|
@@ -63,6 +63,7 @@ class WP_Members_User_Profile {
|
|
63 |
}
|
64 |
// This is the dashboard profile, and user has current field value.
|
65 |
if ( 'user' == $display
|
|
|
66 |
&& ( get_user_meta( $user_ID, 'tos', true ) == $wpmem_fields['tos']['checked_value'] ) ) {
|
67 |
unset( $wpmem_fields['tos'] );
|
68 |
}
|
@@ -456,12 +457,12 @@ class WP_Members_User_Profile {
|
|
456 |
$user_active_flag = get_user_meta( $user_id, 'active', true );
|
457 |
switch( $user_active_flag ) {
|
458 |
|
459 |
-
case 0:
|
460 |
$label = __( 'Reactivate this user?', 'wp-members' );
|
461 |
$action = 1;
|
462 |
break;
|
463 |
|
464 |
-
case 1:
|
465 |
$label = __( 'Deactivate this user?', 'wp-members' );
|
466 |
$action = 0;
|
467 |
break;
|
@@ -528,40 +529,43 @@ class WP_Members_User_Profile {
|
|
528 |
*
|
529 |
* @param int $user_id
|
530 |
*/
|
531 |
-
static function _profile_tabs( $user_id ) {
|
|
|
|
|
532 |
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
|
|
|
|
562 |
echo '</div>';
|
563 |
}
|
564 |
-
echo '</div>';
|
565 |
}
|
566 |
}
|
567 |
}
|
63 |
}
|
64 |
// This is the dashboard profile, and user has current field value.
|
65 |
if ( 'user' == $display
|
66 |
+
&& isset( $wpmem_fields['tos'] )
|
67 |
&& ( get_user_meta( $user_ID, 'tos', true ) == $wpmem_fields['tos']['checked_value'] ) ) {
|
68 |
unset( $wpmem_fields['tos'] );
|
69 |
}
|
457 |
$user_active_flag = get_user_meta( $user_id, 'active', true );
|
458 |
switch( $user_active_flag ) {
|
459 |
|
460 |
+
case "0":
|
461 |
$label = __( 'Reactivate this user?', 'wp-members' );
|
462 |
$action = 1;
|
463 |
break;
|
464 |
|
465 |
+
case "1":
|
466 |
$label = __( 'Deactivate this user?', 'wp-members' );
|
467 |
$action = 0;
|
468 |
break;
|
529 |
*
|
530 |
* @param int $user_id
|
531 |
*/
|
532 |
+
static function _profile_tabs( $user_id ) {
|
533 |
+
|
534 |
+
if ( current_user_can( 'edit_users' ) ) {
|
535 |
|
536 |
+
/**
|
537 |
+
* Add tabs to user profile tabs.
|
538 |
+
*
|
539 |
+
* @since 3.2.5
|
540 |
+
*
|
541 |
+
* @param array {
|
542 |
+
* @type string $tab (required)
|
543 |
+
* @type string $content (optional)
|
544 |
+
* }
|
545 |
+
*/
|
546 |
+
$tabs = apply_filters( 'wpmem_user_profile_tabs', array() );
|
547 |
+
|
548 |
+
if ( ! empty( $tabs ) ) { ?>
|
549 |
+
<script>
|
550 |
+
jQuery(document).ready(function($){
|
551 |
+
$("#wpmem_user_profile_tabs").tabs();
|
552 |
+
});
|
553 |
+
</script>
|
554 |
+
<?php
|
555 |
+
echo '<div id="wpmem_user_profile_tabs">';
|
556 |
+
echo '<ul>';
|
557 |
+
foreach ( $tabs as $key => $value ) {
|
558 |
+
echo '<li><a href="#wpmem_user_profile_tabs-' . ( $key ) . '">' . $value['tab'] . '</a></li>';
|
559 |
+
}
|
560 |
+
echo '</ul>';
|
561 |
+
foreach ( $tabs as $key => $value ) {
|
562 |
+
echo '<div id="wpmem_user_profile_tabs-' . ( $key ) . '">';
|
563 |
+
echo ( isset( $value['content'] ) ) ? $value['content'] : '';
|
564 |
+
do_action( 'wpmem_user_profile_tabs_content', $key );
|
565 |
+
echo '</div>';
|
566 |
+
}
|
567 |
echo '</div>';
|
568 |
}
|
|
|
569 |
}
|
570 |
}
|
571 |
}
|
@@ -341,7 +341,7 @@ class WP_Members_User {
|
|
341 |
|
342 |
// Process CAPTCHA.
|
343 |
if ( 0 != $wpmem->captcha ) {
|
344 |
-
$check_captcha =
|
345 |
if ( 'passed_captcha' != $check_captcha ) {
|
346 |
return $check_captcha;
|
347 |
}
|
@@ -928,6 +928,7 @@ class WP_Members_User {
|
|
928 |
* @since 3.2.0
|
929 |
* @since 3.2.6 Added $date to set a specific expiration date.
|
930 |
* @since 3.3.0 Updated to new single meta, keeps legacy array for rollback.
|
|
|
931 |
*
|
932 |
* @param string $product
|
933 |
* @param int $user_id
|
@@ -948,35 +949,76 @@ class WP_Members_User {
|
|
948 |
|
949 |
// Convert date to add.
|
950 |
$expires = ( isset( $wpmem->membership->products[ $product ]['expires'] ) ) ? $wpmem->membership->products[ $product ]['expires'] : false;
|
951 |
-
|
952 |
// If membership is an expiration product.
|
953 |
if ( is_array( $expires ) ) {
|
954 |
-
|
955 |
-
$add = ( 1 < $add_date[0] ) ? $add_date[0] . " " . $add_date[1] . "s" : $add_date[0] . " " . $add_date[1];
|
956 |
if ( $set_date ) {
|
957 |
// @todo Legacy verion
|
958 |
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $set_date ) );
|
959 |
// @todo New version
|
960 |
$user_product = strtotime( $set_date );
|
961 |
} else {
|
962 |
-
//
|
963 |
-
$
|
964 |
-
|
965 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
966 |
}
|
967 |
} else {
|
968 |
// @todo Legacy verion
|
969 |
$user_products[ $product ] = true;
|
970 |
// @todo New version
|
971 |
$user_product = true;
|
972 |
-
}
|
973 |
|
974 |
// Update product setting.
|
975 |
// @todo Legacy version
|
976 |
update_user_meta( $user_id, '_wpmem_products', $user_products );
|
977 |
// New, individual version.
|
978 |
update_user_meta( $user_id, '_wpmem_products_' . $product, $user_product );
|
979 |
-
|
980 |
/**
|
981 |
* Fires when a user product has been set.
|
982 |
*
|
@@ -1018,6 +1060,7 @@ class WP_Members_User {
|
|
1018 |
* Utility for expiration validation.
|
1019 |
*
|
1020 |
* @since 3.2.0
|
|
|
1021 |
*
|
1022 |
* @param date $date
|
1023 |
*/
|
341 |
|
342 |
// Process CAPTCHA.
|
343 |
if ( 0 != $wpmem->captcha ) {
|
344 |
+
$check_captcha = WP_Members_Captcha::validate();
|
345 |
if ( 'passed_captcha' != $check_captcha ) {
|
346 |
return $check_captcha;
|
347 |
}
|
928 |
* @since 3.2.0
|
929 |
* @since 3.2.6 Added $date to set a specific expiration date.
|
930 |
* @since 3.3.0 Updated to new single meta, keeps legacy array for rollback.
|
931 |
+
* @since 3.3.1 Added no gap renewal option, @todo Needs some possible condensing.
|
932 |
*
|
933 |
* @param string $product
|
934 |
* @param int $user_id
|
949 |
|
950 |
// Convert date to add.
|
951 |
$expires = ( isset( $wpmem->membership->products[ $product ]['expires'] ) ) ? $wpmem->membership->products[ $product ]['expires'] : false;
|
952 |
+
|
953 |
// If membership is an expiration product.
|
954 |
if ( is_array( $expires ) ) {
|
955 |
+
// If this is setting a specific date.
|
|
|
956 |
if ( $set_date ) {
|
957 |
// @todo Legacy verion
|
958 |
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $set_date ) );
|
959 |
// @todo New version
|
960 |
$user_product = strtotime( $set_date );
|
961 |
} else {
|
962 |
+
// Either setting initial expiration based on set time period, or adding to the existing date (renewal/extending).
|
963 |
+
$raw_add = explode( "|", $wpmem->membership->products[ $product ]['expires'][0] );
|
964 |
+
$add_period = ( 1 < $raw_add[0] ) ? $raw_add[0] . " " . $raw_add[1] . "s" : $raw_add[0] . " " . $raw_add[1];
|
965 |
+
|
966 |
+
// Legacy first.
|
967 |
+
if ( isset( $user_products[ $product ] ) ) {
|
968 |
+
if ( isset( $wpmem->membership->products[ $product ]['no_gap'] ) && 1 == $wpmem->membership->products[ $product ]['no_gap'] ) {
|
969 |
+
// Add to the user's existing date (no gap).
|
970 |
+
//$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $add_period ) );
|
971 |
+
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $add_period, strtotime( $user_products[ $product ] ) ) );
|
972 |
+
} else {
|
973 |
+
// Add to the user either from end or now (whichever is later; i.e. allow gaps (default)).
|
974 |
+
if ( $this->has_access( $product, $user_id ) ) {
|
975 |
+
// if not expired, set from when they expire.
|
976 |
+
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $add_period, strtotime( $user_products[ $product ] ) ) );
|
977 |
+
} else {
|
978 |
+
// if expired, set from today.
|
979 |
+
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $add_period ) );
|
980 |
+
}
|
981 |
+
}
|
982 |
+
|
983 |
+
} else {
|
984 |
+
// User doesn't have this membershp. Go ahead and add it.
|
985 |
+
$user_products[ $product ] = date( 'Y-m-d H:i:s', strtotime( $add_period ) );
|
986 |
+
}
|
987 |
+
|
988 |
+
// New single meta version.
|
989 |
+
if ( $user_product ) {
|
990 |
+
if ( isset( $wpmem->membership->products[ $product ]['no_gap'] ) && 1 == $wpmem->membership->products[ $product ]['no_gap'] ) {
|
991 |
+
// Add to the user's existing date (no gap).
|
992 |
+
$user_product = strtotime( $add_period, $user_product );
|
993 |
+
} else {
|
994 |
+
// Add to the user either from end or now (whichever is later; i.e. allow gaps (default)).
|
995 |
+
if ( $this->has_access( $product, $user_id ) ) {
|
996 |
+
// if not expired, set from when they expire.
|
997 |
+
$user_product = strtotime( $add_period, $user_product );
|
998 |
+
} else {
|
999 |
+
// if expired, set from today.
|
1000 |
+
$user_product = strtotime( $add_period );
|
1001 |
+
}
|
1002 |
+
}
|
1003 |
+
} else {
|
1004 |
+
// User doesn't have this membershp. Go ahead and add it.
|
1005 |
+
$user_product = strtotime( $add_period );
|
1006 |
+
}
|
1007 |
+
|
1008 |
}
|
1009 |
} else {
|
1010 |
// @todo Legacy verion
|
1011 |
$user_products[ $product ] = true;
|
1012 |
// @todo New version
|
1013 |
$user_product = true;
|
1014 |
+
}
|
1015 |
|
1016 |
// Update product setting.
|
1017 |
// @todo Legacy version
|
1018 |
update_user_meta( $user_id, '_wpmem_products', $user_products );
|
1019 |
// New, individual version.
|
1020 |
update_user_meta( $user_id, '_wpmem_products_' . $product, $user_product );
|
1021 |
+
|
1022 |
/**
|
1023 |
* Fires when a user product has been set.
|
1024 |
*
|
1060 |
* Utility for expiration validation.
|
1061 |
*
|
1062 |
* @since 3.2.0
|
1063 |
+
* @since 3.3.0 Validates date or epoch time.
|
1064 |
*
|
1065 |
* @param date $date
|
1066 |
*/
|
@@ -526,6 +526,7 @@ class WP_Members {
|
|
526 |
|
527 |
require_once( $this->path . 'includes/class-wp-members-api.php' );
|
528 |
require_once( $this->path . 'includes/class-wp-members-clone-menus.php' );
|
|
|
529 |
require_once( $this->path . 'includes/class-wp-members-email.php' );
|
530 |
require_once( $this->path . 'includes/class-wp-members-forms.php' );
|
531 |
require_once( $this->path . 'includes/class-wp-members-menus.php' );
|
@@ -1017,13 +1018,13 @@ class WP_Members {
|
|
1017 |
$hidden = $this->hidden_posts();
|
1018 |
}
|
1019 |
// @todo Possibly separate query here to check. If the user IS logged in, check what posts they DON'T have access to.
|
1020 |
-
if ( ! is_admin() && is_user_logged_in() && 1 == $this->enable_products ) {
|
1021 |
// Get user product access.
|
1022 |
// @todo This maybe should be a transient stored in the user object.
|
1023 |
$hidden = $this->hidden_posts();
|
1024 |
$hidden = ( is_array( $hidden ) ) ? $hidden : array();
|
1025 |
foreach ( $this->membership->products as $key => $value ) {
|
1026 |
-
if ( isset( $this->user->access[ $key ] ) && ( true
|
1027 |
foreach ( $hidden as $post_id ) {
|
1028 |
if ( 1 == get_post_meta( $post_id, $this->membership->post_stem . $key, true ) ) {
|
1029 |
$hidden_key = array_search( $post_id, $hidden );
|
@@ -1152,7 +1153,7 @@ class WP_Members {
|
|
1152 |
$this->fields[ $meta_key ]['type'] = $val[3];
|
1153 |
$this->fields[ $meta_key ]['register'] = ( 'y' == $val[4] ) ? true : false;
|
1154 |
$this->fields[ $meta_key ]['required'] = ( 'y' == $val[5] ) ? true : false;
|
1155 |
-
$this->fields[ $meta_key ]['profile'] = ( isset( $val['profile'] ) ) ? $val['profile'] : true ;
|
1156 |
$this->fields[ $meta_key ]['native'] = ( 'y' == $val[6] ) ? true : false;
|
1157 |
|
1158 |
// Certain field types have additional properties.
|
526 |
|
527 |
require_once( $this->path . 'includes/class-wp-members-api.php' );
|
528 |
require_once( $this->path . 'includes/class-wp-members-clone-menus.php' );
|
529 |
+
require_once( $this->path . 'includes/class-wp-members-captcha.php' );
|
530 |
require_once( $this->path . 'includes/class-wp-members-email.php' );
|
531 |
require_once( $this->path . 'includes/class-wp-members-forms.php' );
|
532 |
require_once( $this->path . 'includes/class-wp-members-menus.php' );
|
1018 |
$hidden = $this->hidden_posts();
|
1019 |
}
|
1020 |
// @todo Possibly separate query here to check. If the user IS logged in, check what posts they DON'T have access to.
|
1021 |
+
if ( ! is_admin() && is_user_logged_in() && 1 == $this->enable_products ) {
|
1022 |
// Get user product access.
|
1023 |
// @todo This maybe should be a transient stored in the user object.
|
1024 |
$hidden = $this->hidden_posts();
|
1025 |
$hidden = ( is_array( $hidden ) ) ? $hidden : array();
|
1026 |
foreach ( $this->membership->products as $key => $value ) {
|
1027 |
+
if ( isset( $this->user->access[ $key ] ) && ( true == $this->user->access[ $key ] || $this->user->is_current( $this->user->access[ $key ] ) ) ) {
|
1028 |
foreach ( $hidden as $post_id ) {
|
1029 |
if ( 1 == get_post_meta( $post_id, $this->membership->post_stem . $key, true ) ) {
|
1030 |
$hidden_key = array_search( $post_id, $hidden );
|
1153 |
$this->fields[ $meta_key ]['type'] = $val[3];
|
1154 |
$this->fields[ $meta_key ]['register'] = ( 'y' == $val[4] ) ? true : false;
|
1155 |
$this->fields[ $meta_key ]['required'] = ( 'y' == $val[5] ) ? true : false;
|
1156 |
+
$this->fields[ $meta_key ]['profile'] = ( 'y' == $val[4] ) ? true : false;// ( isset( $val['profile'] ) ) ? $val['profile'] : true ; // // @todo Wait for profile fix
|
1157 |
$this->fields[ $meta_key ]['native'] = ( 'y' == $val[6] ) ? true : false;
|
1158 |
|
1159 |
// Certain field types have additional properties.
|
@@ -634,6 +634,16 @@ function wpmem_upgrade_style_setting( $settings ) {
|
|
634 |
|
635 |
if ( isset( $settings['style'] ) ) {
|
636 |
if ( 'use_custom' == $settings['style'] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
return $settings['style'];
|
638 |
} else {
|
639 |
|
634 |
|
635 |
if ( isset( $settings['style'] ) ) {
|
636 |
if ( 'use_custom' == $settings['style'] ) {
|
637 |
+
|
638 |
+
// Check to see if the custom value is a default stylesheet.
|
639 |
+
$chk_path_for = '/wp-content/plugins/wp-members/css/';
|
640 |
+
if ( strpos( $settings['cssurl'], $chk_path_for ) ) {
|
641 |
+
$strpos = strpos( $settings['cssurl'], $chk_path_for );
|
642 |
+
$substr = substr( $settings['cssurl'], $strpos );
|
643 |
+
$style = str_replace( array( $chk_path_for, '.css' ), array( '','' ), $substr );
|
644 |
+
return $style;
|
645 |
+
}
|
646 |
+
|
647 |
return $settings['style'];
|
648 |
} else {
|
649 |
|
@@ -134,14 +134,17 @@ function wpmem_inc_regmessage( $tag, $msg = '' ) {
|
|
134 |
*/
|
135 |
$args = apply_filters( 'wpmem_msg_args', '' );
|
136 |
|
137 |
-
// Get dialogs set in the db.
|
138 |
-
$dialogs = get_option( 'wpmembers_dialogs' );
|
139 |
/** This filter is documented in /includes/class-wp-members-admin-api.php */
|
140 |
$dialogs = apply_filters( 'wpmem_dialogs', get_option( 'wpmembers_dialogs' ) );
|
141 |
|
|
|
142 |
if ( array_key_exists( $tag, $dialogs ) ) {
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
$defaults['msg'] = $msg;
|
147 |
|
@@ -177,7 +180,10 @@ function wpmem_inc_regmessage( $tag, $msg = '' ) {
|
|
177 |
*/
|
178 |
$args = apply_filters( 'wpmem_msg_defaults', $defaults, $tag, $dialogs );
|
179 |
|
180 |
-
|
|
|
|
|
|
|
181 |
|
182 |
/**
|
183 |
* Filter the message.
|
134 |
*/
|
135 |
$args = apply_filters( 'wpmem_msg_args', '' );
|
136 |
|
|
|
|
|
137 |
/** This filter is documented in /includes/class-wp-members-admin-api.php */
|
138 |
$dialogs = apply_filters( 'wpmem_dialogs', get_option( 'wpmembers_dialogs' ) );
|
139 |
|
140 |
+
// @todo Temporary(?) workaround for custom dialogs as an array (WP-Members Security).
|
141 |
if ( array_key_exists( $tag, $dialogs ) ) {
|
142 |
+
if ( is_array( $dialogs[ $tag ] ) ) {
|
143 |
+
$msg = stripslashes( $dialogs[ $tag ]['value'] );
|
144 |
+
} else {
|
145 |
+
$msg = $wpmem->get_text( $tag );
|
146 |
+
$msg = ( $dialogs[ $tag ] == $msg ) ? $msg : __( stripslashes( $dialogs[ $tag ] ), 'wp-members' );
|
147 |
+
}
|
148 |
}
|
149 |
$defaults['msg'] = $msg;
|
150 |
|
180 |
*/
|
181 |
$args = apply_filters( 'wpmem_msg_defaults', $defaults, $tag, $dialogs );
|
182 |
|
183 |
+
// @todo Temporary(?) workaround for custom dialogs as an array (WP-Members Security).
|
184 |
+
$display_msg = ( is_array( $args['msg'] ) ) ? $args['msg']['value'] : $args['msg'];
|
185 |
+
|
186 |
+
$str = $args['div_before'] . $args['p_before'] . stripslashes( $display_msg ) . $args['p_after'] . $args['div_after'];
|
187 |
|
188 |
/**
|
189 |
* Filter the message.
|
@@ -89,11 +89,11 @@ class WP_Members_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
89 |
if ( ! empty( $item->_invalid ) ) {
|
90 |
$classes[] = 'menu-item-invalid';
|
91 |
/* translators: %s: title of menu item which is invalid */
|
92 |
-
$title = sprintf(
|
93 |
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
|
94 |
$classes[] = 'pending';
|
95 |
/* translators: %s: title of menu item in draft status */
|
96 |
-
$title = sprintf(
|
97 |
}
|
98 |
|
99 |
$title = empty( $item->label ) ? $title : $item->label;
|
@@ -120,7 +120,7 @@ class WP_Members_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
120 |
),
|
121 |
'move-menu_item'
|
122 |
);
|
123 |
-
?>" class="item-move-up" aria-label="<?php esc_attr_e('Move up'); ?>">↑</a>
|
124 |
|
|
125 |
<a href="<?php
|
126 |
echo wp_nonce_url(
|
@@ -133,11 +133,11 @@ class WP_Members_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
133 |
),
|
134 |
'move-menu_item'
|
135 |
);
|
136 |
-
?>" class="item-move-down" aria-label="<?php esc_attr_e('Move down'); ?>">↓</a>
|
137 |
</span>
|
138 |
-
<a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php esc_attr_e('Edit Menu Item'); ?>" href="<?php
|
139 |
echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
|
140 |
-
?>"><span class="screen-reader-text"><?php
|
141 |
</span>
|
142 |
</div>
|
143 |
</div>
|
@@ -190,35 +190,36 @@ class WP_Members_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
190 |
</p>
|
191 |
<?php
|
192 |
// This is the added section
|
193 |
-
|
|
|
194 |
// end added section
|
195 |
?>
|
196 |
<div class="menu-item-actions description-wide submitbox">
|
197 |
<?php if( 'custom' != $item->type && $original_title !== false ) : ?>
|
198 |
<p class="link-to-original">
|
199 |
-
<?php printf(
|
200 |
</p>
|
201 |
<?php endif; ?>
|
202 |
-
<a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php
|
203 |
echo wp_nonce_url(
|
204 |
add_query_arg(
|
205 |
array(
|
206 |
'action' => 'delete-menu-item',
|
207 |
'menu-item' => $item_id,
|
208 |
),
|
209 |
-
remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
|
210 |
),
|
211 |
-
'delete-menu_item_' . $item_id
|
212 |
); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ) );
|
213 |
?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>
|
214 |
</div>
|
215 |
|
216 |
-
<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />
|
217 |
-
<input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />
|
218 |
-
<input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" />
|
219 |
-
<input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />
|
220 |
-
<input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
|
221 |
-
<input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />
|
222 |
</div><!-- .menu-item-settings-->
|
223 |
<ul class="menu-item-transport"></ul>
|
224 |
<?php
|
89 |
if ( ! empty( $item->_invalid ) ) {
|
90 |
$classes[] = 'menu-item-invalid';
|
91 |
/* translators: %s: title of menu item which is invalid */
|
92 |
+
$title = sprintf( esc_html__( '%s (Invalid)', 'wp-members' ), $item->title );
|
93 |
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
|
94 |
$classes[] = 'pending';
|
95 |
/* translators: %s: title of menu item in draft status */
|
96 |
+
$title = sprintf( esc_html__( '%s (Pending)', 'wp-members'), $item->title );
|
97 |
}
|
98 |
|
99 |
$title = empty( $item->label ) ? $title : $item->label;
|
120 |
),
|
121 |
'move-menu_item'
|
122 |
);
|
123 |
+
?>" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up', 'wp-members' ); ?>">↑</a>
|
124 |
|
|
125 |
<a href="<?php
|
126 |
echo wp_nonce_url(
|
133 |
),
|
134 |
'move-menu_item'
|
135 |
);
|
136 |
+
?>" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down', 'wp-members' ); ?>">↓</a>
|
137 |
</span>
|
138 |
+
<a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php esc_attr_e( 'Edit Menu Item', 'wp-members' ); ?>" href="<?php
|
139 |
echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
|
140 |
+
?>"><span class="screen-reader-text"><?php esc_html_e( 'Edit', 'wp-members' ); ?></span></a>
|
141 |
</span>
|
142 |
</div>
|
143 |
</div>
|
190 |
</p>
|
191 |
<?php
|
192 |
// This is the added section
|
193 |
+
// do_action( 'wpmem_nav_menu_item_options', $item_id, $item, $depth, $args );
|
194 |
+
do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );
|
195 |
// end added section
|
196 |
?>
|
197 |
<div class="menu-item-actions description-wide submitbox">
|
198 |
<?php if( 'custom' != $item->type && $original_title !== false ) : ?>
|
199 |
<p class="link-to-original">
|
200 |
+
<?php printf( esc_html__( 'Original: %s' ), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
|
201 |
</p>
|
202 |
<?php endif; ?>
|
203 |
+
<a class="item-delete submitdelete deletion" id="delete-<?php echo esc_attr( $item_id ); ?>" href="<?php
|
204 |
echo wp_nonce_url(
|
205 |
add_query_arg(
|
206 |
array(
|
207 |
'action' => 'delete-menu-item',
|
208 |
'menu-item' => $item_id,
|
209 |
),
|
210 |
+
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
211 |
),
|
212 |
+
'delete-menu_item_' . esc_attr( $item_id )
|
213 |
); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ) );
|
214 |
?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>
|
215 |
</div>
|
216 |
|
217 |
+
<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo $item_id; ?>" />
|
218 |
+
<input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />
|
219 |
+
<input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->object ); ?>" />
|
220 |
+
<input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />
|
221 |
+
<input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
|
222 |
+
<input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->type ); ?>" />
|
223 |
</div><!-- .menu-item-settings-->
|
224 |
<ul class="menu-item-transport"></ul>
|
225 |
<?php
|
@@ -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: 5.3
|
6 |
-
Stable tag: 3.3.
|
7 |
License: GPLv2
|
8 |
|
9 |
== Description ==
|
@@ -100,7 +100,8 @@ The FAQs are maintained at https://rocketgeek.com/plugins/wp-members/docs/faqs/
|
|
100 |
|
101 |
== Upgrade Notice ==
|
102 |
|
103 |
-
WP-Members 3.3.0 is a major update. See changelog for important details. Minimum WP version is 4.0.
|
|
|
104 |
|
105 |
== Screenshots ==
|
106 |
|
@@ -123,6 +124,30 @@ WP-Members 3.3.0 is a major update. See changelog for important details. Minimum
|
|
123 |
|
124 |
== Changelog ==
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
= 3.3.0 =
|
127 |
|
128 |
* @todo Need to resolve duplicate wpmem_login_form_defaults. (maybe took care of itself with backing out of _args deprecation)
|
3 |
Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 3.3.1
|
7 |
License: GPLv2
|
8 |
|
9 |
== Description ==
|
100 |
|
101 |
== Upgrade Notice ==
|
102 |
|
103 |
+
WP-Members 3.3.0 is a major update. WP-Members 3.3.1 is a bug fix release. See changelog for important details. Minimum WP version is 4.0.
|
104 |
+
|
105 |
|
106 |
== Screenshots ==
|
107 |
|
124 |
|
125 |
== Changelog ==
|
126 |
|
127 |
+
= 3.3.1 =
|
128 |
+
|
129 |
+
* Update membership product expiration to allow for a "no gap" expiration (i.e. renewal begins from expiration date, optional) or default (renewal begins from today or expiration date, whichever is later).
|
130 |
+
* Update user activation to use wp_set_password().
|
131 |
+
* Update display of membership product slugs to text (instead of a form input). They can't be edited.
|
132 |
+
* Added empty /inc/dialogs.php for customizations and plugins that try to include the legacy dialogs file.
|
133 |
+
* Updates to user profile screen which allows users with 'edit_users' capability (admins) to edit their own profile.
|
134 |
+
* Fixes a bug that caused the user profile display for a new user to say "reactivate" instead of "activate".
|
135 |
+
* Fixes a bug in the membership renewal that sets the individual date meta forward two periods instead of one.
|
136 |
+
* Fixes a bug in the hidden fields lookup that caused hidden posts with a membership limitation to not display to users who had a matching membership.
|
137 |
+
* Changed custom menu options to use wp_nav_menu_item_custom_fields action hook. This is a "made up" hook that is not actually part of WP. But somewhere along the line, some menu-focused plugins began using it in their custom walkers. By not using it in WP-Members, that caused some problems for users who also used one of those other plugins or themes. This updates shifts to use this "non-standard" action hook these other themes and plugins are using in order to apply some level of compatibility.
|
138 |
+
|
139 |
+
Including all 3.3.0.x patches:
|
140 |
+
* Provides a workaround for a bug in the dialogs setting when custom dialogs are applied. This targets an issue specifically affecting users with the WP-Members Security extension installed. (3.3.0.4)
|
141 |
+
* Fixes a bug when products are enabled but no default is set. Allows for no default membership assigned at registration. (3.3.0.4)
|
142 |
+
* Fixes a bug that caused the post restricted message to display on the short form when it was in password reset and forgot username state. (3.3.0.4)
|
143 |
+
* Added wpmem_get_hidden_posts() API function to return an array of post IDs marked as hidden. (3.3.0.4)
|
144 |
+
* Fixes a shortcode issue for the [wpmem_logged_in] shortcode when using the meta_key attribute. 3.3.0 added a "compare" attribute, and with this addition, it broke the original default use of the shortcode. (3.3.0.3)
|
145 |
+
* Fixes an issue with registration/profile form fields when used in the profile. It was intended to introduce separate selection of fields for registration and profile update in 3.3.0. However, there is an issue that causes profile fields to both (1) not correctly display and (2) if they do, they do not update correctly. (3.3.0.2)
|
146 |
+
* Fixes issue when updating where the stylesheet selector indicates "use_custom" but the actual URL is to a default stylesheet. The problem can be corrected manually, but this fix applies the custom URL to the new standard setting for the defaults. (3.3.0.1)
|
147 |
+
* Fixes bug where any stylesheet other than the default reverts to the default ("no float"). This was due to the database version being wiped when settings were updated. This fix correctly applies the database version when updating settings. (3.3.0.1)
|
148 |
+
* Fixes bug when captcha is used (unknown validate() function). The validate() function should have been declared and used as a static method. This fix declares validate() as static and then uses it as such. (3.3.0.1)
|
149 |
+
* Fixes undefined string variable when successful registration is executed. (3.3.0.1)
|
150 |
+
|
151 |
= 3.3.0 =
|
152 |
|
153 |
* @todo Need to resolve duplicate wpmem_login_form_defaults. (maybe took care of itself with backing out of _args deprecation)
|
@@ -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.3.
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
Text Domain: wp-members
|
@@ -64,7 +64,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
64 |
}
|
65 |
|
66 |
// Initialize constants.
|
67 |
-
define( 'WPMEM_VERSION', '3.3.
|
68 |
define( 'WPMEM_DB_VERSION', '2.2.0' );
|
69 |
define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
|
70 |
|
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.3.1
|
7 |
Author: Chad Butler
|
8 |
Author URI: http://butlerblog.com/
|
9 |
Text Domain: wp-members
|
64 |
}
|
65 |
|
66 |
// Initialize constants.
|
67 |
+
define( 'WPMEM_VERSION', '3.3.1' );
|
68 |
define( 'WPMEM_DB_VERSION', '2.2.0' );
|
69 |
define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
|
70 |
|