- code review;

This commit is contained in:
Nikita Sinelnikov
2022-02-07 12:20:24 +02:00
parent 566634ffeb
commit cfd8365afd
4 changed files with 26 additions and 18 deletions
+1 -1
View File
@@ -2364,7 +2364,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<div class="um-admin-tri">
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field. The site admin can edit this field.', 'ultimate-member' ) ); ?></label>
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field. The site admin can edit all fields regardless of the option set here.', 'ultimate-member' ) ); ?></label>
<input type="hidden" name="_editable" id="_editable_hidden" value="0" />
<input type="checkbox" name="_editable" id="_editable" value="1" <?php checked( null === $this->edit_mode_value || $this->edit_mode_value ) ?> />
</p>
+2 -2
View File
@@ -1280,13 +1280,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
array(
'id' => 'blocked_emails',
'type' => 'textarea',
'label' => __( 'Blocked Email Addresses', 'ultimate-member' ),
'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ),
'tooltip' => __( 'This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimate-member' ),
),
array(
'id' => 'blocked_words',
'type' => 'textarea',
'label' => __( 'Blacklist Words', 'ultimate-member' ),
'label' => __( 'Blacklist Words (Enter one word per line)', 'ultimate-member' ),
'tooltip' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ),
),
),
+10 -13
View File
@@ -11,37 +11,34 @@ function um_submit_form_errors_hook__blockedemails( $args ) {
if ( ! $emails ) {
return;
}
$emails = strtolower( $emails );
$emails = array_map( 'rtrim', explode( "\n", $emails ) );
if ( isset( $args['user_email'] ) && is_email( $args['user_email'] ) ) {
$domain = explode( '@', $args['user_email'] );
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
if ( in_array( strtolower( $args['user_email'] ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
}
if ( in_array( $check_domain, $emails ) ) {
$domain = explode( '@', $args['user_email'] );
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
if ( in_array( strtolower( $check_domain ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
}
}
if ( isset( $args['username'] ) && is_email( $args['username'] ) ) {
$domain = explode( '@', $args['username'] );
$check_domain = str_replace( $domain[0], '*', $args['username'] );
if ( in_array( $args['username'], $emails ) ) {
if ( in_array( strtolower( $args['username'] ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
}
if ( in_array( $check_domain, $emails ) ) {
$domain = explode( '@', $args['username'] );
$check_domain = str_replace( $domain[0], '*', $args['username'] );
if ( in_array( strtolower( $check_domain ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
}
}
}
add_action( 'um_submit_form_errors_hook__blockedemails', 'um_submit_form_errors_hook__blockedemails', 10 );
+13 -2
View File
@@ -6,7 +6,7 @@ Donate link:
Tags: community, member, membership, user-profile, user-registration
Requires PHP: 5.6
Requires at least: 5.0
Tested up to: 5.8
Tested up to: 5.9
Stable tag: 2.3.0
License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -155,7 +155,18 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
* To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0)
* UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin
= 2.3.1: January xx, 2022 =
= 2.3.1: February 9, 2022 =
* Enhancements:
- Added: wp-admin notice on the Settings page when settings have been changed (#963)
- Added: WP Blocks restriction settings for the blocks (templates/nav-menu) on the FSE pages
* Bugfixes:
- Fixed: "Can user edit this field?" fields' option for the file/image upload field-types (#958)
- Fixed: Using uppercase symbols in the "Blocked Email Addresses" and "Blacklist Words" blacklists settings (#962)
- Fixed: Some typos in the labels (#975)
= 2.3.0: December 20, 2021 =