From 0bdec01e0066eb0f86c8f8b2faffd75e80e56b16 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Fri, 17 Dec 2021 13:39:41 +0200 Subject: [PATCH 01/15] - updated version; --- readme.txt | 2 ++ ultimate-member.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 94c1cff4..bba501ca 100644 --- a/readme.txt +++ b/readme.txt @@ -155,6 +155,8 @@ 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.0: December 20, 2021 = * Enhancements: diff --git a/ultimate-member.php b/ultimate-member.php index de72c967..2325ac0c 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.3.0 +Version: 2.3.1-alpha1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From 96b7837d16062f95df11c646bdc10f98abaa5112 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Tue, 21 Dec 2021 18:16:52 +0200 Subject: [PATCH 02/15] - fixed PHP warning related for the custom fields without type; --- includes/core/class-uploader.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index ee8ffad2..8bd609df 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -1352,8 +1352,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $_array = $new_files; if ( ! empty( UM()->builtin()->custom_fields ) ) { foreach ( UM()->builtin()->custom_fields as $_field ) { - if ( in_array( $_field['type'], array( 'file', 'image' ) ) && isset( $user_meta_keys[$_field['metakey']] ) && empty( $_array[$_field['metakey']] ) ) { - $_array[$_field['metakey']] = $user_meta_keys[$_field['metakey']]; + if ( ! array_key_exists( 'type', $_field ) ) { + continue; + } + if ( in_array( $_field['type'], array( 'file', 'image' ), true ) && isset( $user_meta_keys[ $_field['metakey'] ] ) && empty( $_array[ $_field['metakey'] ] ) ) { + $_array[ $_field['metakey'] ] = $user_meta_keys[ $_field['metakey'] ]; } } } From e90efd0983eca0ba42fee838fa226b8ada563404 Mon Sep 17 00:00:00 2001 From: ashubawork <43743394+ashubawork@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:44:27 +0200 Subject: [PATCH 03/15] - fixed editing upload fields (issue #958) --- includes/admin/core/class-admin-metabox.php | 2 +- includes/core/class-fields.php | 113 ++++++++++++-------- 2 files changed, 69 insertions(+), 46 deletions(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 19c8b181..e6ee0d17 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -2364,7 +2364,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
-

+

edit_mode_value || $this->edit_mode_value ) ?> />

diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 0e6343b1..57e528af 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2730,39 +2730,54 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } else { $img = ''; } - $output .= '
- ' . $img . ' -
' . __( 'Change photo', 'ultimate-member' ) . ''; + $output .= '
'; + if ( empty( $disabled ) ) { + $output .= ''; + } + $output .= $img; + $output .= '
'; + if ( empty( $disabled ) ) { + $output .= '' . __( 'Change photo', 'ultimate-member' ) . ''; + } + + } else { - $output .= '
- - -
' . $button_text . ''; + $output .= '
'; + if ( empty( $disabled ) ) { + $output .= ''; + } + $output .= '
'; + if ( empty( $disabled ) ) { + $output .= '' . $button_text . ''; + } + } $output .= '
'; /* modal hidden */ - $output .= '
'; - $output .= '
' . $modal_label . '
'; - $output .= '
'; - if (isset( $this->set_id )) { - $set_id = $this->set_id; - $set_mode = $this->set_mode; - } else { - $set_id = 0; - $set_mode = ''; - } - $nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp ); - $output .= '
'; - $output .= '
' . $button_text . '
'; - $output .= ''; + $output .= '
'; + } /* end */ if ( $this->is_error( $key ) ) { $output .= $this->field_error( $this->show_error( $key ) ); @@ -2813,9 +2828,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } if ( file_exists( $file_dir ) ) { - $output .= "
- -
+ $output .= "
"; + if ( empty( $disabled ) ) { + $output .= ""; + } + $output .= "'; /* modal hidden */ - $output .= '
'; - $output .= '
' . $modal_label . '
'; - $output .= '
'; - if ( isset( $this->set_id ) ) { - $set_id = $this->set_id; - $set_mode = $this->set_mode; - } else { - $set_id = 0; - $set_mode = ''; - } - $output .= '
+ if ( empty( $disabled ) ) { + $output .= '
'; + $output .= '
' . $modal_label . '
'; + $output .= '
'; + if ( isset( $this->set_id ) ) { + $set_id = $this->set_id; + $set_mode = $this->set_mode; + } else { + $set_id = 0; + $set_mode = ''; + } + $output .= ''; - $nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp ); - $output .= '
' . $button_text . '
'; - $output .= ''; - $output .= '
'; + $output .= '
'; + $output .= '
'; + } /* end */ if ( $this->is_error( $key ) ) { $output .= $this->field_error( $this->show_error( $key ) ); From 7e635967f68a4ba82bb3a7b6a390ab677f5d7ada Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 3 Jan 2022 13:25:43 +0200 Subject: [PATCH 04/15] - changed WP Cron scheduled events; --- includes/class-init.php | 12 ++++++++++++ includes/core/class-cron.php | 9 ++++++++- includes/core/class-plugin-updater.php | 19 ++----------------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/includes/class-init.php b/includes/class-init.php index b46961aa..a75c8c61 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -213,6 +213,8 @@ if ( ! class_exists( 'UM' ) ) { //run activation register_activation_hook( um_plugin, array( &$this, 'activation' ) ); + register_deactivation_hook( um_plugin, array( &$this, 'deactivation' ) ); + if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) { add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) ); } @@ -454,6 +456,16 @@ if ( ! class_exists( 'UM' ) ) { } + /** + * Plugin Deactivation + * + * @since 2.3 + */ + function deactivation() { + $this->cron()->unschedule_events(); + } + + /** * Maybe need multisite activation process * diff --git a/includes/core/class-cron.php b/includes/core/class-cron.php index 610daa2c..93a1083f 100644 --- a/includes/core/class-cron.php +++ b/includes/core/class-cron.php @@ -116,5 +116,12 @@ if ( ! class_exists( 'um\core\Cron' ) ) { } } + + public function unschedule_events() { + wp_clear_scheduled_hook( 'um_weekly_scheduled_events' ); + wp_clear_scheduled_hook( 'um_daily_scheduled_events' ); + wp_clear_scheduled_hook( 'um_twicedaily_scheduled_events' ); + wp_clear_scheduled_hook( 'um_hourly_scheduled_events' ); + } } -} \ No newline at end of file +} diff --git a/includes/core/class-plugin-updater.php b/includes/core/class-plugin-updater.php index 30f0d60c..677f5f8b 100644 --- a/includes/core/class-plugin-updater.php +++ b/includes/core/class-plugin-updater.php @@ -19,15 +19,8 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { * Plugin_Updater constructor. */ function __construct() { - //create cron event - if ( ! wp_next_scheduled( 'um_check_extensions_licenses' ) ) { - wp_schedule_event( time() + ( 24*60*60 ), 'daily', 'um_check_extensions_licenses' ); - } - - register_deactivation_hook( um_plugin, array( &$this, 'um_plugin_updater_deactivation_hook' ) ); - //cron request to UM()->store_url; - add_action( 'um_check_extensions_licenses', array( &$this, 'um_checklicenses' ) ); + add_action( 'um_daily_scheduled_events', array( &$this, 'um_checklicenses' ) ); // clean update plugin cache add_action( 'upgrader_process_complete', array( &$this, 'clean_update_plugins_cache' ), 20, 2 ); @@ -248,14 +241,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { } - /** - * Remove CRON events on deactivation hook - */ - function um_plugin_updater_deactivation_hook() { - wp_clear_scheduled_hook( 'um_check_extensions_licenses' ); - } - - /** * Check license function */ @@ -665,4 +650,4 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { } } -} \ No newline at end of file +} From 83fce0d022f4def563e9cd87d2c547be1d5c7571 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Tue, 4 Jan 2022 16:44:28 +0200 Subject: [PATCH 05/15] - fixed UX issue with wrong text on the admin notice about upgrade; --- includes/admin/core/class-admin-notices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 8f698f02..c1c4c6fc 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -532,7 +532,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {

- +  

From c2666550e10ffa48ca31e808a97019f77cf03f18 Mon Sep 17 00:00:00 2001 From: ashubawork <43743394+ashubawork@users.noreply.github.com> Date: Thu, 13 Jan 2022 14:06:05 +0200 Subject: [PATCH 06/15] - added a notice after saving on the settings pages --- includes/admin/core/class-admin-notices.php | 4 ++++ includes/admin/core/class-admin-settings.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 8f698f02..e8491d42 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -426,6 +426,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' ); break; + case 'settings_updated': + $messages[0]['content'] = __( 'Settings have been saved successfully.', 'ultimate-member' ); + break; + case 'user_updated': $messages[0]['content'] = __( 'User has been updated.', 'ultimate-member' ); break; diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 7413b92e..a60627f3 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2227,7 +2227,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //redirect after save settings $arg = array( - 'page' => 'um_options', + 'page' => 'um_options', + 'update' => 'settings_updated', ); if ( ! empty( $_GET['tab'] ) ) { From c7254b969bdb31282ee3f2f3d185095e4692fbd8 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 17 Jan 2022 15:20:33 +0200 Subject: [PATCH 07/15] - fixed sorting the settings subtabs (Extensions section); --- includes/admin/core/class-admin-settings.php | 45 +++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 7413b92e..79ce3e30 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1810,39 +1810,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { */ public function sorting_licenses_options( $settings ) { //sorting licenses - if ( empty( $settings['licenses']['fields'] ) ) { - return $settings; + if ( ! empty( $settings['licenses']['fields'] ) ) { + $licenses = $settings['licenses']['fields']; + @uasort( $licenses, function( $a, $b ) { + return strnatcasecmp( $a['label'], $b['label'] ); + } ); + $settings['licenses']['fields'] = $licenses; } - $licenses = $settings['licenses']['fields']; - @uasort( $licenses, function( $a, $b ) { - return strnatcasecmp( $a['label'], $b['label'] ); - } ); - $settings['licenses']['fields'] = $licenses; + //sorting extensions by the title + if ( ! empty( $settings['extensions']['sections'] ) ) { + $extensions = $settings['extensions']['sections']; - //sorting extensions - if ( empty( $settings['extensions']['sections'] ) ) { - return $settings; - } - - $extensions = $settings['extensions']['sections']; - @uasort( $extensions, function( $a, $b ) { - return strnatcasecmp( $a['title'], $b['title'] ); - } ); - - $keys = array_keys( $extensions ); - if ( $keys[0] !== '' ) { - $new_key = strtolower( str_replace( ' ', '_', $extensions['']['title'] ) ); - $temp = $extensions['']; - $extensions[ $new_key ] = $temp; - $extensions[''] = $extensions[ $keys[0] ]; - unset( $extensions[ $keys[0] ] ); @uasort( $extensions, function( $a, $b ) { return strnatcasecmp( $a['title'], $b['title'] ); } ); - } - $settings['extensions']['sections'] = $extensions; + $keys = array_keys( $extensions ); + $temp = array( + '' => $extensions[ $keys[0] ], + ); + + unset( $extensions[ $keys[0] ] ); + $extensions = $temp + $extensions; + + $settings['extensions']['sections'] = $extensions; + } return $settings; } From fa241539a542505655ac6a73e7ccc5b1386eae53 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Wed, 19 Jan 2022 16:25:51 +0200 Subject: [PATCH 08/15] - fixed "Update Settings" admin notice on the Settings > Licenses screen. --- includes/admin/assets/js/um-admin-settings.js | 18 ++++++++++++++++-- includes/admin/core/class-admin-settings.php | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/includes/admin/assets/js/um-admin-settings.js b/includes/admin/assets/js/um-admin-settings.js index a60670e0..e4f027c2 100644 --- a/includes/admin/assets/js/um-admin-settings.js +++ b/includes/admin/assets/js/um-admin-settings.js @@ -1,10 +1,24 @@ jQuery( document ).ready( function() { + + /** * Licenses */ jQuery( document.body ).on( 'click', '.um_license_deactivate', function() { jQuery(this).siblings('.um-option-field').val(''); - jQuery(this).parents('form.um-settings-form').trigger('submit'); + if ( jQuery(this).siblings('#submit').length ) { + // clear = true for passing the empty field value to the license form submission + jQuery(this).siblings('#submit').trigger('click',[ true ]); + } else { + jQuery(this).parents('form.um-settings-form').trigger('submit'); + } + }); + + + jQuery( document.body ).on( 'click', '.um-settings-form #submit', function( e, clear ) { + if ( ! clear && '' === jQuery(this).siblings('.um-option-field').val() ) { + return false; + } }); @@ -32,4 +46,4 @@ jQuery( document ).ready( function() { window.onbeforeunload = ''; }); } -}); \ No newline at end of file +}); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 15fd23b0..9687d506 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2943,6 +2943,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { + Date: Thu, 20 Jan 2022 15:53:34 +0200 Subject: [PATCH 09/15] - added query_var for UM additional Users_Query on users.php --- includes/core/class-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/class-query.php b/includes/core/class-query.php index a0b30f5d..d2993bdb 100644 --- a/includes/core/class-query.php +++ b/includes/core/class-query.php @@ -222,7 +222,7 @@ if ( ! class_exists( 'um\core\Query' ) ) { * @return int */ function count_users_by_status( $status ) { - $args = array( 'fields' => 'ID', 'number' => 0 ); + $args = array( 'fields' => 'ID', 'number' => 0, 'um_custom_user_query' => true ); if ( $status == 'unassigned' ) { $args['meta_query'][] = array(array('key' => 'account_status','compare' => 'NOT EXISTS')); $users = new \WP_User_Query( $args ); From 20cbab04fb4ec95dca992064cf4c2f1234505a68 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Thu, 27 Jan 2022 11:46:52 +0200 Subject: [PATCH 10/15] - added ability to edit blocks restriction via FSE screen; --- includes/admin/core/class-admin-enqueue.php | 5 +---- ultimate-member.php | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index 199230cf..f1be244f 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -106,8 +106,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { $this->um_cpt_form_screen = true; add_action( 'admin_footer', array( $this, 'admin_footer_scripts' ), 20 ); } - - $this->post_page = true; } @@ -646,14 +644,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { } global $wp_version, $current_screen; - if ( version_compare( $wp_version, '5.0', '>=' ) && ! empty( $this->post_page ) ) { + if ( version_compare( $wp_version, '5.0', '>=' ) ) { if ( $current_screen->is_block_editor() ) { $this->load_gutenberg_js(); $this->load_gutenberg_shortcode_blocks(); } } - } diff --git a/ultimate-member.php b/ultimate-member.php index 2325ac0c..ac5acc28 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.3.1-alpha1 +Version: 2.3.1-beta1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From 2b7aa51d80ceb20e7e2829fc7fc49cce0f4a94fe Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 2 Feb 2022 15:19:22 +0200 Subject: [PATCH 11/15] fix usernames and emails blacklists - fix uppercase usernames and emails from blacklists --- includes/core/um-actions-form.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index f3a0fe49..c992447a 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -11,7 +11,7 @@ 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'] ) ) { @@ -19,7 +19,7 @@ function um_submit_form_errors_hook__blockedemails( $args ) { $domain = explode( '@', $args['user_email'] ); $check_domain = str_replace( $domain[0], '*', $args['user_email'] ); - if ( in_array( $args['user_email'], $emails ) ) { + if ( in_array( strtolower( $args['user_email'] ), $emails ) ) { exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) ); } @@ -86,11 +86,12 @@ function um_submit_form_errors_hook__blockedwords( $args ) { $mode = $args['mode']; $fields = unserialize( $args['custom_fields'] ); + $words = strtolower( $words ); $words = array_map( 'rtrim', explode( "\n", $words ) ); if ( ! empty( $fields ) && is_array( $fields ) ) { foreach ( $fields as $key => $array ) { if ( isset( $array['validate'] ) && in_array( $array['validate'], array( 'unique_username', 'unique_email', 'unique_username_or_email' ) ) ) { - if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( $args[ $key ], $words ) ) { + if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( strtolower( $args[ $key ] ), $words ) ) { UM()->form()->add_error( $key, __( 'You are not allowed to use this word as your username.', 'ultimate-member' ) ); } } From e0042ea13de35859aab2835b37a55832a62d1a6b Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Fri, 4 Feb 2022 17:19:01 +0200 Subject: [PATCH 12/15] - enhancement for dropdown.js (not completed); --- assets/js/dropdown.js | 24 ++++++++++++++++++------ assets/js/dropdown.min.js | 2 +- includes/core/class-member-directory.php | 10 ++++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/assets/js/dropdown.js b/assets/js/dropdown.js index 9e3a8d23..8cbe06e9 100644 --- a/assets/js/dropdown.js +++ b/assets/js/dropdown.js @@ -20,10 +20,13 @@ if ( !self.$menu.length ) { self.$menu = $('div.um-new-dropdown[data-element="' + self.data.element + '"]').first(); } + self.$dropdown = self.$menu.clone(); self.$dropdown.on('click', 'li a', self.itemHandler); /* add the handler for menu items */ $(window).on('resize', self.updatePosition); /* update the position on window resize */ - $(document.body).append(self.$dropdown); + + var parent = '' !== self.data.parent ? self.data.parent : document.body; + $(parent).append(self.$dropdown); /* trigger event */ self.$element.trigger('um_new_dropdown_render', { @@ -59,19 +62,28 @@ }, calculatePosition: function () { - var offset = self.$element.offset(), - rect = self.$element.get(0).getBoundingClientRect(), + var rect = self.$element.get(0).getBoundingClientRect(), height = self.$dropdown.innerHeight() || 150, width = self.data.width || 150, place = ''; + var offset; + if ( '' !== self.data.parent ) { + offset = self.$element.offset(); + } else { + + } + + var base_width = '' !== self.data.parent ? $( self.data.parent )[0].offsetWidth : window.innerWidth; + var base_height = '' !== self.data.parent ? $( self.data.parent )[0].offsetHeight : window.innerHeight; + var css = { position: 'absolute', width: width + 'px' }; /* vertical position */ - if ( window.innerHeight - rect.bottom > height ) { + if ( base_height - rect.bottom > height ) { css.top = offset.top + rect.height + 'px'; place += 'bottom'; } else { @@ -80,7 +92,7 @@ } /* horisontal position */ - if ( offset.left > width || offset.left > window.innerWidth / 2 ) { + if ( offset.left > width || offset.left > base_width / 2 ) { css.left = offset.left + rect.width - width + 'px'; place += '-left'; } else { @@ -191,4 +203,4 @@ function um_init_new_dropdown() { /* Init all dropdown menus on page load */ jQuery( document ).ready( function($) { um_init_new_dropdown(); -}); \ No newline at end of file +}); diff --git a/assets/js/dropdown.min.js b/assets/js/dropdown.min.js index b8181004..184bd409 100644 --- a/assets/js/dropdown.min.js +++ b/assets/js/dropdown.min.js @@ -1 +1 @@ -function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(t){function d(e){var i={get:function(){return i},show:function(){return i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=t('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler),t(window).on("resize",i.updatePosition),t(document.body).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(t(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.hide(),t("body > div.um-new-dropdown").remove(),t(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e=i.$element.offset(),n=i.$element.get(0).getBoundingClientRect(),t=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r={position:"absolute",width:o+"px"};switch(window.innerHeight-n.bottom>t?(r.top=e.top+n.height+"px",d+="bottom"):(d+="top",r.top=e.top-t+"px"),e.left>o||e.left>window.innerWidth/2?(r.left=e.left+n.width-o+"px",d+="-left"):(r.left=e.left+"px",d+="-right"),d){case"bottom-right":r.borderRadius="0px 5px 5px 5px";break;case"bottom-left":r.borderRadius="5px 0px 5px 5px";break;case"top-right":r.borderRadius="5px 5px 5px 0px";break;case"top-left":r.borderRadius="5px 5px 0px 5px"}return r},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();var n=t(e.currentTarget).attr("class");i.$menu.find('li a[class="'+n+'"]').trigger("click"),i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=t(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=t(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=t(i.data.element).first()),i.$dropdown=t(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),t(document.body).on(i.data.trigger,i.data.element,i.triggerHandler)),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,t(document.body).on("click",function(e){t(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}t.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,n){var t=d(n);return"function"==typeof t[o]?t[o]():t[o]}).toArray():this.each(function(e,n){d(n)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file +function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(p){function d(e){var i={get:function(){return i},show:function(){i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=p('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler),p(window).on("resize",i.updatePosition);var e=""!==i.data.parent?i.data.parent:document.body;return p(e).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(p(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.hide(),p("body > div.um-new-dropdown").remove(),p(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e=i.$element.offset(),n=i.$element.get(0).getBoundingClientRect(),t=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r=""!==i.data.parent?p(i.data.parent)[0].offsetWidth:window.innerWidth,a={position:"absolute",width:o+"px"};switch((""!==i.data.parent?p(i.data.parent)[0].offsetHeight:window.innerHeight)-n.bottom>t?(a.top=e.top+n.height+"px",d+="bottom"):(d+="top",a.top=e.top-t+"px"),e.left>o||e.left>r/2?(a.left=e.left+n.width-o+"px",d+="-left"):(a.left=e.left+"px",d+="-right"),d){case"bottom-right":a.borderRadius="0px 5px 5px 5px";break;case"bottom-left":a.borderRadius="5px 0px 5px 5px";break;case"top-right":a.borderRadius="5px 5px 5px 0px";break;case"top-left":a.borderRadius="5px 5px 0px 5px"}return a},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();var n=p(e.currentTarget).attr("class");i.$menu.find('li a[class="'+n+'"]').trigger("click"),i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=p(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=p(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=p(i.data.element).first()),i.$dropdown=p(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),p(document.body).on(i.data.trigger,i.data.element,i.triggerHandler)),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,p(document.body).on("click",function(e){p(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}p.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,n){var t=d(n);return"function"==typeof t[o]?t[o]():t[o]}).toArray():this.each(function(e,n){d(n)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 7f21d69e..be1f24d1 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -2586,12 +2586,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { * @param string $element * @param string $trigger * @param array $items + * @param string $parent */ - function dropdown_menu( $element, $trigger, $items = array() ) { + function dropdown_menu( $element, $trigger, $items = array(), $parent = '' ) { // !!!!Important: all links in the dropdown items must have "class" attribute ?> -
+
    $v ) { ?>
  • @@ -2610,11 +2611,12 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { * @param string $trigger * @param string $item * @param string $additional_attributes + * @param string $parent */ - function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '' ) { + function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '', $parent = '' ) { ?> -
    +
      <# _.each( .dropdown_actions, function( action, key, list ) { #>
    • >{{{action.title}}}
    • From 0b5e6fd8d56860ce63d8acd5f5160899c6ce2066 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Sun, 6 Feb 2022 22:09:36 +0200 Subject: [PATCH 13/15] - added fixes and enhancements to the dropdown.js library; --- assets/js/dropdown.js | 50 +++++++++++++++++++++++++++++---------- assets/js/dropdown.min.js | 2 +- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/assets/js/dropdown.js b/assets/js/dropdown.js index 8cbe06e9..8a88b57d 100644 --- a/assets/js/dropdown.js +++ b/assets/js/dropdown.js @@ -22,7 +22,7 @@ } self.$dropdown = self.$menu.clone(); - self.$dropdown.on('click', 'li a', self.itemHandler); /* add the handler for menu items */ + self.$dropdown.on('click', 'li a', self.itemHandler).attr('data-cloned', '1'); /* add the handler for menu items */ $(window).on('resize', self.updatePosition); /* update the position on window resize */ var parent = '' !== self.data.parent ? self.data.parent : document.body; @@ -54,8 +54,11 @@ }, hideAll: function () { - self.hide(); - $('body > div.um-new-dropdown').remove(); + if ( self.$element.data('um-new-dropdown-show') ) { + self.hide(); + } + + $( 'div.um-new-dropdown[data-cloned="1"]' ).remove(); $('.um-new-dropdown-shown').removeClass('um-new-dropdown-shown').data('um-new-dropdown-show', false); return self; @@ -69,9 +72,15 @@ var offset; if ( '' !== self.data.parent ) { - offset = self.$element.offset(); - } else { + var parentPos = $( self.data.parent ).offset(); + var childPos = self.$element.offset(); + offset = { + top: childPos.top - parentPos.top, + left: childPos.left - parentPos.left + }; + } else { + offset = self.$element.offset(); } var base_width = '' !== self.data.parent ? $( self.data.parent )[0].offsetWidth : window.innerWidth; @@ -135,10 +144,12 @@ self.$menu.find('li a[class="' + attrClass + '"]').trigger('click'); /* hide dropdown */ - self.hide(); + if ( self.$element.data('um-new-dropdown-show') ) { + self.hide(); + } }, - triggerHandler: function (e) { + triggerHandler: function(e) { e.stopPropagation(); self.$element = $(e.currentTarget); @@ -151,26 +162,41 @@ } }; + // hidden dropdown menu block generated via PHP. Is used for cloning when 'action' on the 'link' self.$menu = $(element); + // 'link' data self.data = self.$menu.data(); + // base 'link' which we use for 'action' and show a clone of the hidden dropdown self.$element = self.$menu.closest(self.data.element); - if ( !self.$element.length ) { - self.$element = $(self.data.element).first(); + if ( ! self.$element.length ) { + self.$element = $( self.data.element ).first(); } self.$dropdown = $(document.body).children('div[data-element="' + self.data.element + '"]'); if ( typeof self.data.initted === 'undefined' ) { + // single init based on 'initted' data and add 'action' handler for the 'link' self.$menu.data('initted', true); - $(document.body).on(self.data.trigger, self.data.element, self.triggerHandler); + self.data = self.$menu.data(); + + // screenTriggers is used to not duplicate the triggers for more than 1 element on the page + if ( typeof um_dropdownMenu.screenTriggers === 'undefined' ) { + um_dropdownMenu.screenTriggers = {}; + } + + if ( um_dropdownMenu.screenTriggers[ self.data.element ] !== self.data.trigger ) { + um_dropdownMenu.screenTriggers[ self.data.element ] = self.data.trigger; + $(document.body).on( self.data.trigger, self.data.element, self.triggerHandler ); + } } if ( typeof um_dropdownMenu.globalHandlersInitted === 'undefined' ) { um_dropdownMenu.globalHandlersInitted = true; - $(document.body).on('click', function (e) { - if ( !$(e.target).closest('.um-new-dropdown').length ) { + //var globalParent = '' !== self.data.parent ? self.data.parent : document.body; + $( document.body ).on('click', function(e) { + if ( ! $( e.target ).closest('.um-new-dropdown').length ) { self.hideAll(); } }); diff --git a/assets/js/dropdown.min.js b/assets/js/dropdown.min.js index 184bd409..1847c151 100644 --- a/assets/js/dropdown.min.js +++ b/assets/js/dropdown.min.js @@ -1 +1 @@ -function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(p){function d(e){var i={get:function(){return i},show:function(){i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=p('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler),p(window).on("resize",i.updatePosition);var e=""!==i.data.parent?i.data.parent:document.body;return p(e).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(p(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.hide(),p("body > div.um-new-dropdown").remove(),p(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e=i.$element.offset(),n=i.$element.get(0).getBoundingClientRect(),t=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r=""!==i.data.parent?p(i.data.parent)[0].offsetWidth:window.innerWidth,a={position:"absolute",width:o+"px"};switch((""!==i.data.parent?p(i.data.parent)[0].offsetHeight:window.innerHeight)-n.bottom>t?(a.top=e.top+n.height+"px",d+="bottom"):(d+="top",a.top=e.top-t+"px"),e.left>o||e.left>r/2?(a.left=e.left+n.width-o+"px",d+="-left"):(a.left=e.left+"px",d+="-right"),d){case"bottom-right":a.borderRadius="0px 5px 5px 5px";break;case"bottom-left":a.borderRadius="5px 0px 5px 5px";break;case"top-right":a.borderRadius="5px 5px 5px 0px";break;case"top-left":a.borderRadius="5px 5px 0px 5px"}return a},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();var n=p(e.currentTarget).attr("class");i.$menu.find('li a[class="'+n+'"]').trigger("click"),i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=p(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=p(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=p(i.data.element).first()),i.$dropdown=p(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),p(document.body).on(i.data.trigger,i.data.element,i.triggerHandler)),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,p(document.body).on("click",function(e){p(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}p.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,n){var t=d(n);return"function"==typeof t[o]?t[o]():t[o]}).toArray():this.each(function(e,n){d(n)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file +function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(u){function d(e){var l={get:function(){return l},show:function(){l.hideAll(),l.$menu=l.$element.find(".um-new-dropdown"),l.$menu.length||(l.$menu=u('div.um-new-dropdown[data-element="'+l.data.element+'"]').first()),l.$dropdown=l.$menu.clone(),l.$dropdown.on("click","li a",l.itemHandler).attr("data-cloned","1"),u(window).on("resize",l.updatePosition);var e=""!==l.data.parent?l.data.parent:document.body;return u(e).append(l.$dropdown),l.$element.trigger("um_new_dropdown_render",{dropdown_layout:l.$dropdown,trigger:l.data.trigger,element:l.data.elemen,obj:l.$element}),l.$dropdown.css(l.calculatePosition()).show(),l.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),l},hide:function(){return l.$dropdown&&l.$dropdown.is(":visible")&&(u(window).off("resize",l.updatePosition),l.$dropdown.remove(),l.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),l},hideAll:function(){return l.$element.data("um-new-dropdown-show")&&l.hide(),u('div.um-new-dropdown[data-cloned="1"]').remove(),u(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),l},calculatePosition:function(){var e,t=l.$element.get(0).getBoundingClientRect(),n=l.$dropdown.innerHeight()||150,o=l.data.width||150,d="";if(""!==l.data.parent){var r=u(l.data.parent).offset(),a=l.$element.offset();e={top:a.top-r.top,left:a.left-r.left}}else e=l.$element.offset();var i=""!==l.data.parent?u(l.data.parent)[0].offsetWidth:window.innerWidth,p={position:"absolute",width:o+"px"};switch((""!==l.data.parent?u(l.data.parent)[0].offsetHeight:window.innerHeight)-t.bottom>n?(p.top=e.top+t.height+"px",d+="bottom"):(d+="top",p.top=e.top-n+"px"),e.left>o||e.left>i/2?(p.left=e.left+t.width-o+"px",d+="-left"):(p.left=e.left+"px",d+="-right"),d){case"bottom-right":p.borderRadius="0px 5px 5px 5px";break;case"bottom-left":p.borderRadius="5px 0px 5px 5px";break;case"top-right":p.borderRadius="5px 5px 5px 0px";break;case"top-left":p.borderRadius="5px 5px 0px 5px"}return p},updatePosition:function(){return l.$dropdown&&l.$dropdown.is(":visible")&&l.$dropdown.css(l.calculatePosition()),l},itemHandler:function(e){e.stopPropagation();var t=u(e.currentTarget).attr("class");l.$menu.find('li a[class="'+t+'"]').trigger("click"),l.$element.data("um-new-dropdown-show")&&l.hide()},triggerHandler:function(e){e.stopPropagation(),l.$element=u(e.currentTarget),l.$element.data("um-new-dropdown-show")?l.hide():l.show()}};return l.$menu=u(e),l.data=l.$menu.data(),l.$element=l.$menu.closest(l.data.element),l.$element.length||(l.$element=u(l.data.element).first()),l.$dropdown=u(document.body).children('div[data-element="'+l.data.element+'"]'),void 0===l.data.initted&&(l.$menu.data("initted",!0),l.data=l.$menu.data(),void 0===d.screenTriggers&&(d.screenTriggers={}),d.screenTriggers[l.data.element]!==l.data.trigger&&(d.screenTriggers[l.data.element]=l.data.trigger,u(document.body).on(l.data.trigger,l.data.element,l.triggerHandler))),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,u(document.body).on("click",function(e){u(e.target).closest(".um-new-dropdown").length||l.hideAll()})),l}u.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,t){var n=d(t);return"function"==typeof n[o]?n[o]():n[o]}).toArray():this.each(function(e,t){d(t)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file From cfd8365afd5b622e8b79d81e9fb11ebd032e7520 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 7 Feb 2022 12:20:24 +0200 Subject: [PATCH 14/15] - code review; --- includes/admin/core/class-admin-metabox.php | 2 +- includes/admin/core/class-admin-settings.php | 4 ++-- includes/core/um-actions-form.php | 23 +++++++++----------- readme.txt | 15 +++++++++++-- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index e6ee0d17..a52acbb5 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -2364,7 +2364,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
      -

      +

      edit_mode_value || $this->edit_mode_value ) ?> />

      diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 9687d506..95b39c28 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -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' ), ), ), diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index c992447a..1aefd617 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -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 ); diff --git a/readme.txt b/readme.txt index bba501ca..0d1e990e 100644 --- a/readme.txt +++ b/readme.txt @@ -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 = From 86ca7b1de9ea69eeb5e2cc440a21284d97feb29f Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 7 Feb 2022 15:11:06 +0200 Subject: [PATCH 15/15] - prepared changelog for the release; --- README.md | 2 +- readme.txt | 8 ++++++++ ultimate-member.php | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93a10630..90002fd9 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ GNU Version 2 or Any Later Version ## Releases -[Official Release Version: 2.3.0](https://github.com/ultimatemember/ultimatemember/releases/tag/2.3.0). +[Official Release Version: 2.3.1](https://github.com/ultimatemember/ultimatemember/releases/tag/2.3.1). ## Changelog diff --git a/readme.txt b/readme.txt index 0d1e990e..0499a489 100644 --- a/readme.txt +++ b/readme.txt @@ -161,12 +161,20 @@ The plugin works with popular caching plugins by automatically excluding Ultimat - 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 + - Added: UM-specific query_var for UM additional Users_Query on users.php screen in wp-admin. `um_custom_user_query` = true + - Added: Ability for dropdown.js to use it inside parent wrapper (not only document.body) + - Changed: Using WP Cron schedules. Un-schedule events after plugin deactivation + - Removed: `um_check_extensions_licenses` and replaced it to `um_daily_scheduled_events` event * 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: PHP warning related to the Ultimate Member custom fields without type - Fixed: Some typos in the labels (#975) + - Fixed: UX issue with wrong text on the admin notice about upgrade + - Fixed: UX issue with Blacklist Words and Blocked Email settings labels. Added a small description about per line separation (#962) + - Fixed: Sorting the Extensions settings sections = 2.3.0: December 20, 2021 = diff --git a/ultimate-member.php b/ultimate-member.php index ac5acc28..2ac1bd34 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.3.1-beta1 +Version: 2.3.1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member