From 2107336cf9b58113e3a99ebb7c521d053a6335eb Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 7 Dec 2023 13:36:51 +0200 Subject: [PATCH 01/76] - change placeholders for set password --- includes/core/class-mail.php | 22 ++++++++++++++++++++++ includes/core/class-user.php | 10 ++++++++-- includes/core/um-actions-register.php | 9 ++++++--- templates/email/welcome_email.php | 2 +- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index 8bd1acd7..af429cf2 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -423,6 +423,9 @@ if ( ! class_exists( 'um\core\Mail' ) ) { add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ) ); add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ) ); + if ( array_key_exists( 'generated_pass', $args ) && 1 === absint( $args['generated_pass'] ) ) { + add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder_set_password' ) ); + } /** * Filters email notification subject. @@ -621,6 +624,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $placeholders[] = '{admin_email}'; $placeholders[] = '{submitted_registration}'; $placeholders[] = '{login_url}'; + $placeholders[] = '{login_button}'; $placeholders[] = '{password}'; $placeholders[] = '{account_activation_link}'; return $placeholders; @@ -639,9 +643,27 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $replace_placeholders[] = um_admin_email(); $replace_placeholders[] = um_user_submitted_registration_formatted(); $replace_placeholders[] = um_get_core_page( 'login' ); + $replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' ); $replace_placeholders[] = esc_html__( 'Your set password', 'ultimate-member' ); $replace_placeholders[] = um_user( 'account_activation_link' ); return $replace_placeholders; } + + + public function add_replace_placeholder_set_password( $replace_placeholders ) { + $key = array_search( um_get_core_page( 'login' ), $replace_placeholders, true ); + if ( false !== $key ) { + $url = UM()->password()->reset_url(); + $replace_placeholders[ $key ] = add_query_arg( array( 'set_pass' => 'new_user' ), $url ); + } + + $button = esc_html__( 'Login to our site', 'ultimate-member' ); + $button_key = array_search( $button, $replace_placeholders , true ); + if ( false !== $key ) { + $url = UM()->password()->reset_url(); + $replace_placeholders[ $button_key ] = esc_html__( 'Set your password', 'ultimate-member' ); + } + return $replace_placeholders; + } } } diff --git a/includes/core/class-user.php b/includes/core/class-user.php index d4725da2..c47690f3 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -1690,7 +1690,7 @@ if ( ! class_exists( 'um\core\User' ) ) { ?> * */ - function approve( $repeat = true ) { + function approve( $repeat = true, $args = array() ) { $user_id = um_user( 'ID' ); if ( ! $repeat ) { @@ -1712,7 +1712,13 @@ if ( ! class_exists( 'um\core\User' ) ) { } else { //$userdata = get_userdata( $user_id ); //get_password_reset_key( $userdata ); - UM()->mail()->send( um_user( 'user_email' ), 'welcome_email' ); + $welcome_email_args = array(); + if ( true === (bool) $args['generated_pass'] ) { + $welcome_email_args = array( + 'generated_pass' => 1, + ); + } + UM()->mail()->send( um_user( 'user_email' ), 'welcome_email', $welcome_email_args ); } $this->set_status( 'approved' ); diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 5f8a8404..f85c4ad4 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -8,12 +8,12 @@ if ( ! defined( 'ABSPATH' ) ) { * * @param int $user_id */ -function um_post_registration_approved_hook( $user_id ) { +function um_post_registration_approved_hook( $user_id, $args ) { um_fetch_user( $user_id ); - UM()->user()->approve(); + UM()->user()->approve( true, $args ); } -add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook' ); +add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2 ); /** * Account needs email validation. @@ -456,6 +456,9 @@ function um_submit_form_register( $args, $form_data ) { 'user_password' => $user_password, 'user_email' => trim( $user_email ), ); + if ( ! isset( $args['user_password'] ) ) { + $credentials['generated_pass'] = true; + } // @todo test when ready maybe remove if ( ! empty( $args['submitted'] ) ) { diff --git a/templates/email/welcome_email.php b/templates/email/welcome_email.php index b9807834..ac4ab960 100644 --- a/templates/email/welcome_email.php +++ b/templates/email/welcome_email.php @@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
Thank you for signing up!Your account is now active.
-
Login to our site
+
{login_button}
If you have any problems, please contact us at {admin_email}
From 125574fe6996461cccac0c94e1e81c90515590dd Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 22 Dec 2023 12:23:53 +0200 Subject: [PATCH 02/76] - admin settings new enhancements (partially); --- includes/admin/class-admin.php | 5 +- includes/admin/core/class-admin-forms.php | 49 +++- includes/admin/core/class-admin-notices.php | 2 +- includes/admin/core/class-admin-settings.php | 214 ++++++++++-------- .../version-template-list-table.php | 3 +- 5 files changed, 168 insertions(+), 105 deletions(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index fe417866..0ca641eb 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -1842,8 +1842,9 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { $url = add_query_arg( array( - 'page' => 'um_options', - 'tab' => 'override_templates', + 'page' => 'um_options', + 'tab' => 'advanced', + 'section' => 'override_templates', ), admin_url( 'admin.php' ) ); diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index f2194200..55c150bd 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -97,19 +97,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } } - /** * @param array $data * * @return string */ - function render_form_row( $data ) { + public function render_form_row( $data ) { if ( empty( $data['type'] ) ) { return ''; } - if ( !empty( $data['value'] ) && $data['type'] != 'email_template' ) { + if ( ! empty( $data['value'] ) && $data['type'] != 'email_template' ) { $data['value'] = wp_unslash( $data['value'] ); /*for multi_text*/ @@ -1739,6 +1738,50 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { return $html; } + /** + * @param array $field_data + * + * @return string + */ + public function render_form_section( $field_data ) { + $html = '

' . esc_html( $field_data['title'] ) . '

'; + if ( ! empty( $field_data['content'] ) ) { + $html .= '

' . wp_kses( $field_data['content'] , UM()->get_allowed_html( 'admin_notice' ) ) . '

'; + } + return $html; + } + + public function render_override_templates( $field_data ) { + $um_check_version = get_transient( 'um_check_template_versions' ); + + $check_url = add_query_arg( + array( + 'um_adm_action' => 'check_templates_version', + '_wpnonce' => wp_create_nonce( 'check_templates_version' ), + ) + ); + ?> + +

+ + + + +

+ + diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index d7e1310e..6c6842a3 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -59,7 +59,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //custom content for override templates tab add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); - add_filter( 'um_settings_section_override_templates__content', array( $this, 'settings_override_templates_tab' ), 10, 2 ); add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 ); @@ -1800,7 +1799,69 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'licenses' => array( 'title' => __( 'Licenses', 'ultimate-member' ), ), - 'misc' => array( + 'advanced' => array( + 'title' => __( 'Advanced', 'ultimate-member' ), + 'sections' => array( + '' => array( + 'title' => __( 'General', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'rest_api_version', + 'type' => 'select', + 'label' => __( 'REST API version', 'ultimate-member' ), + 'description' => __( 'This controls the REST API version, we recommend to use the last version', 'ultimate-member' ), + 'options' => array( + '1.0' => __( '1.0 version', 'ultimate-member' ), + '2.0' => __( '2.0 version', 'ultimate-member' ), + ), + ), + array( + 'id' => 'uninstall_on_delete', + 'type' => 'checkbox', + 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ), + ), + ), + ), + 'override_templates' => array( + 'title' => __( 'Override templates', 'ultimate-member' ), + 'form_sections' => array( + array( + 'id' => 'override_templates_options', + 'type' => 'form_section', + 'title' => __( 'Override templates', 'ultimate-member' ), + // translators: %s: Link to the docs article. + 'description' => sprintf( __( 'You may get more details about overriding templates here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), /** @noinspection HtmlUnknownTarget */ + 'fields' => array( + array( + 'type' => 'override_templates', + ), + ), + ), + ), + ), + 'features' => array( + 'title' => __( 'Features', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'enable_blocks', + 'type' => 'checkbox', + 'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), + ), + // backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query + // otherwise we're filtering only results and restricted posts/terms can be visible + array( + 'id' => 'disable_restriction_pre_queries', + 'type' => 'checkbox', + 'label' => __( 'Disable pre-queries for restriction content logic (advanced)', 'ultimate-member' ), + 'description' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements', 'ultimate-member' ), + ), + ), + ), + ), + ), + 'misc' => array( 'title' => __( 'Misc', 'ultimate-member' ), 'fields' => array( array( @@ -1830,37 +1891,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Disable Cache User Profile', 'ultimate-member' ), 'tooltip' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), ), - array( - 'id' => 'enable_blocks', - 'type' => 'checkbox', - 'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), - 'tooltip' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), - ), - array( - 'id' => 'rest_api_version', - 'type' => 'select', - 'label' => __( 'REST API version', 'ultimate-member' ), - 'tooltip' => __( 'This controls the REST API version, we recommend to use the last version', 'ultimate-member' ), - 'options' => array( - '1.0' => __( '1.0 version', 'ultimate-member' ), - '2.0' => __( '2.0 version', 'ultimate-member' ), - ), - ), - // backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query - // otherwise we filtering only results and restricted posts/terms can be visible - array( - 'id' => 'disable_restriction_pre_queries', - 'type' => 'checkbox', - 'label' => __( 'Disable pre-queries for restriction content logic (advanced)', 'ultimate-member' ), - 'tooltip' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements', 'ultimate-member' ), - ), $same_page_update, - array( - 'id' => 'uninstall_on_delete', - 'type' => 'checkbox', - 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ), - 'tooltip' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ), - ), ), ), 'install_info' => array( @@ -1871,14 +1902,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), - 'override_templates' => array( - 'title' => __( 'Override templates', 'ultimate-member' ), - 'fields' => array( - array( - 'type' => 'override_templates', - ), - ), - ), ) ); @@ -1952,24 +1975,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_submenu_page( 'ultimatemember', __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( &$this, 'settings_page' ) ); } - /** - * Settings page callback + * Settings page callback. */ - function settings_page() { - $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); + public function settings_page() { + $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); $settings_struct = $this->settings_structure[ $current_tab ]; - //remove not option hidden fields + // Remove not option hidden fields if ( ! empty( $settings_struct['fields'] ) ) { foreach ( $settings_struct['fields'] as $field_key => $field_options ) { - - if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) { + if ( isset( $field_options['is_option'] ) && false === $field_options['is_option'] ) { unset( $settings_struct['fields'][ $field_key ] ); } - } } @@ -1983,7 +2003,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - echo '

' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . '

'; + echo '

' . esc_html__( 'Ultimate Member - Settings', 'ultimate-member' ) . '

'; echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab ); @@ -2006,7 +2026,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { */ do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" ); - if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info', 'override_templates' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) { + if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) { /** * UM hook @@ -2027,7 +2047,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { */ do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); - $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); + $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab ); /** @@ -2082,7 +2102,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { */ do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); - $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); + $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab ); /** @@ -2676,6 +2696,35 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $in_theme = UM()->mail()->template_in_theme( $email_key ); + $section_fields = array( + array( + 'id' => 'um_email_template', + 'type' => 'hidden', + 'value' => $email_key, + ), + array( + 'id' => $email_key . '_on', + 'type' => 'checkbox', + 'label' => $emails[ $email_key ]['title'], + 'tooltip' => $emails[ $email_key ]['description'], + ), + array( + 'id' => $email_key . '_sub', + 'type' => 'text', + 'label' => __( 'Subject Line', 'ultimate-member' ), + 'conditional' => array( $email_key . '_on', '=', 1 ), + 'tooltip' => __( 'This is the subject line of the e-mail', 'ultimate-member' ), + ), + array( + 'id' => $email_key, + 'type' => 'email_template', + 'label' => __( 'Message Body', 'ultimate-member' ), + 'conditional' => array( $email_key . '_on', '=', 1 ), + 'tooltip' => __( 'This is the content of the e-mail', 'ultimate-member' ), + 'value' => UM()->mail()->get_email_template( $email_key ), + 'in_theme' => $in_theme, + ), + ); /** * UM hook * @@ -2697,40 +2746,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { * } * ?> */ - $section_fields = apply_filters( 'um_admin_settings_email_section_fields', array( - array( - 'id' => 'um_email_template', - 'type' => 'hidden', - 'value' => $email_key, - ), - array( - 'id' => $email_key . '_on', - 'type' => 'checkbox', - 'label' => $emails[ $email_key ]['title'], - 'tooltip' => $emails[ $email_key ]['description'], - ), - array( - 'id' => $email_key . '_sub', - 'type' => 'text', - 'label' => __( 'Subject Line', 'ultimate-member' ), - 'conditional' => array( $email_key . '_on', '=', 1 ), - 'tooltip' => __( 'This is the subject line of the e-mail', 'ultimate-member' ), - ), - array( - 'id' => $email_key, - 'type' => 'email_template', - 'label' => __( 'Message Body', 'ultimate-member' ), - 'conditional' => array( $email_key . '_on', '=', 1 ), - 'tooltip' => __( 'This is the content of the e-mail', 'ultimate-member' ), - 'value' => UM()->mail()->get_email_template( $email_key ), - 'in_theme' => $in_theme - ), - ), $email_key ); + $section_fields = apply_filters( 'um_admin_settings_email_section_fields', $section_fields, $email_key ); return $this->render_settings_section( $section_fields, 'email', $email_key ); } - /** * */ @@ -2738,16 +2758,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { wp_enqueue_media(); } - /** * @param $html * @param $section_fields * * @return string */ - function settings_licenses_tab( $html, $section_fields ) { - ob_start(); ?> - + public function settings_licenses_tab( $html, $section_fields ) { + ob_start(); + ?>
@@ -3027,8 +3046,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
admin_forms_settings( array( - 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column', - 'prefix_id' => 'um_options', - 'fields' => $section_fields - ) )->render_form(); ?> - - admin_forms_settings( + array( + 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column', + 'prefix_id' => 'um_options', + 'fields' => $section_fields, + ) + )->render_form(); + $section = ob_get_clean(); return $section; } diff --git a/includes/admin/core/list-tables/version-template-list-table.php b/includes/admin/core/list-tables/version-template-list-table.php index 940ba523..739dfd6b 100644 --- a/includes/admin/core/list-tables/version-template-list-table.php +++ b/includes/admin/core/list-tables/version-template-list-table.php @@ -210,6 +210,7 @@ $list_table->prepare_items();
- + + display(); ?>
From 5a2949689729c2841a29356fc40c12ca39f193d1 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 1 Jan 2024 12:54:33 +0200 Subject: [PATCH 03/76] - redirects for wp-admin settings page; --- includes/admin/core/class-admin-menu.php | 50 +++++++++-- includes/admin/core/class-admin-settings.php | 94 ++++++++------------ 2 files changed, 80 insertions(+), 64 deletions(-) diff --git a/includes/admin/core/class-admin-menu.php b/includes/admin/core/class-admin-menu.php index d7bb773f..eb8a14c0 100644 --- a/includes/admin/core/class-admin-menu.php +++ b/includes/admin/core/class-admin-menu.php @@ -16,18 +16,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { */ class Admin_Menu { - /** * @var string */ var $pagehook; var $slug = 'ultimatemember'; - /** * Admin_Menu constructor. */ - function __construct() { + public function __construct() { add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 ); add_action( 'admin_menu', array( &$this, 'secondary_menu_items' ), 1000 ); add_action( 'admin_menu', array( &$this, 'extension_menu' ), 9999 ); @@ -35,8 +33,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { add_action( 'admin_head', array( $this, 'menu_order_count' ) ); add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1000 ); + + add_action( 'load-ultimate-member_page_um_options', array( &$this, 'maybe_settings_redirect' ) ); } + /** + * Trigger redirect on the Settings screen if there is a wrong tab or section. + * + * @since 2.8.2 + */ + public function maybe_settings_redirect() { + $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); + $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); + + $settings_struct = UM()->admin_settings()->settings_structure[ $current_tab ]; + + // Remove not option hidden fields. + if ( ! empty( $settings_struct['fields'] ) ) { + foreach ( $settings_struct['fields'] as $field_key => $field_options ) { + if ( isset( $field_options['is_option'] ) && false === $field_options['is_option'] ) { + unset( $settings_struct['fields'][ $field_key ] ); + } + } + } + + if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) ) { + wp_safe_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) ); + exit; + } + + if ( ! empty( $settings_struct['sections'] ) ) { + if ( empty( $settings_struct['sections'][ $current_subtab ] ) ) { + $args = array( 'page' => 'um_options' ); + if ( ! empty( $current_tab ) ) { + $args['tab'] = $current_tab; + } + wp_safe_redirect( add_query_arg( $args, admin_url( 'admin.php' ) ) ); + exit; + } + } + } /** * Change the admin footer text on UM admin pages @@ -143,8 +179,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { /** * Setup admin menu */ - function primary_admin_menu() { - $this->pagehook = add_menu_page( __( 'Ultimate Member', 'ultimate-member' ), __( 'Ultimate Member', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ), 'dashicons-admin-users', '42.78578'); + public function primary_admin_menu() { + $this->pagehook = add_menu_page( __( 'Ultimate Member', 'ultimate-member' ), __( 'Ultimate Member', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ), 'dashicons-admin-users', '42.78578' ); add_action( 'load-' . $this->pagehook, array( &$this, 'on_load_page' ) ); @@ -155,7 +191,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { /** * Secondary admin menu (after settings) */ - function secondary_menu_items() { + public function secondary_menu_items() { + add_submenu_page( $this->slug, __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( UM()->admin_settings(), 'settings_page' ) ); + add_submenu_page( $this->slug, __( 'Forms', 'ultimate-member' ), __( 'Forms', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_form', '' ); add_submenu_page( $this->slug, __( 'User Roles', 'ultimate-member' ), __( 'User Roles', 'ultimate-member' ), 'manage_options', 'um_roles', array( &$this, 'um_roles_pages' ) ); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 6c6842a3..7df53ec9 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -42,9 +42,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //init settings structure add_action( 'admin_init', array( &$this, 'init_variables' ), 9 ); - //admin menu - add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 ); - //settings structure handlers add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) ); add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 ); @@ -1967,14 +1964,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return array(); } - - /** - * Setup admin menu - */ - function primary_admin_menu() { - add_submenu_page( 'ultimatemember', __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( &$this, 'settings_page' ) ); - } - /** * Settings page callback. */ @@ -1982,27 +1971,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); - $settings_struct = $this->settings_structure[ $current_tab ]; - - // Remove not option hidden fields - if ( ! empty( $settings_struct['fields'] ) ) { - foreach ( $settings_struct['fields'] as $field_key => $field_options ) { - if ( isset( $field_options['is_option'] ) && false === $field_options['is_option'] ) { - unset( $settings_struct['fields'][ $field_key ] ); - } - } - } - - if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) ) { - um_js_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) ); - } - - if ( ! empty( $settings_struct['sections'] ) ) { - if ( empty( $settings_struct['sections'][ $current_subtab ] ) ) { - um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) ); - } - } - echo '

' . esc_html__( 'Ultimate Member - Settings', 'ultimate-member' ) . '

'; echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab ); @@ -2142,24 +2110,22 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { '; - switch( $page ) { + switch ( $page ) { case 'settings': $menu_tabs = array(); foreach ( $this->settings_structure as $slug => $tab ) { if ( ! empty( $tab['fields'] ) ) { foreach ( $tab['fields'] as $field_key => $field_options ) { - if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) { + if ( isset( $field_options['is_option'] ) && false === $field_options['is_option'] ) { unset( $tab['fields'][ $field_key ] ); } } @@ -2172,10 +2138,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); foreach ( $menu_tabs as $name => $label ) { - $active = ( $current_tab == $name ) ? 'nav-tab-active' : ''; - $tabs .= '' . - $label . - ''; + $active = $current_tab === $name ? 'nav-tab-active' : ''; + + $args = array( 'page' => 'um_options' ); + if ( ! empty( $name ) ) { + $args['tab'] = $name; + } + $tab_url = add_query_arg( $args, admin_url( 'admin.php' ) ); + $tabs .= '' . esc_html( $label ) . ''; } break; @@ -2207,36 +2177,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $tabs . ''; } - /** * @param string $tab * * @return string */ - function generate_subtabs_menu( $tab = '' ) { + private function generate_subtabs_menu( $tab = '' ) { if ( empty( $this->settings_structure[ $tab ]['sections'] ) ) { return ''; } + $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); + $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); + $menu_subtabs = array(); foreach ( $this->settings_structure[ $tab ]['sections'] as $slug => $subtab ) { $menu_subtabs[ $slug ] = $subtab['title']; } - $subtabs = '
    '; - - $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); - $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); + $subtabs = array(); foreach ( $menu_subtabs as $name => $label ) { - $active = ( $current_subtab == $name ) ? 'current' : ''; - $subtabs .= '' - . $label . - ' | '; + $active = $current_subtab === $name ? 'current' : ''; + + $args = array( 'page' => 'um_options' ); + if ( ! empty( $current_tab ) ) { + $args['tab'] = $current_tab; + } + if ( ! empty( $name ) ) { + $args['section'] = $name; + } + $tab_url = add_query_arg( $args, admin_url( 'admin.php' ) ); + + $subtabs[] = '' . esc_html( $label ) . ''; } - return substr( $subtabs, 0, -3 ) . '
'; - } + if ( empty( $subtabs ) ) { + return ''; + } + return '
    ' . implode( ' | ', $subtabs ) . '
'; + } /** * Handler for settings forms @@ -2667,20 +2647,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - /** * */ - function settings_before_email_tab() { + public function settings_before_email_tab() { $email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] ); - $emails = UM()->config()->email_notifications; + $emails = UM()->config()->email_notifications; if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) { include_once UM_PATH . 'includes/admin/core/list-tables/emails-list-table.php'; } } - /** * @param $section * From 2a6d84f8ffd37d9e8a837e062cd463812493b6fc Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 1 Jan 2024 17:37:14 +0200 Subject: [PATCH 04/76] - removed Install Info handlers; - updated handlers for the wp-admin settings; - avoid double generate sections (hidden process); - nav tabs and subtabs using WordPress native CSS; --- assets/css/admin/settings.css | 11 - assets/css/admin/settings.min.css | 2 +- assets/css/admin/settings.sass | 14 +- includes/admin/class-enqueue.php | 6 + .../admin/core/class-admin-forms-settings.php | 55 +- includes/admin/core/class-admin-forms.php | 2 +- includes/admin/core/class-admin-settings.php | 700 ++--------- includes/lib/browser.php | 1100 ----------------- 8 files changed, 141 insertions(+), 1749 deletions(-) delete mode 100644 includes/lib/browser.php diff --git a/assets/css/admin/settings.css b/assets/css/admin/settings.css index 567c6ff5..ffb296f5 100644 --- a/assets/css/admin/settings.css +++ b/assets/css/admin/settings.css @@ -1,14 +1,3 @@ -#um-settings-wrap .subsubsub { - display: flex; - flex-direction: row; - justify-content: flex-start; - align-items: center; - flex-wrap: wrap; - margin-left: -3px; - margin-right: -3px; } - #um-settings-wrap .subsubsub a { - margin: 0 3px; } - .um-settings-section .description { font-style: italic; } diff --git a/assets/css/admin/settings.min.css b/assets/css/admin/settings.min.css index a086dd80..909bc2e5 100644 --- a/assets/css/admin/settings.min.css +++ b/assets/css/admin/settings.min.css @@ -1 +1 @@ -#um-settings-wrap .subsubsub{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:wrap;margin-left:-3px;margin-right:-3px}#um-settings-wrap .subsubsub a{margin:0 3px}.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:60px;text-align:center}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file +.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:60px;text-align:center}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file diff --git a/assets/css/admin/settings.sass b/assets/css/admin/settings.sass index e6eec3c2..1d3dc722 100644 --- a/assets/css/admin/settings.sass +++ b/assets/css/admin/settings.sass @@ -2,13 +2,13 @@ @import "mixins" @import "colors" -##{$prefix}settings-wrap - .subsubsub - +flex( row, flex-start, center, wrap ) - margin-left: -3px - margin-right: -3px - a - margin: 0 3px +//##{$prefix}settings-wrap +// .subsubsub +// +flex( row, flex-start, center, wrap ) +// margin-left: -3px +// margin-right: -3px +// a +// margin: 0 3px .#{$prefix}settings-section .description diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index 604933af..20c6e3da 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -589,6 +589,12 @@ final class Enqueue extends \um\common\Enqueue { wp_enqueue_script( 'um_admin_secure' ); } + // phpcs:ignore WordPress.Security.NonceVerification + if ( isset( $_GET['tab'] ) && 'appearance' === $_GET['tab'] && empty( $_GET['section'] ) ) { + // Init WP Media Uploader on the UM > Settings > Appearance > Profile screen. + wp_enqueue_media(); + } + wp_register_style( 'um_admin_settings', $css_url . 'admin/settings' . $suffix . '.css', array(), UM_VERSION ); wp_enqueue_style( 'um_admin_settings' ); diff --git a/includes/admin/core/class-admin-forms-settings.php b/includes/admin/core/class-admin-forms-settings.php index ba52b817..37ad481f 100644 --- a/includes/admin/core/class-admin-forms-settings.php +++ b/includes/admin/core/class-admin-forms-settings.php @@ -1,12 +1,12 @@ options()->get_default( $field_data['id' . $i] ); + public function get_field_value( $field_data, $i = '' ) { + $default_key = 'default' . $i; + $value_key = 'value' . $i; + $id_key = 'id' . $i; - if ( $field_data['type'] == 'checkbox' || $field_data['type'] == 'multi_checkbox' ) { - if ( isset( $field_data['value' . $i] ) ) { - return $field_data['value' . $i]; - } else { - $value = UM()->options()->get( $field_data['id' . $i] ); - $value = is_string( $value ) ? stripslashes( $value ) : $value; - return '' !== $value ? $value : $default; - } - } else { - if ( isset( $field_data['value' . $i] ) ) { - return $field_data['value'. $i]; - } else { - $value = UM()->options()->get( $field_data['id' . $i] ); - $value = is_string( $value ) ? stripslashes( $value ) : $value; - return isset( $value ) ? $value : $default; + $default = isset( $field_data[ $default_key ] ) ? $field_data[ $default_key ] : UM()->options()->get_default( $field_data[ $id_key ] ); + + if ( in_array( $field_data['type'], array( 'checkbox', 'multi_checkbox' ), true ) ) { + if ( isset( $field_data[ $value_key ] ) ) { + return $field_data[ $value_key ]; } + + $value = UM()->options()->get( $field_data[ $id_key ] ); + $value = is_string( $value ) ? stripslashes( $value ) : $value; + return '' !== $value ? $value : $default; } - } + if ( isset( $field_data[ $value_key ] ) ) { + return $field_data[ $value_key ]; + } + + $value = UM()->options()->get( $field_data[ $id_key ] ); + $value = is_string( $value ) ? stripslashes( $value ) : $value; + return isset( $value ) ? $value : $default; + } } } diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 55c150bd..6e1e3816 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -52,7 +52,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { * @param bool $echo * @return string */ - function render_form( $echo = true ) { + public function render_form( $echo = true ) { if ( empty( $this->form_data['fields'] ) ) { return ''; diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 7df53ec9..913bc1b9 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -44,15 +44,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //settings structure handlers add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) ); - add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 ); - - //enqueue wp_media for profiles tab - add_action( 'um_settings_page_appearance__before_section', array( $this, 'settings_appearance_profile_tab' ) ); + add_filter( 'um_settings_section_custom_fields', array( $this, 'email_section_custom_fields' ), 10, 2 ); //custom content for licenses tab - add_filter( 'um_settings_section_licenses__content', array( $this, 'settings_licenses_tab' ), 10, 2 ); - - add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 ); + add_filter( 'um_settings_section_licenses__custom_content', array( $this, 'settings_licenses_tab' ), 10, 3 ); + add_filter( 'um_settings_section_advanced_override_templates_custom_content', array( $this, 'settings_override_templates_tab' ), 10, 3 ); //custom content for override templates tab add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); @@ -74,12 +70,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_filter( 'um_change_settings_before_save', array( $this, 'set_default_if_empty' ), 9, 1 ); add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 ); - - add_action( 'admin_init', array( &$this, 'um_download_install_info' ) ); } - public function same_page_update_ajax() { UM()->admin()->check_ajax_nonce(); @@ -1942,14 +1935,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $settings; } - /** * @param $tab * @param $section * * @return array */ - function get_section_fields( $tab, $section ) { + public function get_section_fields( $tab, $section ) { + $custom_section_fields = apply_filters( 'um_settings_section_custom_fields', false, $tab, $section ); + if ( false !== $custom_section_fields ) { + return $custom_section_fields; + } if ( empty( $this->settings_structure[ $tab ] ) ) { return array(); @@ -1957,7 +1953,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) { return $this->settings_structure[ $tab ]['sections'][ $section ]['fields']; - } elseif ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) { + } + + if ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) { return $this->settings_structure[ $tab ]['fields']; } @@ -1971,10 +1969,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); - echo '

' . esc_html__( 'Ultimate Member - Settings', 'ultimate-member' ) . '

'; + $custom_content = apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_custom_content', false, $current_tab, $current_subtab ); + + if ( false === $custom_content ) { + $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); + $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab ); + } else { + $settings_section = $custom_content; + } + + echo '

' . esc_html__( 'Ultimate Member - Settings', 'ultimate-member' ) . '

'; echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab ); + echo '
'; /** * UM hook * @@ -1992,122 +2000,55 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { * } * ?> */ - do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" ); - - if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) { - - /** - * UM hook - * - * @type action - * @title um_settings_page_{$current_tab}_{$current_subtab}_before_section - * @description Show some content before section content at settings page - * @change_log - * ["Since: 2.0"] - * @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 ); - * @example - * - */ - do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); - - $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); - $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab ); - - /** - * UM hook - * - * @type filter - * @title um_settings_section_{$current_tab}_{$current_subtab}_content - * - * @description Render settings section - * @input_vars - * [{"var":"$content","type":"string","desc":"Section content"}, - * {"var":"$section_fields","type":"array","desc":"Section Fields"}] - * @change_log - * ["Since: 2.0"] - * @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 ); - * @example - * - */ - echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', - $settings_section, - $section_fields - ); - - } else { ?> + do_action( "um_settings_page_before_{$current_tab}_{$current_subtab}_content" ); + $form_wrapper = true; + if ( in_array( $current_tab, array( 'licenses', 'install_info' ), true ) ) { + $form_wrapper = false; + } + if ( 'advanced' === $current_tab && 'override_templates' === $current_subtab ) { + $form_wrapper = false; + } + $form_wrapper = apply_filters( 'um_settings_default_form_wrapper', $form_wrapper, $current_tab, $current_subtab ); + if ( $form_wrapper ) { + ?>
- */ - do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); + } - $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); - $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab ); - - /** - * UM hook - * - * @type filter - * @title um_settings_section_{$current_tab}_{$current_subtab}_content - * @description Render settings section - * @input_vars - * [{"var":"$content","type":"string","desc":"Section content"}, - * {"var":"$section_fields","type":"array","desc":"Section Fields"}] - * @change_log - * ["Since: 2.0"] - * @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 ); - * @example - * - */ - echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', - $settings_section, - $section_fields - ); ?> + /** + * UM hook + * + * @type action + * @title um_settings_page_{$current_tab}_{$current_subtab}_before_section + * @description Show some content before section content at settings page + * @change_log + * ["Since: 2.0"] + * @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 ); + * @example + * + */ + do_action( "um_settings_page_{$current_tab}_{$current_subtab}_before_section" ); + echo $settings_section; + if ( $form_wrapper ) { + $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); + ?>

- - +

- - '; + $tabs = ''; } /** @@ -2215,7 +2156,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return ''; } - return '
    ' . implode( ' | ', $subtabs ) . '
'; + return '
  • ' . implode( ' |
  • ', $subtabs ) . '
'; } /** @@ -2541,12 +2482,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } } - } } } - /** * */ @@ -2560,7 +2499,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - /** * */ @@ -2591,13 +2529,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } $item_name = false; - $version = false; - $author = false; + $version = false; + $author = false; foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) { if ( $field_data['id'] == $key ) { $item_name = ! empty( $field_data['item_name'] ) ? $field_data['item_name'] : false; - $version = ! empty( $field_data['version'] ) ? $field_data['version'] : false; - $author = ! empty( $field_data['author'] ) ? $field_data['author'] : false; + $version = ! empty( $field_data['version'] ) ? $field_data['version'] : false; + $author = ! empty( $field_data['author'] ) ? $field_data['author'] : false; } } @@ -2615,7 +2553,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'timeout' => UM()->request_timeout, 'sslverify' => false, - 'body' => $api_params + 'body' => $api_params, ) ); @@ -2627,7 +2565,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'timeout' => UM()->request_timeout, 'sslverify' => true, - 'body' => $api_params + 'body' => $api_params, ) ); @@ -2638,17 +2576,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $request = ( $request ) ? maybe_unserialize( $request ) : false; - if ( $edd_action == 'activate_license' || $edd_action == 'check_license' ) { + if ( in_array( $edd_action, array( 'activate_license', 'check_license' ), true ) ) { update_option( "{$key}_edd_answer", $request ); } else { delete_option( "{$key}_edd_answer" ); } - } } /** - * + * Adds email notifications list table before the email options list. */ public function settings_before_email_tab() { $email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] ); @@ -2660,16 +2597,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } /** - * @param $section + * Set settings field per email notification. * - * @return string + * @param bool $section_fields + * @param string $tab + * + * @return bool|array */ - function settings_email_tab( $section ) { + public function email_section_custom_fields( $section_fields, $tab ) { + if ( 'email' !== $tab ) { + return $section_fields; + } + $email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] ); - $emails = UM()->config()->email_notifications; + $emails = UM()->config()->email_notifications; if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) { - return $section; + return $section_fields; } $in_theme = UM()->mail()->template_in_theme( $email_key ); @@ -2724,37 +2668,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { * } * ?> */ - $section_fields = apply_filters( 'um_admin_settings_email_section_fields', $section_fields, $email_key ); - - return $this->render_settings_section( $section_fields, 'email', $email_key ); + return apply_filters( 'um_admin_settings_email_section_fields', $section_fields, $email_key ); } /** + * @param bool $html + * @param string $current_tab + * @param string $current_subtab * + * @return bool|string */ - function settings_appearance_profile_tab() { - wp_enqueue_media(); - } + public function settings_licenses_tab( $html, $current_tab, $current_subtab ) { + $section_fields = $this->get_section_fields( $current_tab, $current_subtab ); + if ( empty( $section_fields ) ) { + return $html; + } - /** - * @param $html - * @param $section_fields - * - * @return string - */ - public function settings_licenses_tab( $html, $section_fields ) { + $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ob_start(); ?>
- - - options()->get( $field_data['id'] ); - $value = isset( $option_value ) && ! empty( $option_value ) ? $option_value : ( isset( $field_data['default'] ) ? $field_data['default'] : '' ); + $value = isset( $option_value ) && ! empty( $option_value ) ? $option_value : ( isset( $field_data['default'] ) ? $field_data['default'] : '' ); $license = get_option( "{$field_data['id']}_edd_answer" ); @@ -2981,7 +2920,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { - Override Templates tab. * @return void */ - public function settings_override_templates_tab() { + public function settings_override_templates_tab( $html, $current_tab, $current_subtab ) { $um_check_version = get_transient( 'um_check_template_versions' ); $check_url = add_query_arg( @@ -3054,6 +2992,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { '_wpnonce' => wp_create_nonce( 'check_templates_version' ), ) ); + ob_start(); ?>

@@ -3079,8 +3018,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { Name . ' ' . $theme_data->Version; - - // Identify Hosting Provider - $host = um_get_host(); - - um_fetch_user( get_current_user_id() ); - - if ( isset( $this->content ) ) { - echo $this->content; - } else { ?> - -

Install Info

- - - -

- - - -

- - - getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { - * echo 'You have FireFox version 2 or greater'; - * } - * - * User Agents Sampled from: http://www.useragentstring.com/ - * - * This implementation is based on the original work from Gary White - * http://apptools.com/phptools/browser/ - * - * UPDATES: - * - * 2010-08-20 (v1.9): - * + Added MSN Explorer Browser (legacy) - * + Added Bing/MSN Robot (Thanks Rob MacDonald) - * + Added the Android Platform (PLATFORM_ANDROID) - * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima) - * - * 2010-04-27 (v1.8): - * + Added iPad Support - * - * 2010-03-07 (v1.7): - * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s)) - * + Almost allof Gary's original code has been replaced - * + Large PHPUNIT testing environment created to validate new releases and additions - * + Added FreeBSD Platform - * + Added OpenBSD Platform - * + Added NetBSD Platform - * + Added SunOS Platform - * + Added OpenSolaris Platform - * + Added support of the Iceweazel Browser - * + Added isChromeFrame() call to check if chromeframe is in use - * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents - * + Added the __toString() method (Thanks Deano) - * - * 2009-11-15: - * + Updated the checkes for Firefox - * + Added the NOKIA platform - * + Added Checks for the NOKIA brower(s) - * - * 2009-11-08: - * + PHP 5.3 Support - * + Added support for BlackBerry OS and BlackBerry browser - * + Added support for the Opera Mini browser - * + Added additional documenation - * + Added support for isRobot() and isMobile() - * + Added support for Opera version 10 - * + Added support for deprecated Netscape Navigator version 9 - * + Added support for IceCat - * + Added support for Shiretoko - * - * 2010-04-27 (v1.8): - * + Added iPad Support - * - * 2009-08-18: - * + Updated to support PHP 5.3 - removed all deprecated function calls - * + Updated to remove all double quotes (") -- converted to single quotes (') - * - * 2009-04-27: - * + Updated the IE check to remove a typo and bug (thanks John) - * - * 2009-04-22: - * + Added detection for GoogleBot - * + Added detection for the W3C Validator. - * + Added detection for Yahoo! Slurp - * - * 2009-03-14: - * + Added detection for iPods. - * + Added Platform detection for iPhones - * + Added Platform detection for iPods - * - * 2009-02-16: (Rick Hale) - * + Added version detection for Android phones. - * - * 2008-12-09: - * + Removed unused constant - * - * 2008-11-07: - * + Added Google's Chrome to the detection list - * + Added isBrowser(string) to the list of functions special thanks to - * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au) - * - * - * Gary White noted: "Since browser detection is so unreliable, I am - * no longer maintaining this script. You are free to use and or - * modify/update it as you want, however the author assumes no - * responsibility for the accuracy of the detected values." - * - * Anyone experienced with Gary's script might be interested in these notes: - * - * Added class constants - * Added detection and version detection for Google's Chrome - * Updated the version detection for Amaya - * Updated the version detection for Firefox - * Updated the version detection for Lynx - * Updated the version detection for WebTV - * Updated the version detection for NetPositive - * Updated the version detection for IE - * Updated the version detection for OmniWeb - * Updated the version detection for iCab - * Updated the version detection for Safari - * Updated Safari to remove mobile devices (iPhone) - * Added detection for iPhone - * Added detection for robots - * Added detection for mobile devices - * Added detection for BlackBerry - * Removed Netscape checks (matches heavily with firefox & mozilla) - * - */ - -class Browser { - public $_agent = ''; - public $_browser_name = ''; - public $_version = ''; - public $_platform = ''; - public $_os = ''; - public $_is_aol = false; - public $_is_mobile = false; - public $_is_robot = false; - public $_aol_version = ''; - - public $BROWSER_UNKNOWN = 'unknown'; - public $VERSION_UNKNOWN = 'unknown'; - - public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/ - public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/ - public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/ - public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/ - public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile - public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/ - public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/ - public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/ - public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/ - public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html - public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/ - public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko - public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/ - public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/ - public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx - public $BROWSER_SAFARI = 'Safari'; // Http://apple.com - public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com - public $BROWSER_IPOD = 'iPod'; // Http://apple.com - public $BROWSER_IPAD = 'iPad'; // Http://apple.com - public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome - public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/ - public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot - public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp - public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/ - public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/ - public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat - public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60 - public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform - public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/ - public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm - // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well) - - public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED) - public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED) - public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) - public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) - - public $PLATFORM_UNKNOWN = 'unknown'; - public $PLATFORM_WINDOWS = 'Windows'; - public $PLATFORM_WINDOWS_CE = 'Windows CE'; - public $PLATFORM_APPLE = 'Apple'; - public $PLATFORM_LINUX = 'Linux'; - public $PLATFORM_OS2 = 'OS/2'; - public $PLATFORM_BEOS = 'BeOS'; - public $PLATFORM_IPHONE = 'iPhone'; - public $PLATFORM_IPOD = 'iPod'; - public $PLATFORM_IPAD = 'iPad'; - public $PLATFORM_BLACKBERRY = 'BlackBerry'; - public $PLATFORM_NOKIA = 'Nokia'; - public $PLATFORM_FREEBSD = 'FreeBSD'; - public $PLATFORM_OPENBSD = 'OpenBSD'; - public $PLATFORM_NETBSD = 'NetBSD'; - public $PLATFORM_SUNOS = 'SunOS'; - public $PLATFORM_OPENSOLARIS = 'OpenSolaris'; - public $PLATFORM_ANDROID = 'Android'; - - public $OPERATING_SYSTEM_UNKNOWN = 'unknown'; - - function __construct( $useragent="" ) { - $this->reset(); - if ( $useragent != "" ) { - $this->setUserAgent( $useragent ); - } else { - $this->determine(); - } - } - - /** - * Reset all properties - */ - function reset() { - $this->_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ""; - $this->_browser_name = $this->BROWSER_UNKNOWN; - $this->_version = $this->VERSION_UNKNOWN; - $this->_platform = $this->PLATFORM_UNKNOWN; - $this->_os = $this->OPERATING_SYSTEM_UNKNOWN; - $this->_is_aol = false; - $this->_is_mobile = false; - $this->_is_robot = false; - $this->_aol_version = $this->VERSION_UNKNOWN; - } - - /** - * Check to see if the specific browser is valid - * - * @param string $browserName - * @return True if the browser is the specified browser - */ - function isBrowser( $browserName ) { return 0 == strcasecmp( $this->_browser_name, trim( $browserName ) ); } - - /** - * The name of the browser. All return types are from the class contants - * - * @return string Name of the browser - */ - function getBrowser() { return $this->_browser_name; } - /** - * Set the name of the browser - * - * @param unknown $browser The name of the Browser - */ - function setBrowser( $browser ) { return $this->_browser_name = $browser; } - /** - * The name of the platform. All return types are from the class contants - * - * @return string Name of the browser - */ - function getPlatform() { return $this->_platform; } - /** - * Set the name of the platform - * - * @param unknown $platform The name of the Platform - */ - function setPlatform( $platform ) { return $this->_platform = $platform; } - /** - * The version of the browser. - * - * @return string Version of the browser (will only contain alpha-numeric characters and a period) - */ - function getVersion() { return $this->_version; } - /** - * Set the version of the browser - * - * @param unknown $version The version of the Browser - */ - function setVersion( $version ) { $this->_version = preg_replace( '/[^0-9,.,a-z,A-Z-]/', '', $version ); } - /** - * The version of AOL. - * - * @return string Version of AOL (will only contain alpha-numeric characters and a period) - */ - function getAolVersion() { return $this->_aol_version; } - /** - * Set the version of AOL - * - * @param unknown $version The version of AOL - */ - function setAolVersion( $version ) { $this->_aol_version = preg_replace( '/[^0-9,.,a-z,A-Z]/', '', $version ); } - /** - * Is the browser from AOL? - * - * @return boolean True if the browser is from AOL otherwise false - */ - function isAol() { return $this->_is_aol; } - /** - * Is the browser from a mobile device? - * - * @return boolean True if the browser is from a mobile device otherwise false - */ - function isMobile() { return $this->_is_mobile; } - /** - * Is the browser from a robot (ex Slurp,GoogleBot)? - * - * @return boolean True if the browser is from a robot otherwise false - */ - function isRobot() { return $this->_is_robot; } - /** - * Set the browser to be from AOL - * - * @param unknown $isAol - */ - function setAol( $isAol ) { $this->_is_aol = $isAol; } - /** - * Set the Browser to be mobile - * - * @param boolean $value is the browser a mobile brower or not - */ - function setMobile( $value=true ) { $this->_is_mobile = $value; } - /** - * Set the Browser to be a robot - * - * @param boolean $value is the browser a robot or not - */ - function setRobot( $value=true ) { $this->_is_robot = $value; } - /** - * Get the user agent value in use to determine the browser - * - * @return string The user agent from the HTTP header - */ - function getUserAgent() { return $this->_agent; } - /** - * Set the user agent value (the construction will use the HTTP header value - this will overwrite it) - * - * @param unknown $agent_string The value for the User Agent - */ - function setUserAgent( $agent_string ) { - $this->reset(); - $this->_agent = $agent_string; - $this->determine(); - } - /** - * Used to determine if the browser is actually "chromeframe" - * - * @since 1.7 - * @return boolean True if the browser is using chromeframe - */ - function isChromeFrame() { - return strpos( $this->_agent, "chromeframe" ) !== false; - } - /** - * Returns a formatted string with a summary of the details of the browser. - * - * @return string formatted string with a summary of the browser - */ - function __toString() { - $text1 = $this->getUserAgent(); //grabs the UA (user agent) string - $UAline1 = substr( $text1, 0, 32 ); //the first line we print should only be the first 32 characters of the UA string - $text2 = $this->getUserAgent();//now we grab it again and save it to a string - $towrapUA = str_replace( $UAline1, '', $text2 );//the rest of the printoff (other than first line) is equivolent - // To the whole string minus the part we printed off. IE - // User Agent: thefirst32charactersfromUAline1 - // the rest of it is now stored in - // $text2 to be printed off - // But we need to add spaces before each line that is split other than line 1 - $space = ''; - for ( $i = 0; $i < 25; $i++ ) { - $space .= ' '; - } - // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting - $wordwrapped = chunk_split( $towrapUA, 32, "\n $space" ); - return "Platform: {$this->getPlatform()} \n". - "Browser Name: {$this->getBrowser()} \n" . - "Browser Version: {$this->getVersion()} \n" . - "User Agent String: $UAline1 \n\t\t\t " . - "$wordwrapped"; - } - /** - * Protected routine to calculate and determine what the browser is in use (including platform) - */ - function determine() { - $this->checkPlatform(); - $this->checkBrowsers(); - $this->checkForAol(); - } - /** - * Protected routine to determine the browser type - * - * @return boolean True if the browser was detected otherwise false - */ - function checkBrowsers() { - return ( - // Well-known, well-used - // Special Notes: - // (1) Opera must be checked before FireFox due to the odd - // user agents used in some older versions of Opera - // (2) WebTV is strapped onto Internet Explorer so we must - // check for WebTV before IE - // (3) (deprecated) Galeon is based on Firefox and needs to be - // tested before Firefox is tested - // (4) OmniWeb is based on Safari so OmniWeb check must occur - // before Safari - // (5) Netscape 9+ is based on Firefox so Netscape checks - // before FireFox are necessary - $this->checkBrowserWebTv() || - $this->checkBrowserInternetExplorer() || - $this->checkBrowserOpera() || - $this->checkBrowserGaleon() || - $this->checkBrowserNetscapeNavigator9Plus() || - $this->checkBrowserFirefox() || - $this->checkBrowserChrome() || - $this->checkBrowserOmniWeb() || - - // Common mobile - $this->checkBrowserAndroid() || - $this->checkBrowseriPad() || - $this->checkBrowseriPod() || - $this->checkBrowseriPhone() || - $this->checkBrowserBlackBerry() || - $this->checkBrowserNokia() || - - // Common bots - $this->checkBrowserGoogleBot() || - $this->checkBrowserMSNBot() || - $this->checkBrowserSlurp() || - - // WebKit base check (post mobile and others) - $this->checkBrowserSafari() || - - // Everyone else - $this->checkBrowserNetPositive() || - $this->checkBrowserFirebird() || - $this->checkBrowserKonqueror() || - $this->checkBrowserIcab() || - $this->checkBrowserPhoenix() || - $this->checkBrowserAmaya() || - $this->checkBrowserLynx() || - - $this->checkBrowserShiretoko() || - $this->checkBrowserIceCat() || - $this->checkBrowserW3CValidator() || - $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */ - ); - } - - /** - * Determine if the user is using a BlackBerry (last updated 1.7) - * - * @return boolean True if the browser is the BlackBerry browser otherwise false - */ - function checkBrowserBlackBerry() { - if ( stripos( $this->_agent, 'blackberry' ) !== false ) { - $aresult = explode( "/", stristr( $this->_agent, "BlackBerry" ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->_browser_name = $this->BROWSER_BLACKBERRY; - $this->setMobile( true ); - return true; - } - return false; - } - - /** - * Determine if the user is using an AOL User Agent (last updated 1.7) - * - * @return boolean True if the browser is from AOL otherwise false - */ - function checkForAol() { - $this->setAol( false ); - $this->setAolVersion( $this->VERSION_UNKNOWN ); - - if ( stripos( $this->_agent, 'aol' ) !== false ) { - $aversion = explode( ' ', stristr( $this->_agent, 'AOL' ) ); - $this->setAol( true ); - $this->setAolVersion( preg_replace( '/[^0-9\.a-z]/i', '', $aversion[1] ) ); - return true; - } - return false; - } - - /** - * Determine if the browser is the GoogleBot or not (last updated 1.7) - * - * @return boolean True if the browser is the GoogletBot otherwise false - */ - function checkBrowserGoogleBot() { - if ( stripos( $this->_agent, 'googlebot' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'googlebot' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( str_replace( ';', '', $aversion[0] ) ); - $this->_browser_name = $this->BROWSER_GOOGLEBOT; - $this->setRobot( true ); - return true; - } - return false; - } - - /** - * Determine if the browser is the MSNBot or not (last updated 1.9) - * - * @return boolean True if the browser is the MSNBot otherwise false - */ - function checkBrowserMSNBot() { - if ( stripos( $this->_agent, "msnbot" ) !== false ) { - $aresult = explode( "/", stristr( $this->_agent, "msnbot" ) ); - $aversion = explode( " ", $aresult[1] ); - $this->setVersion( str_replace( ";", "", $aversion[0] ) ); - $this->_browser_name = $this->BROWSER_MSNBOT; - $this->setRobot( true ); - return true; - } - return false; - } - - /** - * Determine if the browser is the W3C Validator or not (last updated 1.7) - * - * @return boolean True if the browser is the W3C Validator otherwise false - */ - function checkBrowserW3CValidator() { - if ( stripos( $this->_agent, 'W3C-checklink' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'W3C-checklink' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->_browser_name = $this->BROWSER_W3CVALIDATOR; - return true; - } else if ( stripos( $this->_agent, 'W3C_Validator' ) !== false ) { - // Some of the Validator versions do not delineate w/ a slash - add it back in - $ua = str_replace( "W3C_Validator ", "W3C_Validator/", $this->_agent ); - $aresult = explode( '/', stristr( $ua, 'W3C_Validator' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->_browser_name = $this->BROWSER_W3CVALIDATOR; - return true; - } - return false; - } - - /** - * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) - * - * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false - */ - function checkBrowserSlurp() { - if ( stripos( $this->_agent, 'slurp' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Slurp' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->_browser_name = $this->BROWSER_SLURP; - $this->setRobot( true ); - $this->setMobile( false ); - return true; - } - return false; - } - - /** - * Determine if the browser is Internet Explorer or not (last updated 1.7) - * - * @return boolean True if the browser is Internet Explorer otherwise false - */ - function checkBrowserInternetExplorer() { - - // Test for v1 - v1.5 IE - if ( stripos( $this->_agent, 'microsoft internet explorer' ) !== false ) { - $this->setBrowser( $this->BROWSER_IE ); - $this->setVersion( '1.0' ); - $aresult = stristr( $this->_agent, '/' ); - if ( preg_match( '/308|425|426|474|0b1/i', $aresult ) ) { - $this->setVersion( '1.5' ); - } - return true; - } - // Test for versions > 1.5 - else if ( stripos( $this->_agent, 'msie' ) !== false && stripos( $this->_agent, 'opera' ) === false ) { - // See if the browser is the odd MSN Explorer - if ( stripos( $this->_agent, 'msnb' ) !== false ) { - $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'MSN' ) ); - $this->setBrowser( $this->BROWSER_MSN ); - $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) ); - return true; - } - $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'msie' ) ); - $this->setBrowser( $this->BROWSER_IE ); - $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) ); - return true; - } - // Test for Pocket IE - else if ( stripos( $this->_agent, 'mspie' ) !== false || stripos( $this->_agent, 'pocket' ) !== false ) { - $aresult = explode( ' ', stristr( $this->_agent, 'mspie' ) ); - $this->setPlatform( $this->PLATFORM_WINDOWS_CE ); - $this->setBrowser( $this->BROWSER_POCKET_IE ); - $this->setMobile( true ); - - if ( stripos( $this->_agent, 'mspie' ) !== false ) { - $this->setVersion( $aresult[1] ); - } else { - $aversion = explode( '/', $this->_agent ); - $this->setVersion( $aversion[1] ); - } - return true; - } - return false; - } - - /** - * Determine if the browser is Opera or not (last updated 1.7) - * - * @return boolean True if the browser is Opera otherwise false - */ - function checkBrowserOpera() { - if ( stripos( $this->_agent, 'opera mini' ) !== false ) { - $resultant = stristr( $this->_agent, 'opera mini' ); - if ( preg_match( '/\//', $resultant ) ) { - $aresult = explode( '/', $resultant ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $aversion = explode( ' ', stristr( $resultant, 'opera mini' ) ); - $this->setVersion( $aversion[1] ); - } - $this->_browser_name = $this->BROWSER_OPERA_MINI; - $this->setMobile( true ); - return true; - } else if ( stripos( $this->_agent, 'opera' ) !== false ) { - $resultant = stristr( $this->_agent, 'opera' ); - if ( preg_match( '/Version\/(10.*)$/', $resultant, $matches ) ) { - $this->setVersion( $matches[1] ); - } else if ( preg_match( '/\//', $resultant ) ) { - $aresult = explode( '/', str_replace( "(", " ", $resultant ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $aversion = explode( ' ', stristr( $resultant, 'opera' ) ); - $this->setVersion( isset( $aversion[1] )?$aversion[1]:"" ); - } - $this->_browser_name = $this->BROWSER_OPERA; - return true; - } - return false; - } - - /** - * Determine if the browser is Chrome or not (last updated 1.7) - * - * @return boolean True if the browser is Chrome otherwise false - */ - function checkBrowserChrome() { - if ( stripos( $this->_agent, 'Chrome' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Chrome' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_CHROME ); - return true; - } - return false; - } - - - /** - * Determine if the browser is WebTv or not (last updated 1.7) - * - * @return boolean True if the browser is WebTv otherwise false - */ - function checkBrowserWebTv() { - if ( stripos( $this->_agent, 'webtv' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'webtv' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_WEBTV ); - return true; - } - return false; - } - - /** - * Determine if the browser is NetPositive or not (last updated 1.7) - * - * @return boolean True if the browser is NetPositive otherwise false - */ - function checkBrowserNetPositive() { - if ( stripos( $this->_agent, 'NetPositive' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'NetPositive' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aversion[0] ) ); - $this->setBrowser( $this->BROWSER_NETPOSITIVE ); - return true; - } - return false; - } - - /** - * Determine if the browser is Galeon or not (last updated 1.7) - * - * @return boolean True if the browser is Galeon otherwise false - */ - function checkBrowserGaleon() { - if ( stripos( $this->_agent, 'galeon' ) !== false ) { - $aresult = explode( ' ', stristr( $this->_agent, 'galeon' ) ); - $aversion = explode( '/', $aresult[0] ); - $this->setVersion( $aversion[1] ); - $this->setBrowser( $this->BROWSER_GALEON ); - return true; - } - return false; - } - - /** - * Determine if the browser is Konqueror or not (last updated 1.7) - * - * @return boolean True if the browser is Konqueror otherwise false - */ - function checkBrowserKonqueror() { - if ( stripos( $this->_agent, 'Konqueror' ) !== false ) { - $aresult = explode( ' ', stristr( $this->_agent, 'Konqueror' ) ); - $aversion = explode( '/', $aresult[0] ); - $this->setVersion( $aversion[1] ); - $this->setBrowser( $this->BROWSER_KONQUEROR ); - return true; - } - return false; - } - - /** - * Determine if the browser is iCab or not (last updated 1.7) - * - * @return boolean True if the browser is iCab otherwise false - */ - function checkBrowserIcab() { - if ( stripos( $this->_agent, 'icab' ) !== false ) { - $aversion = explode( ' ', stristr( str_replace( '/', ' ', $this->_agent ), 'icab' ) ); - $this->setVersion( $aversion[1] ); - $this->setBrowser( $this->BROWSER_ICAB ); - return true; - } - return false; - } - - /** - * Determine if the browser is OmniWeb or not (last updated 1.7) - * - * @return boolean True if the browser is OmniWeb otherwise false - */ - function checkBrowserOmniWeb() { - if ( stripos( $this->_agent, 'omniweb' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'omniweb' ) ); - $aversion = explode( ' ', isset( $aresult[1] )?$aresult[1]:"" ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_OMNIWEB ); - return true; - } - return false; - } - - /** - * Determine if the browser is Phoenix or not (last updated 1.7) - * - * @return boolean True if the browser is Phoenix otherwise false - */ - function checkBrowserPhoenix() { - if ( stripos( $this->_agent, 'Phoenix' ) !== false ) { - $aversion = explode( '/', stristr( $this->_agent, 'Phoenix' ) ); - $this->setVersion( $aversion[1] ); - $this->setBrowser( $this->BROWSER_PHOENIX ); - return true; - } - return false; - } - - /** - * Determine if the browser is Firebird or not (last updated 1.7) - * - * @return boolean True if the browser is Firebird otherwise false - */ - function checkBrowserFirebird() { - if ( stripos( $this->_agent, 'Firebird' ) !== false ) { - $aversion = explode( '/', stristr( $this->_agent, 'Firebird' ) ); - $this->setVersion( $aversion[1] ); - $this->setBrowser( $this->BROWSER_FIREBIRD ); - return true; - } - return false; - } - - /** - * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) - * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) - * - * @return boolean True if the browser is Netscape Navigator 9+ otherwise false - */ - function checkBrowserNetscapeNavigator9Plus() { - if ( stripos( $this->_agent, 'Firefox' ) !== false && preg_match( '/Navigator\/([^ ]*)/i', $this->_agent, $matches ) ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR ); - return true; - } else if ( stripos( $this->_agent, 'Firefox' ) === false && preg_match( '/Netscape6?\/([^ ]*)/i', $this->_agent, $matches ) ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR ); - return true; - } - return false; - } - - /** - * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) - * - * @return boolean True if the browser is Shiretoko otherwise false - */ - function checkBrowserShiretoko() { - if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/Shiretoko\/([^ ]*)/i', $this->_agent, $matches ) ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_SHIRETOKO ); - return true; - } - return false; - } - - /** - * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) - * - * @return boolean True if the browser is Ice Cat otherwise false - */ - function checkBrowserIceCat() { - if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/IceCat\/([^ ]*)/i', $this->_agent, $matches ) ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_ICECAT ); - return true; - } - return false; - } - - /** - * Determine if the browser is Nokia or not (last updated 1.7) - * - * @return boolean True if the browser is Nokia otherwise false - */ - function checkBrowserNokia() { - if ( preg_match( "/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches ) ) { - $this->setVersion( $matches[2] ); - if ( stripos( $this->_agent, 'Series60' ) !== false || strpos( $this->_agent, 'S60' ) !== false ) { - $this->setBrowser( $this->BROWSER_NOKIA_S60 ); - } else { - $this->setBrowser( $this->BROWSER_NOKIA ); - } - $this->setMobile( true ); - return true; - } - return false; - } - - /** - * Determine if the browser is Firefox or not (last updated 1.7) - * - * @return boolean True if the browser is Firefox otherwise false - */ - function checkBrowserFirefox() { - if ( stripos( $this->_agent, 'safari' ) === false ) { - if ( preg_match( "/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches ) ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_FIREFOX ); - return true; - } else if ( preg_match( "/Firefox$/i", $this->_agent, $matches ) ) { - $this->setVersion( "" ); - $this->setBrowser( $this->BROWSER_FIREFOX ); - return true; - } - } - return false; - } - - /** - * Determine if the browser is Firefox or not (last updated 1.7) - * - * @return boolean True if the browser is Firefox otherwise false - */ - function checkBrowserIceweasel() { - if ( stripos( $this->_agent, 'Iceweasel' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Iceweasel' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_ICEWEASEL ); - return true; - } - return false; - } - /** - * Determine if the browser is Mozilla or not (last updated 1.7) - * - * @return boolean True if the browser is Mozilla otherwise false - */ - function checkBrowserMozilla() { - if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) { - $aversion = explode( ' ', stristr( $this->_agent, 'rv:' ) ); - preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion ); - $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) ); - $this->setBrowser( $this->BROWSER_MOZILLA ); - return true; - } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9]\.[0-9]/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) { - $aversion = explode( '', stristr( $this->_agent, 'rv:' ) ); - $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) ); - $this->setBrowser( $this->BROWSER_MOZILLA ); - return true; - } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/mozilla\/([^ ]*)/i', $this->_agent, $matches ) && stripos( $this->_agent, 'netscape' ) === false ) { - $this->setVersion( $matches[1] ); - $this->setBrowser( $this->BROWSER_MOZILLA ); - return true; - } - return false; - } - - /** - * Determine if the browser is Lynx or not (last updated 1.7) - * - * @return boolean True if the browser is Lynx otherwise false - */ - function checkBrowserLynx() { - if ( stripos( $this->_agent, 'lynx' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Lynx' ) ); - $aversion = explode( ' ', ( isset( $aresult[1] )?$aresult[1]:"" ) ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_LYNX ); - return true; - } - return false; - } - - /** - * Determine if the browser is Amaya or not (last updated 1.7) - * - * @return boolean True if the browser is Amaya otherwise false - */ - function checkBrowserAmaya() { - if ( stripos( $this->_agent, 'amaya' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Amaya' ) ); - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - $this->setBrowser( $this->BROWSER_AMAYA ); - return true; - } - return false; - } - - /** - * Determine if the browser is Safari or not (last updated 1.7) - * - * @return boolean True if the browser is Safari otherwise false - */ - function checkBrowserSafari() { - if ( stripos( $this->_agent, 'Safari' ) !== false && stripos( $this->_agent, 'iPhone' ) === false && stripos( $this->_agent, 'iPod' ) === false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); - if ( isset( $aresult[1] ) ) { - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $this->setVersion( $this->VERSION_UNKNOWN ); - } - $this->setBrowser( $this->BROWSER_SAFARI ); - return true; - } - return false; - } - - /** - * Determine if the browser is iPhone or not (last updated 1.7) - * - * @return boolean True if the browser is iPhone otherwise false - */ - function checkBrowseriPhone() { - if ( stripos( $this->_agent, 'iPhone' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); - if ( isset( $aresult[1] ) ) { - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $this->setVersion( $this->VERSION_UNKNOWN ); - } - $this->setMobile( true ); - $this->setBrowser( $this->BROWSER_IPHONE ); - return true; - } - return false; - } - - /** - * Determine if the browser is iPod or not (last updated 1.7) - * - * @return boolean True if the browser is iPod otherwise false - */ - function checkBrowseriPad() { - if ( stripos( $this->_agent, 'iPad' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); - if ( isset( $aresult[1] ) ) { - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $this->setVersion( $this->VERSION_UNKNOWN ); - } - $this->setMobile( true ); - $this->setBrowser( $this->BROWSER_IPAD ); - return true; - } - return false; - } - - /** - * Determine if the browser is iPod or not (last updated 1.7) - * - * @return boolean True if the browser is iPod otherwise false - */ - function checkBrowseriPod() { - if ( stripos( $this->_agent, 'iPod' ) !== false ) { - $aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); - if ( isset( $aresult[1] ) ) { - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $this->setVersion( $this->VERSION_UNKNOWN ); - } - $this->setMobile( true ); - $this->setBrowser( $this->BROWSER_IPOD ); - return true; - } - return false; - } - - /** - * Determine if the browser is Android or not (last updated 1.7) - * - * @return boolean True if the browser is Android otherwise false - */ - function checkBrowserAndroid() { - if ( stripos( $this->_agent, 'Android' ) !== false ) { - $aresult = explode( ' ', stristr( $this->_agent, 'Android' ) ); - if ( isset( $aresult[1] ) ) { - $aversion = explode( ' ', $aresult[1] ); - $this->setVersion( $aversion[0] ); - } else { - $this->setVersion( $this->VERSION_UNKNOWN ); - } - $this->setMobile( true ); - $this->setBrowser( $this->BROWSER_ANDROID ); - return true; - } - return false; - } - - /** - * Determine the user's platform (last updated 1.7) - */ - function checkPlatform() { - if ( stripos( $this->_agent, 'windows' ) !== false ) { - $this->_platform = $this->PLATFORM_WINDOWS; - } else if ( stripos( $this->_agent, 'iPad' ) !== false ) { - $this->_platform = $this->PLATFORM_IPAD; - } else if ( stripos( $this->_agent, 'iPod' ) !== false ) { - $this->_platform = $this->PLATFORM_IPOD; - } else if ( stripos( $this->_agent, 'iPhone' ) !== false ) { - $this->_platform = $this->PLATFORM_IPHONE; - } elseif ( stripos( $this->_agent, 'mac' ) !== false ) { - $this->_platform = $this->PLATFORM_APPLE; - } elseif ( stripos( $this->_agent, 'android' ) !== false ) { - $this->_platform = $this->PLATFORM_ANDROID; - } elseif ( stripos( $this->_agent, 'linux' ) !== false ) { - $this->_platform = $this->PLATFORM_LINUX; - } else if ( stripos( $this->_agent, 'Nokia' ) !== false ) { - $this->_platform = $this->PLATFORM_NOKIA; - } else if ( stripos( $this->_agent, 'BlackBerry' ) !== false ) { - $this->_platform = $this->PLATFORM_BLACKBERRY; - } elseif ( stripos( $this->_agent, 'FreeBSD' ) !== false ) { - $this->_platform = $this->PLATFORM_FREEBSD; - } elseif ( stripos( $this->_agent, 'OpenBSD' ) !== false ) { - $this->_platform = $this->PLATFORM_OPENBSD; - } elseif ( stripos( $this->_agent, 'NetBSD' ) !== false ) { - $this->_platform = $this->PLATFORM_NETBSD; - } elseif ( stripos( $this->_agent, 'OpenSolaris' ) !== false ) { - $this->_platform = $this->PLATFORM_OPENSOLARIS; - } elseif ( stripos( $this->_agent, 'SunOS' ) !== false ) { - $this->_platform = $this->PLATFORM_SUNOS; - } elseif ( stripos( $this->_agent, 'OS\/2' ) !== false ) { - $this->_platform = $this->PLATFORM_OS2; - } elseif ( stripos( $this->_agent, 'BeOS' ) !== false ) { - $this->_platform = $this->PLATFORM_BEOS; - } elseif ( stripos( $this->_agent, 'win' ) !== false ) { - $this->_platform = $this->PLATFORM_WINDOWS; - } - - } -} \ No newline at end of file From 5f8f05e1d29655954ec8e824d6efb243f10b1340 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 1 Jan 2024 18:21:54 +0200 Subject: [PATCH 05/76] - added deprecated info text to Install Info; - transfer Secure tab to Advanced > Secure subtab; --- includes/admin/class-enqueue.php | 2 +- includes/admin/class-secure.php | 5 +- includes/admin/core/class-admin-forms.php | 2 +- includes/admin/core/class-admin-notices.php | 2 +- includes/admin/core/class-admin-settings.php | 58 ++++++++++++++++---- includes/ajax/class-secure.php | 2 +- 6 files changed, 53 insertions(+), 18 deletions(-) diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index 20c6e3da..981fba3a 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -583,7 +583,7 @@ final class Enqueue extends \um\common\Enqueue { wp_enqueue_style( 'um_admin_roles' ); } elseif ( 'ultimate-member_page_um_options' === $hook ) { // phpcs:ignore WordPress.Security.NonceVerification - if ( isset( $_GET['tab'] ) && 'secure' === $_GET['tab'] ) { + if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'secure' === $_GET['section'] ) { wp_register_script( 'um_admin_secure', $js_url . 'admin/secure' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true ); wp_set_script_translations( 'um_admin_secure', 'ultimate-member' ); wp_enqueue_script( 'um_admin_secure' ); diff --git a/includes/admin/class-secure.php b/includes/admin/class-secure.php index 09a65790..80cc3c1e 100644 --- a/includes/admin/class-secure.php +++ b/includes/admin/class-secure.php @@ -91,8 +91,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { public function admin_init() { global $wpdb; // Dismiss admin notice after the first visit to Secure settings page. - if ( isset( $_REQUEST['page'] ) && isset( $_REQUEST['tab'] ) && - 'um_options' === sanitize_key( $_REQUEST['page'] ) && 'secure' === sanitize_key( $_REQUEST['tab'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification + if ( isset( $_REQUEST['page'], $_REQUEST['tab'], $_REQUEST['section'] ) && 'um_options' === sanitize_key( $_REQUEST['page'] ) && 'advanced' === sanitize_key( $_REQUEST['tab'] ) && 'secure' === sanitize_key( $_REQUEST['section'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification UM()->admin()->notices()->dismiss( 'secure_settings' ); } @@ -297,7 +296,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { ) ); - $settings['secure'] = array( + $settings['advanced']['sections']['secure'] = array( 'title' => __( 'Secure', 'ultimate-member' ), 'fields' => $secure_fields, ); diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 6e1e3816..e04d986d 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -64,7 +64,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { ob_start(); foreach ( $this->form_data['fields'] as $field_data ) { - if ( isset( $field_data['type'] ) && 'hidden' == $field_data['type'] ) { + if ( isset( $field_data['type'] ) && 'hidden' === $field_data['type'] ) { echo $this->render_form_row( $field_data ); } } diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index a10294a4..9a251f81 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -849,7 +849,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {

- +

excluded_taxonomies(); - $all_taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), 'objects' ); + $all_taxonomies = get_taxonomies( + array( + 'public' => true, + 'show_ui' => true, + ), + 'objects' + ); foreach ( $all_taxonomies as $key => $taxonomy ) { if ( in_array( $key, $exclude_taxonomies, true ) ) { continue; @@ -446,7 +455,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - $restricted_access_taxonomy_metabox_value = array(); $restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' ); if ( ! empty( $restricted_access_taxonomy_metabox ) && is_array( $restricted_access_taxonomy_metabox ) ) { @@ -1789,7 +1797,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'licenses' => array( 'title' => __( 'Licenses', 'ultimate-member' ), ), - 'advanced' => array( + 'advanced' => array( 'title' => __( 'Advanced', 'ultimate-member' ), 'sections' => array( '' => array( @@ -1851,7 +1859,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), - 'misc' => array( + 'misc' => array( 'title' => __( 'Misc', 'ultimate-member' ), 'fields' => array( array( @@ -1891,13 +1899,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'install_info', ), ), - ), + ), // @todo remove since 2.9.0 ) ); - } - /** * @param array $settings * @@ -2980,10 +2986,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } /** - * HTML for Settings > Override Templates tab. - * @return void + * HTML for Settings > Advanced > Override Templates tab. + * + * @return string */ - public function settings_override_templates_tab( $html, $current_tab, $current_subtab ) { + public function settings_override_templates_tab() { $um_check_version = get_transient( 'um_check_template_versions' ); $check_url = add_query_arg( @@ -3022,6 +3029,35 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return ob_get_clean(); } + /** + * HTML for Settings > Install Info tab. + * + * @todo remove since 2.9.0 + * + * @return string + */ + public function settings_install_info() { + ob_start(); + ?> +

+ Info. + echo wp_kses( sprintf( __( 'This settings tab is deprecated. And it will be fully removed since 2.9.0 version. Please get the installation info from there.', 'ultimate-member' ), add_query_arg( 'tab', 'debug', admin_url( 'site-health.php' ) ) ), UM()->get_allowed_html( 'admin_notice' ) ); + ?> +

+

+ here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1879-ultimate-member-site-health' ), UM()->get_allowed_html( 'admin_notice' ) ); + ?> +

+ + ' . wp_kses( __( 'WARNING: Ensure that you\'ve created a full backup of your site as your restoration point before changing anything on your site with our recommendations.', 'ultimate-member' ), UM()->get_allowed_html( 'admin_notice' ) ) . ''; if ( $suspicious_accounts_count > 0 ) { - $lock_register_forms_url = admin_url( 'admin.php?page=um_options&tab=secure&um_secure_lock_register_forms=1&_wpnonce=' . wp_create_nonce( 'um_secure_lock_register_forms' ) ); + $lock_register_forms_url = admin_url( 'admin.php?page=um_options&tab=advanced§ion=secure&um_secure_lock_register_forms=1&_wpnonce=' . wp_create_nonce( 'um_secure_lock_register_forms' ) ); $content .= $br . esc_html__( '1. Please temporarily lock all your active Register forms.', 'ultimate-member' ); $content .= ' ' . esc_html__( 'Click here to lock them now.', 'ultimate-member' ) . ''; $content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Secure > uncheck the option "Lock All Register Forms".', 'ultimate-member' ); From c6efeab4b9cb3abccf006d54652b71f308c57dfe Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 2 Jan 2024 00:12:09 +0200 Subject: [PATCH 06/76] - Advanced tab finished; - Advanced > Features section is finished; - General > Users section is finished; --- assets/css/admin/forms.css | 2 +- assets/css/admin/forms.min.css | 2 +- assets/css/admin/forms.sass | 3 +- assets/js/admin/forms.js | 4 +- assets/js/admin/forms.min.js | 2 +- includes/admin/class-enqueue.php | 7 +- includes/admin/class-secure.php | 5 +- includes/admin/core/class-admin-forms.php | 51 +- includes/admin/core/class-admin-settings.php | 471 +++++++++++-------- 9 files changed, 330 insertions(+), 217 deletions(-) diff --git a/assets/css/admin/forms.css b/assets/css/admin/forms.css index 77ebdea2..7be89ece 100644 --- a/assets/css/admin/forms.css +++ b/assets/css/admin/forms.css @@ -1,7 +1,7 @@ .um-form-table .um-forms-line[data-conditional] { display: none; } -.um-form-table .um-forms-line[data-field_type="checkbox"] td label { +.um-form-table .um-forms-line[data-field_type="checkbox"] td label, .um-form-table .um-forms-line[data-field_type="same_page_update"] td label { font-style: italic; } .um-form-table .um-forms-line label .um-req { diff --git a/assets/css/admin/forms.min.css b/assets/css/admin/forms.min.css index 125ae377..8a7f8bb7 100644 --- a/assets/css/admin/forms.min.css +++ b/assets/css/admin/forms.min.css @@ -1 +1 @@ -.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line[data-field_type=checkbox] td label{font-style:italic}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um-form-table .description{font-style:italic;clear:both}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2 select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file +.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line[data-field_type=checkbox] td label,.um-form-table .um-forms-line[data-field_type=same_page_update] td label{font-style:italic}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um-form-table .description{font-style:italic;clear:both}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2 select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file diff --git a/assets/css/admin/forms.sass b/assets/css/admin/forms.sass index cb510702..1ef1d121 100644 --- a/assets/css/admin/forms.sass +++ b/assets/css/admin/forms.sass @@ -7,7 +7,8 @@ .#{$prefix}forms-line &[data-conditional] display: none - &[data-field_type="checkbox"] + &[data-field_type="checkbox"], + &[data-field_type="same_page_update"] td label font-style: italic diff --git a/assets/js/admin/forms.js b/assets/js/admin/forms.js index 196f58ec..3b3196d7 100644 --- a/assets/js/admin/forms.js +++ b/assets/js/admin/forms.js @@ -130,9 +130,9 @@ jQuery(document).ready( function() { jQuery( document.body ).on( 'click', '.um-forms-field[data-log-object]', function() { var obj = jQuery( this ).data( 'log-object' ); if ( jQuery( this ).is( ':checked' ) ) { - jQuery( this ).siblings( '.um-same-page-update-' + obj ).show(); + jQuery( this ).parents('label').siblings( '.um-same-page-update-' + obj ).show(); } else { - jQuery( this ).siblings( '.um-same-page-update-' + obj ).hide(); + jQuery( this ).parents('label').siblings( '.um-same-page-update-' + obj ).hide(); } }); diff --git a/assets/js/admin/forms.min.js b/assets/js/admin/forms.min.js index c42ec467..9b666199 100644 --- a/assets/js/admin/forms.min.js +++ b/assets/js/admin/forms.min.js @@ -1 +1 @@ -function um_admin_init_users_select(){function e(a){var t;if(!a.id)return a.text;if(void 0!==a.img)t=jQuery(' '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).siblings(".um-same-page-update-"+e).show():jQuery(this).siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,h,g;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==h&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==h&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return h=u.prop("tagName").toLowerCase(),(d="input"==h&&"checkbox"==(g=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0 '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).parents("label").siblings(".um-same-page-update-"+e).show():jQuery(this).parents("label").siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,h,g;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==h&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==h&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return h=u.prop("tagName").toLowerCase(),(d="input"==h&&"checkbox"==(g=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0 add_query_arg( array( - 'page' => 'um_options', - 'tab' => 'misc', - 'msg' => 'updated', + 'page' => 'um_options', + 'tab' => 'advanced', + 'section' => 'features', + 'msg' => 'updated', ), admin_url( 'admin.php' ) ), diff --git a/includes/admin/class-secure.php b/includes/admin/class-secure.php index 80cc3c1e..f67dacf0 100644 --- a/includes/admin/class-secure.php +++ b/includes/admin/class-secure.php @@ -297,8 +297,9 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { ); $settings['advanced']['sections']['secure'] = array( - 'title' => __( 'Secure', 'ultimate-member' ), - 'fields' => $secure_fields, + 'title' => __( 'Secure', 'ultimate-member' ), + 'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ), + 'fields' => $secure_fields, ); return $settings; diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index e04d986d..f849273a 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -168,8 +168,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= '
    '; @@ -189,8 +190,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= '
    '; @@ -208,8 +210,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= ''; @@ -232,8 +235,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= ''; @@ -254,8 +258,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= ''; @@ -275,15 +280,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) ) + if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { $html .= '

    ' . $data['description'] . '

    '; + } $html .= ''; - } } } - } else { $html .= $this->render_hidden( $data ); } @@ -926,10 +930,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { * * @return bool|string */ - function render_checkbox( $field_data ) { + public function render_checkbox( $field_data ) { - if ( empty( $field_data['id'] ) ) + if ( empty( $field_data['id'] ) ) { return false; + } $id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id']; $id_attr = ' id="' . esc_attr( $id ) . '" '; @@ -940,7 +945,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $class_attr = ' class="um-forms-field ' . esc_attr( $class ) . '" '; $data = array( - 'field_id' => $field_data['id'] + 'field_id' => $field_data['id'], ); if ( ! empty( $field_data['data'] ) ) { @@ -958,20 +963,22 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $value = $this->get_field_value( $field_data ); - $html = " - "; + $description = ! empty( $field_data['description'] ) ? $field_data['description'] : ''; - - return $html; + $field_html = ""; + if ( '' !== $description ) { + $field_html = ""; + } + $html = "{$field_html}"; + return apply_filters( 'um_admin_render_checkbox_field_html', $html, $field_data ); } - /** * @param $field_data * * @return bool|string */ - function render_same_page_update( $field_data ) { + public function render_same_page_update( $field_data ) { if ( empty( $field_data['id'] ) ) { return false; @@ -1008,8 +1015,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $value = $this->get_field_value( $field_data ); - $html = " - "; + $description = ! empty( $field_data['description'] ) ? $field_data['description'] : ''; + + $field_html = ""; + if ( '' !== $description ) { + $field_html = ""; + } + $html = "{$field_html}"; if ( ! empty( $field_data['upgrade_cb'] ) ) { $html .= '
    ' . $field_data['upgrade_description'] . '
    @@ -1019,7 +1031,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { return $html; } - /** * @param $field_data * diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 6c8a18c5..b1026a8b 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -636,10 +636,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $latest_truncate = get_option( 'um_member_directory_truncated', false ); $same_page_update = array( - 'id' => 'member_directory_own_table', - 'type' => 'same_page_update', - 'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ), - 'tooltip' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ), + 'id' => 'member_directory_own_table', + 'type' => 'same_page_update', + 'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ), ); if ( empty( $latest_update ) || ( ! empty( $latest_truncate ) && $latest_truncate > $latest_update ) ) { @@ -1100,135 +1100,171 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'fields' => $general_pages_fields, ), 'users' => array( - 'title' => __( 'Users', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'permalink_base', - 'type' => 'select', - 'size' => 'small', - 'label' => __( 'Profile Permalink Base', 'ultimate-member' ), - // translators: %s: Profile page URL - 'tooltip' => sprintf( __( 'Here you can control the permalink structure of the user profile URL globally e.g. %susername/', 'ultimate-member' ), trailingslashit( um_get_core_page( 'user' ) ) ), - 'options' => UM()->config()->permalink_base_options, - 'placeholder' => __( 'Select...', 'ultimate-member' ), - ), - array( - 'id' => 'permalink_base_custom_meta', - 'type' => 'text', - 'label' => __( 'Profile Permalink Base Custom Meta Key', 'ultimate-member' ), - 'tooltip' => __( 'Specify the custom field meta key that you want to use as profile permalink base. Meta value should be unique.', 'ultimate-member' ), - 'conditional' => array( 'permalink_base', '=', 'custom_meta' ), - 'size' => 'medium', - ), - array( - 'id' => 'display_name', - 'type' => 'select', - 'size' => 'medium', - 'label' => __( 'User Display Name', 'ultimate-member' ), - 'tooltip' => __( 'This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists', 'ultimate-member' ), - 'options' => UM()->config()->display_name_options, - 'placeholder' => __( 'Select...', 'ultimate-member' ), - ), - array( - 'id' => 'display_name_field', - 'type' => 'text', - 'label' => __( 'Display Name Custom Field(s)', 'ultimate-member' ), - 'tooltip' => __( 'Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site', 'ultimate-member' ), - 'conditional' => array( 'display_name', '=', 'field' ), - 'size' => 'medium', - ), - array( - 'id' => 'author_redirect', - 'type' => 'checkbox', - 'label' => __( 'Automatically redirect author page to their profile?', 'ultimate-member' ), - 'tooltip' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ), - ), - array( - 'id' => 'members_page', - 'type' => 'checkbox', - 'label' => __( 'Enable Members Directory', 'ultimate-member' ), - 'tooltip' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ), - ), - array( - 'id' => 'use_gravatars', - 'type' => 'checkbox', - 'label' => __( 'Use Gravatars?', 'ultimate-member' ), - 'tooltip' => __( 'Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ), - ), - array( - 'id' => 'use_um_gravatar_default_builtin_image', - 'type' => 'select', - 'label' => __( 'Use Gravatar builtin image', 'ultimate-member' ), - 'tooltip' => __( 'Gravatar has a number of built in options which you can also use as defaults', 'ultimate-member' ), - 'options' => array( - 'default' => __( 'Default', 'ultimate-member' ), - '404' => __( '404 ( File Not Found response )', 'ultimate-member' ), - 'mm' => __( 'Mystery Man', 'ultimate-member' ), - 'identicon' => __( 'Identicon', 'ultimate-member' ), - 'monsterid' => __( 'Monsterid', 'ultimate-member' ), - 'wavatar' => __( 'Wavatar', 'ultimate-member' ), - 'retro' => __( 'Retro', 'ultimate-member' ), - 'blank' => __( 'Blank ( a transparent PNG image )', 'ultimate-member' ), - ), - 'conditional' => array( 'use_gravatars', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'use_um_gravatar_default_image', - 'type' => 'checkbox', - 'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ), - 'tooltip' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ), - 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ), - ), - array( - 'id' => 'toggle_password', - 'type' => 'checkbox', - 'label' => __( 'Show/hide password button', 'ultimate-member' ), - 'tooltip' => __( 'Enable visibility for show/hide password button for the password field-type.', 'ultimate-member' ), - ), - array( - 'id' => 'require_strongpass', - 'type' => 'checkbox', - 'label' => __( 'Require a strong password?', 'ultimate-member' ), - 'tooltip' => __( 'Enable or disable a strong password rules common for all Ultimate Member forms.', 'ultimate-member' ), - ), - array( - 'id' => 'password_min_chars', - 'type' => 'number', - 'label' => __( 'Password minimum length', 'ultimate-member' ), - 'tooltip' => __( 'If you want to enable a minimum number of characters to be in password. User password field in the UM forms has own settings for that. Leave empty to use default value 8', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'password_max_chars', - 'type' => 'number', - 'label' => __( 'Password maximum length', 'ultimate-member' ), - 'tooltip' => __( 'If you want to enable a maximum number of characters to be in password. User password field in the UM forms has own settings for that. Leave empty to use default value 30', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'profile_noindex', - 'type' => 'select', - 'size' => 'small', - 'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ), - 'tooltip' => __( 'Hides the profile page for robots. This setting can be overridden by individual role settings.', 'ultimate-member' ), - 'options' => array( - '0' => __( 'No', 'ultimate-member' ), - '1' => __( 'Yes', 'ultimate-member' ), + 'title' => __( 'Users', 'ultimate-member' ), + 'form_sections' => array( + 'users' => array( + 'title' => __( 'Users', 'ultimate-member' ), + 'description' => __( 'General users settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'permalink_base', + 'type' => 'select', + 'size' => 'small', + 'label' => __( 'Profile Permalink Base', 'ultimate-member' ), + // translators: %s: Profile page URL + 'description' => sprintf( __( 'Here you can control the permalink structure of the user profile URL globally e.g. %susername/.', 'ultimate-member' ), trailingslashit( um_get_core_page( 'user' ) ) ), + 'options' => UM()->config()->permalink_base_options, + 'placeholder' => __( 'Select...', 'ultimate-member' ), + ), + array( + 'id' => 'permalink_base_custom_meta', + 'type' => 'text', + 'label' => __( 'Profile Permalink Base Custom Meta Key', 'ultimate-member' ), + 'description' => __( 'Specify the custom field meta key that you want to use as profile permalink base. Meta value should be unique.', 'ultimate-member' ), + 'conditional' => array( 'permalink_base', '=', 'custom_meta' ), + 'size' => 'medium', + ), + array( + 'id' => 'display_name', + 'type' => 'select', + 'size' => 'medium', + 'label' => __( 'User Display Name', 'ultimate-member' ), + 'description' => __( 'This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists.', 'ultimate-member' ), + 'options' => UM()->config()->display_name_options, + 'placeholder' => __( 'Select...', 'ultimate-member' ), + ), + array( + 'id' => 'display_name_field', + 'type' => 'text', + 'label' => __( 'Display Name Custom Field(s)', 'ultimate-member' ), + 'description' => __( 'Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site.', 'ultimate-member' ), + 'conditional' => array( 'display_name', '=', 'field' ), + 'size' => 'medium', + ), + array( + 'id' => 'author_redirect', + 'type' => 'checkbox', + 'label' => __( 'Automatically redirect author page to their profile?', 'ultimate-member' ), + 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ), + ), + array( + 'id' => 'members_page', + 'type' => 'checkbox', + 'label' => __( 'Enable Members Directory', 'ultimate-member' ), + 'description' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ), + ), + array( + 'id' => 'use_gravatars', + 'type' => 'checkbox', + 'label' => __( 'Use Gravatar', 'ultimate-member' ), + 'description' => __( 'Do you want to use Gravatar instead of the default plugin profile photo (If the user did not upload a custom profile photo/avatar)?', 'ultimate-member' ), + ), + array( + 'id' => 'use_um_gravatar_default_builtin_image', + 'type' => 'select', + 'label' => __( 'Use Gravatar builtin image', 'ultimate-member' ), + 'description' => __( 'Gravatar has a number of built in options which you can also use as defaults', 'ultimate-member' ), + 'options' => array( + 'default' => __( 'Default', 'ultimate-member' ), + '404' => __( '404 ( File Not Found response )', 'ultimate-member' ), + 'mm' => __( 'Mystery Man', 'ultimate-member' ), + 'identicon' => __( 'Identicon', 'ultimate-member' ), + 'monsterid' => __( 'Monsterid', 'ultimate-member' ), + 'wavatar' => __( 'Wavatar', 'ultimate-member' ), + 'retro' => __( 'Retro', 'ultimate-member' ), + 'blank' => __( 'Blank ( a transparent PNG image )', 'ultimate-member' ), + ), + 'conditional' => array( 'use_gravatars', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'use_um_gravatar_default_image', + 'type' => 'checkbox', + 'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ), + 'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ), + 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ), + ), + array( + 'id' => 'delete_comments', + 'type' => 'checkbox', + 'label' => __( 'Deleting user comments after deleting a user', 'ultimate-member' ), + 'description' => __( 'Do you want to delete a user\'s comments when that user deletes themself or is removed from the admin dashboard from the site?', 'ultimate-member' ), + ), ), ), - array( - 'id' => 'activation_link_expiry_time', - 'type' => 'number', - 'label' => __( 'Activation link lifetime', 'ultimate-member' ), - 'tooltip' => __( 'How long does an activation link live in seconds? Leave empty for endless links.', 'ultimate-member' ), - 'size' => 'small', + 'password' => array( + 'title' => __( 'Password', 'ultimate-member' ), + 'description' => __( 'Password & Security settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'toggle_password', + 'type' => 'checkbox', + 'label' => __( 'Show/hide password button', 'ultimate-member' ), + 'description' => __( 'Enable visibility for show/hide password button for the password field-type.', 'ultimate-member' ), + ), + array( + 'id' => 'require_strongpass', + 'type' => 'checkbox', + 'label' => __( 'Require Strong Passwords', 'ultimate-member' ), + 'description' => __( 'Enable this option to apply strong password rules to all password fields (user registration, password reset and password change).', 'ultimate-member' ), + ), + array( + 'id' => 'password_min_chars', + 'type' => 'number', + 'label' => __( 'Password minimum length', 'ultimate-member' ), + 'description' => __( 'Enter the minimum number of characters a user must use for their password. The default minimum characters is 8.', 'ultimate-member' ), + 'size' => 'small', + 'conditional' => array( 'require_strongpass', '=', '1' ), + ), + array( + 'id' => 'password_max_chars', + 'type' => 'number', + 'label' => __( 'Password maximum length', 'ultimate-member' ), + 'description' => __( 'Enter the maximum number of characters a user can use for their password. The default maximum characters is 30.', 'ultimate-member' ), + 'size' => 'small', + 'conditional' => array( 'require_strongpass', '=', '1' ), + ), + array( + 'id' => 'activation_link_expiry_time', + 'type' => 'number', + 'label' => __( 'Email activation link expiration (days)', 'ultimate-member' ), + 'description' => __( 'For user registrations that require an email link to be clicked to confirm account. How long would you like the activation link to be active for before it expires? If this field is left blank the activation link will not expire.', 'ultimate-member' ), + 'size' => 'small', + ), + ), ), - array( - 'id' => 'delete_comments', - 'type' => 'checkbox', - 'label' => __( 'Deleting user comments after deleting a user', 'ultimate-member' ), - 'tooltip' => __( 'Do you want to delete a user\'s comments when that user deletes themself or is removed from the admin dashboard from the site?', 'ultimate-member' ), + 'seo' => array( + 'title' => __( 'SEO', 'ultimate-member' ), + 'description' => __( 'SEO settings for the User Profiles.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'profile_noindex', + 'type' => 'select', + 'size' => 'small', + 'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ), + 'description' => __( 'Hides the profile page for robots. This setting can be overridden by individual role settings.', 'ultimate-member' ), + 'options' => array( + '0' => __( 'No', 'ultimate-member' ), + '1' => __( 'Yes', 'ultimate-member' ), + ), + ), + array( + 'id' => 'profile_title', + 'type' => 'text', + 'label' => __( 'User Profile Title', 'ultimate-member' ), + 'description' => __( 'This is the title that is displayed on a specific user profile.', 'ultimate-member' ), + 'size' => 'medium', + ), + array( + 'id' => 'profile_desc', + 'type' => 'textarea', + 'label' => __( 'User Profile Dynamic Meta Description', 'ultimate-member' ), + 'description' => __( 'This will be used in the meta description that is available for search-engines.', 'ultimate-member' ), + 'args' => array( + 'textarea_rows' => 6, + ), + ), + ), ), ), ), @@ -1803,6 +1839,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { '' => array( 'title' => __( 'General', 'ultimate-member' ), 'fields' => array( + array( + 'id' => 'form_asterisk', + 'type' => 'checkbox', + 'label' => __( 'Show an asterisk for required fields', 'ultimate-member' ), + ), + array( + 'id' => 'um_profile_object_cache_stop', + 'type' => 'checkbox', + 'label' => __( 'Disable Cache User Profile', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), + ), array( 'id' => 'rest_api_version', 'type' => 'select', @@ -1839,59 +1886,51 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'features' => array( - 'title' => __( 'Features', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'enable_blocks', - 'type' => 'checkbox', - 'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), + 'title' => __( 'Features', 'ultimate-member' ), + 'form_sections' => array( + 'features' => array( + 'title' => __( 'Features', 'ultimate-member' ), + 'description' => __( 'Start using new features that are being progressively rolled out to improve the users management experience.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'enable_blocks', + 'type' => 'checkbox', + 'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), + ), + $same_page_update, + ), ), - // backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query - // otherwise we're filtering only results and restricted posts/terms can be visible - array( - 'id' => 'disable_restriction_pre_queries', - 'type' => 'checkbox', - 'label' => __( 'Disable pre-queries for restriction content logic (advanced)', 'ultimate-member' ), - 'description' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements', 'ultimate-member' ), + 'beta_features' => array( + 'title' => __( 'Experimental features', 'ultimate-member' ), + 'description' => __( 'These features are either experimental or incomplete, enable them at your own risk!', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'disable_legacy_fonicons', + 'type' => 'checkbox', + 'label' => __( 'Disable legacy fonticons', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to disable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), + ), + ), + ), + 'legacy_features' => array( + 'title' => __( 'Legacy features', 'ultimate-member' ), + 'description' => __( 'These features are related to the legacy logic or functionality. Please enable them only for the backward compatibility.', 'ultimate-member' ), + 'fields' => array( + // backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query + // otherwise we're filtering only results and restricted posts/terms can be visible + array( + 'id' => 'disable_restriction_pre_queries', + 'type' => 'checkbox', + 'label' => __( 'Disable pre-queries for restriction content logic', 'ultimate-member' ), + 'description' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements.', 'ultimate-member' ), + ), + ), ), ), ), ), ), - 'misc' => array( - 'title' => __( 'Misc', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'form_asterisk', - 'type' => 'checkbox', - 'label' => __( 'Show an asterisk for required fields', 'ultimate-member' ), - ), - array( - 'id' => 'profile_title', - 'type' => 'text', - 'label' => __( 'User Profile Title', 'ultimate-member' ), - 'tooltip' => __( 'This is the title that is displayed on a specific user profile', 'ultimate-member' ), - 'size' => 'medium', - ), - array( - 'id' => 'profile_desc', - 'type' => 'textarea', - 'label' => __( 'User Profile Dynamic Meta Description', 'ultimate-member' ), - 'tooltip' => __( 'This will be used in the meta description that is available for search-engines.', 'ultimate-member' ), - 'args' => array( - 'textarea_rows' => 6, - ), - ), - array( - 'id' => 'um_profile_object_cache_stop', - 'type' => 'checkbox', - 'label' => __( 'Disable Cache User Profile', 'ultimate-member' ), - 'tooltip' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), - ), - $same_page_update, - ), - ), 'install_info' => array( 'title' => __( 'Install Info', 'ultimate-member' ), 'fields' => array( @@ -1957,10 +1996,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return array(); } + if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['form_sections'] ) ) { + return array( 'form_sections' => $this->settings_structure[ $tab ]['sections'][ $section ]['form_sections'] ); + } + if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) { return $this->settings_structure[ $tab ]['sections'][ $section ]['fields']; } + if ( ! empty( $this->settings_structure[ $tab ]['form_sections'] ) ) { + return array( 'form_sections' => $this->settings_structure[ $tab ]['form_sections'] ); + } + if ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) { return $this->settings_structure[ $tab ]['fields']; } @@ -3248,16 +3295,68 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { public function render_settings_section( $section_fields, $current_tab, $current_subtab ) { ob_start(); - UM()->admin_forms_settings( - array( - 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column', - 'prefix_id' => 'um_options', - 'fields' => $section_fields, - ) - )->render_form(); + if ( ! empty( $section_fields['form_sections'] ) ) { + foreach ( $section_fields['form_sections'] as $section_key => $form_section_fields ) { + if ( empty( $form_section_fields['fields'] ) ) { + continue; + } - $section = ob_get_clean(); - return $section; + if ( ! empty( $form_section_fields['title'] ) ) { + ?> +

    + +

    get_allowed_html( 'admin_notice' ) ); ?>

    + admin_forms_settings( + array( + 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . '-' . $section_key . ' um-third-column', + 'prefix_id' => 'um_options', + 'fields' => $form_section_fields['fields'], + ) + )->render_form(); + } + } else { + $settings_structure = $this->settings_structure[ $current_tab ]; + if ( ! empty( $settings_structure['sections'] ) ) { + if ( ! empty( $settings_structure['sections'][ $current_subtab ] ) ) { + $settings_subtab_structure = $settings_structure['sections'][ $current_subtab ]; + + $section_title = array_key_exists( 'title', $settings_subtab_structure ) ? $settings_subtab_structure['title'] : ''; + $section_description = array_key_exists( 'description', $settings_subtab_structure ) ? $settings_subtab_structure['description'] : ''; + } + } else { + $section_title = array_key_exists( 'title', $settings_structure ) ? $settings_structure['title'] : ''; + $section_description = array_key_exists( 'description', $settings_structure ) ? $settings_structure['description'] : ''; + } + + if ( ! empty( $section_title ) ) { + ?> +

    + +

    get_allowed_html( 'admin_notice' ) ); ?>

    + admin_forms_settings( + array( + 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column', + 'prefix_id' => 'um_options', + 'fields' => $section_fields, + ) + )->render_form(); + } + + return ob_get_clean(); } /** From 1cf53ccef2932ab2d73b01196e7c8a82419de543 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 2 Jan 2024 15:59:24 +0200 Subject: [PATCH 07/76] - Emails section; - Override templates section; - updated checkboxes styles; --- assets/css/admin/forms.css | 7 - assets/css/admin/forms.min.css | 2 +- assets/css/admin/forms.sass | 11 +- assets/css/admin/settings.css | 25 +- assets/css/admin/settings.min.css | 2 +- assets/css/admin/settings.sass | 8 +- includes/admin/class-secure.php | 40 +-- includes/admin/core/class-admin-forms.php | 71 +---- includes/admin/core/class-admin-menu.php | 2 +- includes/admin/core/class-admin-settings.php | 254 ++++++++++-------- .../core/list-tables/emails-list-table.php | 61 +++-- .../version-template-list-table.php | 10 + 12 files changed, 254 insertions(+), 239 deletions(-) diff --git a/assets/css/admin/forms.css b/assets/css/admin/forms.css index 7be89ece..ca663923 100644 --- a/assets/css/admin/forms.css +++ b/assets/css/admin/forms.css @@ -1,9 +1,6 @@ .um-form-table .um-forms-line[data-conditional] { display: none; } -.um-form-table .um-forms-line[data-field_type="checkbox"] td label, .um-form-table .um-forms-line[data-field_type="same_page_update"] td label { - font-style: italic; } - .um-form-table .um-forms-line label .um-req { color: #a00; margin: 0 0 0 3px; @@ -68,10 +65,6 @@ display: block; margin: 0 0 5px 0; } -.um-form-table .description { - font-style: italic; - clear: both; } - .um_admin_fonticon_wrapper { display: flex; flex-direction: row; diff --git a/assets/css/admin/forms.min.css b/assets/css/admin/forms.min.css index 8a7f8bb7..5ecd52a8 100644 --- a/assets/css/admin/forms.min.css +++ b/assets/css/admin/forms.min.css @@ -1 +1 @@ -.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line[data-field_type=checkbox] td label,.um-form-table .um-forms-line[data-field_type=same_page_update] td label{font-style:italic}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um-form-table .description{font-style:italic;clear:both}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2 select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file +.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2 select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file diff --git a/assets/css/admin/forms.sass b/assets/css/admin/forms.sass index 1ef1d121..03bab099 100644 --- a/assets/css/admin/forms.sass +++ b/assets/css/admin/forms.sass @@ -7,11 +7,6 @@ .#{$prefix}forms-line &[data-conditional] display: none - &[data-field_type="checkbox"], - &[data-field_type="same_page_update"] - td - label - font-style: italic label .#{$prefix}req color: $required-asterisk @@ -96,9 +91,9 @@ width: 100% display: block margin: 0 0 5px 0 - .description - font-style: italic - clear: both + //.description + // font-style: italic + // clear: both .um_admin_fonticon_wrapper +flex( row, flex-start, center, nowrap ) diff --git a/assets/css/admin/settings.css b/assets/css/admin/settings.css index ffb296f5..831fc4c6 100644 --- a/assets/css/admin/settings.css +++ b/assets/css/admin/settings.css @@ -26,8 +26,8 @@ width: 25%; } .column-configure { - width: 60px; - text-align: center; } + width: 10%; + text-align: right; } th.column-email.column-primary { padding-left: 48px; } @@ -35,16 +35,19 @@ th.column-email.column-primary { .um-form-table .um-forms-line td { padding-right: 0; } -#um-settings-template-versions .wp-list-table .column-core_version { - width: 100px; - text-align: center; } +#um-settings-emails { + margin: 15px 0; } -#um-settings-template-versions .wp-list-table .column-theme_version { - width: 100px; - text-align: center; } - -#um-settings-template-versions .wp-list-table .column-status { - width: 260px; } +#um-settings-template-versions { + margin: 15px 0; } + #um-settings-template-versions .wp-list-table .column-core_version { + width: 100px; + text-align: center; } + #um-settings-template-versions .wp-list-table .column-theme_version { + width: 100px; + text-align: center; } + #um-settings-template-versions .wp-list-table .column-status { + width: 260px; } #um-settings-form { float: left; diff --git a/assets/css/admin/settings.min.css b/assets/css/admin/settings.min.css index 909bc2e5..cad7d4ad 100644 --- a/assets/css/admin/settings.min.css +++ b/assets/css/admin/settings.min.css @@ -1 +1 @@ -.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:60px;text-align:center}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file +.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:10%;text-align:right}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-emails{margin:15px 0}#um-settings-template-versions{margin:15px 0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file diff --git a/assets/css/admin/settings.sass b/assets/css/admin/settings.sass index 1d3dc722..327b320c 100644 --- a/assets/css/admin/settings.sass +++ b/assets/css/admin/settings.sass @@ -38,8 +38,8 @@ width: 25% .column-configure - width: 60px - text-align: center + width: 10% + text-align: right th.column-email.column-primary padding-left: 48px @@ -50,7 +50,11 @@ th.column-email.column-primary td padding-right: 0 +##{$prefix}settings-emails + margin: 15px 0 + ##{$prefix}settings-template-versions + margin: 15px 0 .wp-list-table .column-core_version width: 100px diff --git a/includes/admin/class-secure.php b/includes/admin/class-secure.php index f67dacf0..2830bd85 100644 --- a/includes/admin/class-secure.php +++ b/includes/admin/class-secure.php @@ -235,16 +235,18 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { 'description' => __( 'Scan your site to check for vulnerabilities prior to Ultimate Member version 2.6.7 and get recommendations to secure your site.', 'ultimate-member' ), ), array( - 'id' => 'lock_register_forms', - 'type' => 'checkbox', - 'label' => __( 'Lock All Register Forms', 'ultimate-member' ), - 'description' => __( 'This prevents all users from registering with Ultimate Member on your site.', 'ultimate-member' ), + 'id' => 'lock_register_forms', + 'type' => 'checkbox', + 'label' => __( 'Lock All Register Forms', 'ultimate-member' ), + 'checkbox_label' => __( 'Lock Forms', 'ultimate-member' ), + 'description' => __( 'This prevents all users from registering with Ultimate Member on your site.', 'ultimate-member' ), ), array( - 'id' => 'display_login_form_notice', - 'type' => 'checkbox', - 'label' => __( 'Display Login form notice to reset passwords', 'ultimate-member' ), - 'description' => __( 'Enforces users to reset their passwords( one-time ) and prevent from entering old password.', 'ultimate-member' ), + 'id' => 'display_login_form_notice', + 'type' => 'checkbox', + 'label' => __( 'Display Login form notice to reset passwords', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable Login form notice', 'ultimate-member' ), + 'description' => __( 'Enforces users to reset their passwords (one-time) and prevent from entering old password.', 'ultimate-member' ), ), ); @@ -264,17 +266,19 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { $secure_fields, array( array( - 'id' => 'secure_ban_admins_accounts', - 'type' => 'checkbox', - 'label' => __( 'Enable ban for administrative capabilities', 'ultimate-member' ), - 'description' => __( ' When someone tries to inject capabilities to the Account, Profile & Register forms submission, it will be banned.', 'ultimate-member' ), + 'id' => 'secure_ban_admins_accounts', + 'type' => 'checkbox', + 'label' => __( 'Administrative capabilities ban', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable ban for administrative capabilities', 'ultimate-member' ), + 'description' => __( ' When someone tries to inject capabilities to the Account, Profile & Register forms submission, it will be banned.', 'ultimate-member' ), ), array( - 'id' => 'secure_notify_admins_banned_accounts', - 'type' => 'checkbox', - 'label' => __( 'Notify Administrators', 'ultimate-member' ), - 'description' => __( 'When enabled, All administrators will be notified when someone has suspicious activities in the Account, Profile & Register forms.', 'ultimate-member' ), - 'conditional' => array( 'secure_ban_admins_accounts', '=', 1 ), + 'id' => 'secure_notify_admins_banned_accounts', + 'type' => 'checkbox', + 'label' => __( 'Notify Administrators', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable notification', 'ultimate-member' ), + 'description' => __( 'When enabled, All administrators will be notified when someone has suspicious activities in the Account, Profile & Register forms.', 'ultimate-member' ), + 'conditional' => array( 'secure_ban_admins_accounts', '=', 1 ), ), array( 'id' => 'secure_notify_admins_banned_accounts__interval', @@ -291,7 +295,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { 'id' => 'secure_allowed_redirect_hosts', 'type' => 'textarea', 'label' => __( 'Allowed hosts for safe redirect (one host per line)', 'ultimate-member' ), - 'description' => __( 'Extend allowed hosts for frontend pages redirects', 'ultimate-member' ), + 'description' => __( 'Extend allowed hosts for frontend pages redirects.', 'ultimate-member' ), ), ) ); diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index f849273a..946e913a 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -168,7 +168,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -190,7 +190,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -210,7 +210,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -235,7 +235,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -258,7 +258,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -280,7 +280,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { } - if ( ! empty( $data['description'] ) && ! in_array( $data['type'], array( 'same_page_update', 'checkbox' ), true ) ) { + if ( ! empty( $data['description'] ) ) { $html .= '

    ' . $data['description'] . '

    '; } @@ -963,11 +963,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $value = $this->get_field_value( $field_data ); - $description = ! empty( $field_data['description'] ) ? $field_data['description'] : ''; + $checkbox_label = ! empty( $field_data['checkbox_label'] ) ? $field_data['checkbox_label'] : ''; $field_html = ""; - if ( '' !== $description ) { - $field_html = ""; + if ( '' !== $checkbox_label ) { + $field_html = ""; } $html = "{$field_html}"; return apply_filters( 'um_admin_render_checkbox_field_html', $html, $field_data ); @@ -993,7 +993,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $class_attr = ' class="um-forms-field ' . esc_attr( $class ) . '" '; $data = array( - 'field_id' => $field_data['id'] + 'field_id' => $field_data['id'], ); if ( ! empty( $field_data['data'] ) ) { @@ -1015,11 +1015,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $value = $this->get_field_value( $field_data ); - $description = ! empty( $field_data['description'] ) ? $field_data['description'] : ''; + $checkbox_label = ! empty( $field_data['checkbox_label'] ) ? $field_data['checkbox_label'] : ''; $field_html = ""; - if ( '' !== $description ) { - $field_html = ""; + if ( '' !== $checkbox_label ) { + $field_html = ""; } $html = "{$field_html}"; @@ -1749,51 +1749,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { return $html; } - /** - * @param array $field_data - * - * @return string - */ - public function render_form_section( $field_data ) { - $html = '

    ' . esc_html( $field_data['title'] ) . '

    '; - if ( ! empty( $field_data['content'] ) ) { - $html .= '

    ' . wp_kses( $field_data['content'] , UM()->get_allowed_html( 'admin_notice' ) ) . '

    '; - } - return $html; - } - - public function render_override_templates( $field_data ) { - $um_check_version = get_transient( 'um_check_template_versions' ); - - $check_url = add_query_arg( - array( - 'um_adm_action' => 'check_templates_version', - '_wpnonce' => wp_create_nonce( 'check_templates_version' ), - ) - ); - ?> - -

    - - - - -

    - - 'um_options' ), admin_url( 'admin.php' ) ) ); exit; } diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index b1026a8b..60293397 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -42,13 +42,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //init settings structure add_action( 'admin_init', array( &$this, 'init_variables' ), 9 ); - //settings structure handlers + // settings structure handlers add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) ); add_filter( 'um_settings_section_custom_fields', array( $this, 'email_section_custom_fields' ), 10, 2 ); + add_filter( 'um_settings_form_section_advanced_override_templates_override_templates_custom_content', array( $this, 'settings_override_templates_tab' ) ); + //custom content for licenses tab add_filter( 'um_settings_section_licenses__custom_content', array( $this, 'settings_licenses_tab' ), 10, 3 ); - add_filter( 'um_settings_section_advanced_override_templates_custom_content', array( $this, 'settings_override_templates_tab' ) ); // @todo remove since 2.9.0 add_filter( 'um_settings_section_install_info__custom_content', array( $this, 'settings_install_info' ) ); @@ -636,10 +637,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $latest_truncate = get_option( 'um_member_directory_truncated', false ); $same_page_update = array( - 'id' => 'member_directory_own_table', - 'type' => 'same_page_update', - 'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ), + 'id' => 'member_directory_own_table', + 'type' => 'same_page_update', + 'label' => __( 'Custom usermeta table', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable custom table for usermeta', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ), ); if ( empty( $latest_update ) || ( ! empty( $latest_truncate ) && $latest_truncate > $latest_update ) ) { @@ -1142,22 +1144,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'size' => 'medium', ), array( - 'id' => 'author_redirect', - 'type' => 'checkbox', - 'label' => __( 'Automatically redirect author page to their profile?', 'ultimate-member' ), - 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ), + 'id' => 'author_redirect', + 'type' => 'checkbox', + 'label' => __( 'Hide author pages', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable automatically redirect author page to their profile', 'ultimate-member' ), + 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ), ), array( - 'id' => 'members_page', - 'type' => 'checkbox', - 'label' => __( 'Enable Members Directory', 'ultimate-member' ), - 'description' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ), + 'id' => 'members_page', + 'type' => 'checkbox', + 'label' => __( 'Members Directory', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable Members Directory', 'ultimate-member' ), + 'description' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ), ), array( - 'id' => 'use_gravatars', - 'type' => 'checkbox', - 'label' => __( 'Use Gravatar', 'ultimate-member' ), - 'description' => __( 'Do you want to use Gravatar instead of the default plugin profile photo (If the user did not upload a custom profile photo/avatar)?', 'ultimate-member' ), + 'id' => 'use_gravatars', + 'type' => 'checkbox', + 'label' => __( 'Use Gravatar', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable Gravatar', 'ultimate-member' ), + 'description' => __( 'Do you want to use Gravatar instead of the default plugin profile photo (If the user did not upload a custom profile photo/avatar)?', 'ultimate-member' ), ), array( 'id' => 'use_um_gravatar_default_builtin_image', @@ -1178,17 +1183,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'size' => 'medium', ), array( - 'id' => 'use_um_gravatar_default_image', - 'type' => 'checkbox', - 'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ), - 'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ), - 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ), + 'id' => 'use_um_gravatar_default_image', + 'type' => 'checkbox', + 'label' => __( 'Replace Gravatar\'s Default avatar', 'ultimate-member' ), + 'checkbox_label' => __( 'Set Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ), + 'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo/avatar)', 'ultimate-member' ), + 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ), ), array( - 'id' => 'delete_comments', - 'type' => 'checkbox', - 'label' => __( 'Deleting user comments after deleting a user', 'ultimate-member' ), - 'description' => __( 'Do you want to delete a user\'s comments when that user deletes themself or is removed from the admin dashboard from the site?', 'ultimate-member' ), + 'id' => 'delete_comments', + 'type' => 'checkbox', + 'label' => __( 'Delete user comments', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable deleting user comments after deleting a user', 'ultimate-member' ), + 'description' => __( 'Do you want to delete a user\'s comments when that user deletes themself or is removed from the admin dashboard from the site?', 'ultimate-member' ), ), ), ), @@ -1197,16 +1204,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'Password & Security settings.', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'toggle_password', - 'type' => 'checkbox', - 'label' => __( 'Show/hide password button', 'ultimate-member' ), - 'description' => __( 'Enable visibility for show/hide password button for the password field-type.', 'ultimate-member' ), + 'id' => 'toggle_password', + 'type' => 'checkbox', + 'label' => __( 'Toggle Password Visibility', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable password show/hide button', 'ultimate-member' ), + 'description' => __( 'Enable visibility for show/hide password button for the password field-type.', 'ultimate-member' ), ), array( - 'id' => 'require_strongpass', - 'type' => 'checkbox', - 'label' => __( 'Require Strong Passwords', 'ultimate-member' ), - 'description' => __( 'Enable this option to apply strong password rules to all password fields (user registration, password reset and password change).', 'ultimate-member' ), + 'id' => 'require_strongpass', + 'type' => 'checkbox', + 'label' => __( 'Require Strong Passwords', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable strong passwords', 'ultimate-member' ), + 'description' => __( 'Enable this option to apply strong password rules to all password fields (user registration, password reset and password change).', 'ultimate-member' ), ), array( 'id' => 'password_min_chars', @@ -1401,31 +1410,44 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'email' => array( - 'title' => __( 'Email', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'admin_email', - 'type' => 'text', - 'label' => __( 'Admin E-mail Address', 'ultimate-member' ), - 'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), + 'title' => __( 'Email', 'ultimate-member' ), + 'form_sections' => array( + 'email_sender' => array( + 'title' => __( 'Email sender options', 'ultimate-member' ), + 'description' => __( 'How the sender appears in outgoing Ultimate Member emails.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'admin_email', + 'type' => 'text', + 'label' => __( 'Admin E-mail Address', 'ultimate-member' ), + 'description' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), + ), + array( + 'id' => 'mail_from', + 'type' => 'text', + 'label' => __( 'Mail appears from', 'ultimate-member' ), + 'description' => __( 'e.g. Site Name', 'ultimate-member' ), + ), + array( + 'id' => 'mail_from_addr', + 'type' => 'text', + 'label' => __( 'Mail appears from address', 'ultimate-member' ), + 'description' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), + ), + ), ), - array( - 'id' => 'mail_from', - 'type' => 'text', - 'label' => __( 'Mail appears from', 'ultimate-member' ), - 'tooltip' => __( 'e.g. Site Name', 'ultimate-member' ), - ), - array( - 'id' => 'mail_from_addr', - 'type' => 'text', - 'label' => __( 'Mail appears from address', 'ultimate-member' ), - 'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), - ), - array( - 'id' => 'email_html', - 'type' => 'checkbox', - 'label' => __( 'Use HTML for E-mails?', 'ultimate-member' ), - 'tooltip' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.', 'ultimate-member' ), + 'email_template' => array( + 'title' => __( 'Email template', 'ultimate-member' ), + 'description' => __( 'Section to customize email templates settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'email_html', + 'type' => 'checkbox', + 'label' => __( 'Content type', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable HTML for E-mails', 'ultimate-member' ), + 'description' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.', 'ultimate-member' ), + ), + ), ), ), ), @@ -1840,15 +1862,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'General', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'form_asterisk', - 'type' => 'checkbox', - 'label' => __( 'Show an asterisk for required fields', 'ultimate-member' ), + 'id' => 'form_asterisk', + 'type' => 'checkbox', + 'label' => __( 'Required fields\' asterisk', 'ultimate-member' ), + 'checkbox_label' => __( 'Show an asterisk for required fields', 'ultimate-member' ), ), array( - 'id' => 'um_profile_object_cache_stop', - 'type' => 'checkbox', - 'label' => __( 'Disable Cache User Profile', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), + 'id' => 'um_profile_object_cache_stop', + 'type' => 'checkbox', + 'label' => __( 'Cache User Profile', 'ultimate-member' ), + 'checkbox_label' => __( 'Disable user data cache', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), ), array( 'id' => 'rest_api_version', @@ -1861,25 +1885,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), array( - 'id' => 'uninstall_on_delete', - 'type' => 'checkbox', - 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ), + 'id' => 'uninstall_on_delete', + 'type' => 'checkbox', + 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable flushing data', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ), ), ), ), 'override_templates' => array( 'title' => __( 'Override templates', 'ultimate-member' ), 'form_sections' => array( - array( - 'id' => 'override_templates_options', - 'type' => 'form_section', + 'override_templates' => array( 'title' => __( 'Override templates', 'ultimate-member' ), // translators: %s: Link to the docs article. - 'description' => sprintf( __( 'You may get more details about overriding templates here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), /** @noinspection HtmlUnknownTarget */ + 'description' => sprintf( __( 'You can find a list of template file changes with each release. You can check the latest templates and their statuses, and see if they\'re outdated or updated. You may get more details about overriding templates here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), /** @noinspection HtmlUnknownTarget */ 'fields' => array( array( - 'type' => 'override_templates', + 'id' => 'override_templates_list_table', + 'type' => 'override_templates_list_table', ), ), ), @@ -1893,10 +1917,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'Start using new features that are being progressively rolled out to improve the users management experience.', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'enable_blocks', - 'type' => 'checkbox', - 'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), + 'id' => 'enable_blocks', + 'type' => 'checkbox', + 'label' => __( 'Gutenberg Blocks', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ), ), $same_page_update, ), @@ -1906,10 +1931,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'These features are either experimental or incomplete, enable them at your own risk!', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'disable_legacy_fonicons', - 'type' => 'checkbox', - 'label' => __( 'Disable legacy fonticons', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to disable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), + 'id' => 'disable_legacy_fonicons', + 'type' => 'checkbox', + 'label' => __( 'Legacy fonticons', 'ultimate-member' ), + 'checkbox_label' => __( 'Disable legacy fonticons', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to disable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), ), ), ), @@ -1920,10 +1946,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { // backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query // otherwise we're filtering only results and restricted posts/terms can be visible array( - 'id' => 'disable_restriction_pre_queries', - 'type' => 'checkbox', - 'label' => __( 'Disable pre-queries for restriction content logic', 'ultimate-member' ), - 'description' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements.', 'ultimate-member' ), + 'id' => 'disable_restriction_pre_queries', + 'type' => 'checkbox', + 'label' => __( 'Restriction content pre-queries', 'ultimate-member' ), + 'checkbox_label' => __( 'Disable pre-queries for restriction content logic', 'ultimate-member' ), + 'description' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements.', 'ultimate-member' ), ), ), ), @@ -2125,7 +2152,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) ) { + if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) || ! empty( $tab['form_sections'] ) ) { $menu_tabs[ $slug ] = $tab['title']; } } @@ -3037,7 +3064,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { * * @return string */ - public function settings_override_templates_tab() { + public function settings_override_templates_tab( $content ) { $um_check_version = get_transient( 'um_check_template_versions' ); $check_url = add_query_arg( @@ -3049,7 +3076,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ob_start(); ?> -

    +

    @@ -3062,18 +3089,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } ?>

    -

    - here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), UM()->get_allowed_html( 'admin_notice' ) ); - ?> -

    +
    -

    +

    +

    Info. echo wp_kses( sprintf( __( 'This settings tab is deprecated. And it will be fully removed since 2.9.0 version. Please get the installation info from there.', 'ultimate-member' ), add_query_arg( 'tab', 'debug', admin_url( 'site-health.php' ) ) ), UM()->get_allowed_html( 'admin_notice' ) ); ?>

    -

    +

    $form_section_fields ) { @@ -3301,6 +3324,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { continue; } + $custom_form_section_content = apply_filters( "um_settings_form_section_{$current_tab}_{$current_subtab}_{$section_key}_custom_content", false ); + + ob_start(); if ( ! empty( $form_section_fields['title'] ) ) { ?>

    @@ -3313,13 +3339,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { admin_forms_settings( - array( - 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . '-' . $section_key . ' um-third-column', - 'prefix_id' => 'um_options', - 'fields' => $form_section_fields['fields'], - ) - )->render_form(); + if ( false === $custom_form_section_content ) { + UM()->admin_forms_settings( + array( + 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . '-' . $section_key . ' um-third-column', + 'prefix_id' => 'um_options', + 'fields' => $form_section_fields['fields'], + ) + )->render_form(); + } else { + echo $custom_form_section_content; + } + + $settings_section .= ob_get_clean(); } } else { $settings_structure = $this->settings_structure[ $current_tab ]; @@ -3335,6 +3367,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $section_description = array_key_exists( 'description', $settings_structure ) ? $settings_structure['description'] : ''; } + ob_start(); + if ( ! empty( $section_title ) ) { ?>

    @@ -3354,9 +3388,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'fields' => $section_fields, ) )->render_form(); + + $settings_section .= ob_get_clean(); } - return ob_get_clean(); + return $settings_section; } /** diff --git a/includes/admin/core/list-tables/emails-list-table.php b/includes/admin/core/list-tables/emails-list-table.php index cbfcf3f3..0ebd6798 100644 --- a/includes/admin/core/list-tables/emails-list-table.php +++ b/includes/admin/core/list-tables/emails-list-table.php @@ -99,6 +99,15 @@ class UM_Emails_List_Table extends WP_List_Table { $this->_column_headers = array( $columns, $hidden, $sortable ); } + /** + * Generates the table navigation above or below the table + * + * @since 3.1.0 + * @param string $which + */ + protected function display_tablenav( $which ) { + // Stop displaying tablenav. + } /** * @param object $item @@ -221,12 +230,14 @@ class UM_Emails_List_Table extends WP_List_Table { function column_email( $item ) { $active = UM()->options()->get( $item['key'] . '_on' ); - $icon = ! empty( $active ) ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt'; - $link = add_query_arg( array( 'email' => $item['key'] ) ); - $text = '' . $item['title'] . ''; + $icon = ! empty( $active ) ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt'; + $icon_title = ! empty( $active ) ? __( 'Enabled', 'ultimate-member' ) : __( 'Disabled', 'ultimate-member' ); + + $link = add_query_arg( array( 'email' => $item['key'] ), remove_query_arg( 'paged' ) ); + $text = '' . esc_html( $item['title'] ) . ''; if ( ! empty( $item['description'] ) ) { - $text .= ' '; + $text .= ' '; } return $text; @@ -239,11 +250,11 @@ class UM_Emails_List_Table extends WP_List_Table { * @return string */ function column_recipients( $item ) { - if ( $item['recipient'] == 'admin' ) { + if ( 'admin' === $item['recipient'] ) { return UM()->options()->get( 'admin_email' ); - } else { - return __( 'Member', 'ultimate-member' ); } + + return __( 'Member', 'ultimate-member' ); } @@ -253,7 +264,8 @@ class UM_Emails_List_Table extends WP_List_Table { * @return string */ function column_configure( $item ) { - return ''; + $edit_link = add_query_arg( array( 'email' => $item['key'] ), remove_query_arg( 'paged' ) ); + return ''; } @@ -276,13 +288,13 @@ class UM_Emails_List_Table extends WP_List_Table { } $ListTable = new UM_Emails_List_Table( array( - 'singular' => __( 'Email Notification', 'ultimate-member' ), - 'plural' => __( 'Email Notifications', 'ultimate-member' ), - 'ajax' => false + 'singular' => __( 'Email Notification', 'ultimate-member' ), + 'plural' => __( 'Email Notifications', 'ultimate-member' ), + 'ajax' => false, )); -$per_page = 20; -$paged = $ListTable->get_pagenum(); +$per_page = 999; +$paged = $ListTable->get_pagenum(); /** * UM hook @@ -306,9 +318,9 @@ $paged = $ListTable->get_pagenum(); * ?> */ $columns = apply_filters( 'um_email_templates_columns', array( - 'email' => __( 'Email', 'ultimate-member' ), - 'recipients' => __( 'Recipient(s)', 'ultimate-member' ), - 'configure' => '', + 'email' => __( 'Email', 'ultimate-member' ), + 'recipients' => __( 'Recipient(s)', 'ultimate-member' ), + 'configure' => '', ) ); $ListTable->set_columns( $columns ); @@ -317,18 +329,21 @@ $emails = UM()->config()->email_notifications; $ListTable->prepare_items(); $ListTable->items = array_slice( $emails, ( $paged - 1 ) * $per_page, $per_page ); -$ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), 'per_page' => $per_page ) ); ?> +$ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), 'per_page' => $per_page ) ); +?> -

    - here', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1335-email-templates' ), UM()->get_allowed_html( 'admin_notice' ) ); - ?> +

    +

    + +
    + + here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1335-email-templates' ), UM()->get_allowed_html( 'admin_notice' ) ); ?>

    - +
    display(); ?> +
    diff --git a/includes/admin/core/list-tables/version-template-list-table.php b/includes/admin/core/list-tables/version-template-list-table.php index 739dfd6b..bf1360fe 100644 --- a/includes/admin/core/list-tables/version-template-list-table.php +++ b/includes/admin/core/list-tables/version-template-list-table.php @@ -163,6 +163,16 @@ class UM_Versions_List_Table extends WP_List_Table { $icon = 1 === $item['status_code'] ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt'; return $item['status'] . ' '; } + + /** + * Generates the table navigation above or below the table + * + * @since 3.1.0 + * @param string $which + */ + protected function display_tablenav( $which ) { + // Stop displaying tablenav. + } } $list_table = new UM_Versions_List_Table( From 6b16caf8bd5a6f823a065f3f4b1d601089c3a972 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 2 Jan 2024 17:23:38 +0200 Subject: [PATCH 08/76] - Emails (single email settings) section; --- assets/css/admin/settings.css | 6 ++++ assets/css/admin/settings.min.css | 2 +- assets/css/admin/settings.sass | 7 +++++ includes/admin/core/class-admin-settings.php | 33 +++++++++++++------- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/assets/css/admin/settings.css b/assets/css/admin/settings.css index 831fc4c6..55cec4ca 100644 --- a/assets/css/admin/settings.css +++ b/assets/css/admin/settings.css @@ -56,6 +56,12 @@ th.column-email.column-primary { #um-settings-form .subsubsub { float: left; width: 100%; } + #um-settings-form h2.title a.um-back-button { + font-weight: normal; + font-size: 30px; + line-height: 1; + text-decoration: none; + margin-right: 5px; } .um-settings-line .multi-checkbox-line { float: left; diff --git a/assets/css/admin/settings.min.css b/assets/css/admin/settings.min.css index cad7d4ad..414d88ee 100644 --- a/assets/css/admin/settings.min.css +++ b/assets/css/admin/settings.min.css @@ -1 +1 @@ -.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:10%;text-align:right}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-emails{margin:15px 0}#um-settings-template-versions{margin:15px 0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file +.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:10%;text-align:right}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-emails{margin:15px 0}#um-settings-template-versions{margin:15px 0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}#um-settings-form h2.title a.um-back-button{font-weight:400;font-size:30px;line-height:1;text-decoration:none;margin-right:5px}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px} \ No newline at end of file diff --git a/assets/css/admin/settings.sass b/assets/css/admin/settings.sass index 327b320c..f0683e88 100644 --- a/assets/css/admin/settings.sass +++ b/assets/css/admin/settings.sass @@ -72,6 +72,13 @@ th.column-email.column-primary .subsubsub float: left width: 100% + h2.title + a.um-back-button + font-weight: normal + font-size: 30px + line-height: 1 + text-decoration: none + margin-right: 5px .#{$prefix}settings-line diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 60293397..417a1ab8 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1410,7 +1410,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'email' => array( - 'title' => __( 'Email', 'ultimate-member' ), + 'title' => __( 'Emails', 'ultimate-member' ), 'form_sections' => array( 'email_sender' => array( 'title' => __( 'Email sender options', 'ultimate-member' ), @@ -2049,6 +2049,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); $current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] ); + $temp_structure = $this->settings_structure; // Don't remove this temp variable. Internal workaround for Email Tab integration. + $custom_content = apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_custom_content', false, $current_tab, $current_subtab ); if ( false === $custom_content ) { @@ -2058,6 +2060,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $settings_section = $custom_content; } + $this->settings_structure = $temp_structure; // Don't remove this temp variable. Internal workaround for Email Tab integration. + echo '

    ' . esc_html__( 'Ultimate Member - Settings', 'ultimate-member' ) . '

    '; echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab ); @@ -2698,6 +2702,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $in_theme = UM()->mail()->template_in_theme( $email_key ); + $back_link = add_query_arg( array( 'page' => 'um_options', 'tab' => 'email' ), admin_url( 'admin.php' ) ); + + $this->settings_structure['email']['title'] = '←' . $emails[ $email_key ]['title']; + $this->settings_structure['email']['description'] = $emails[ $email_key ]['description']; + $section_fields = array( array( 'id' => 'um_email_template', @@ -2705,24 +2714,26 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'value' => $email_key, ), array( - 'id' => $email_key . '_on', - 'type' => 'checkbox', - 'label' => $emails[ $email_key ]['title'], - 'tooltip' => $emails[ $email_key ]['description'], + 'id' => $email_key . '_on', + 'type' => 'checkbox', + //'label' => $emails[ $email_key ]['title'], + 'label' => __( 'Enable/Disable', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable this email notification', 'ultimate-member' ), +// 'description' => $emails[ $email_key ]['description'], ), array( 'id' => $email_key . '_sub', 'type' => 'text', - 'label' => __( 'Subject Line', 'ultimate-member' ), + 'label' => __( 'Subject', 'ultimate-member' ), 'conditional' => array( $email_key . '_on', '=', 1 ), - 'tooltip' => __( 'This is the subject line of the e-mail', 'ultimate-member' ), +// 'description' => __( 'This is the subject line of the e-mail', 'ultimate-member' ), ), array( 'id' => $email_key, 'type' => 'email_template', - 'label' => __( 'Message Body', 'ultimate-member' ), + 'label' => __( 'Email Content', 'ultimate-member' ), 'conditional' => array( $email_key . '_on', '=', 1 ), - 'tooltip' => __( 'This is the content of the e-mail', 'ultimate-member' ), +// 'description' => __( 'This is the content of the e-mail', 'ultimate-member' ), 'value' => UM()->mail()->get_email_template( $email_key ), 'in_theme' => $in_theme, ), @@ -3329,7 +3340,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ob_start(); if ( ! empty( $form_section_fields['title'] ) ) { ?> -

    +

    get_allowed_html( 'admin_notice' ) ); ?>

    -

    +

    get_allowed_html( 'admin_notice' ) ); ?>

    Date: Tue, 2 Jan 2024 17:26:30 +0200 Subject: [PATCH 09/76] - wpcs; --- includes/admin/core/class-admin-settings.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 417a1ab8..43c829e2 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2683,8 +2683,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { /** * Set settings field per email notification. * - * @param bool $section_fields - * @param string $tab + * @param bool|array $section_fields + * @param string $tab * * @return bool|array */ @@ -2702,7 +2702,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $in_theme = UM()->mail()->template_in_theme( $email_key ); - $back_link = add_query_arg( array( 'page' => 'um_options', 'tab' => 'email' ), admin_url( 'admin.php' ) ); + $back_link = add_query_arg( + array( + 'page' => 'um_options', + 'tab' => 'email', + ), + admin_url( 'admin.php' ) + ); $this->settings_structure['email']['title'] = '←' . $emails[ $email_key ]['title']; $this->settings_structure['email']['description'] = $emails[ $email_key ]['description']; @@ -2716,24 +2722,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'id' => $email_key . '_on', 'type' => 'checkbox', - //'label' => $emails[ $email_key ]['title'], 'label' => __( 'Enable/Disable', 'ultimate-member' ), 'checkbox_label' => __( 'Enable this email notification', 'ultimate-member' ), -// 'description' => $emails[ $email_key ]['description'], ), array( 'id' => $email_key . '_sub', 'type' => 'text', 'label' => __( 'Subject', 'ultimate-member' ), 'conditional' => array( $email_key . '_on', '=', 1 ), -// 'description' => __( 'This is the subject line of the e-mail', 'ultimate-member' ), ), array( 'id' => $email_key, 'type' => 'email_template', 'label' => __( 'Email Content', 'ultimate-member' ), 'conditional' => array( $email_key . '_on', '=', 1 ), -// 'description' => __( 'This is the content of the e-mail', 'ultimate-member' ), 'value' => UM()->mail()->get_email_template( $email_key ), 'in_theme' => $in_theme, ), From 19e1b74c821b19d91bf7a264977d1d6137a28747 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 3 Jan 2024 14:08:22 +0200 Subject: [PATCH 10/76] - fixed small PHP notice on settings save; --- includes/admin/core/class-admin-settings.php | 38 ++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 43c829e2..6cb5320c 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2343,8 +2343,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - - function set_default_if_empty( $settings ) { + public function set_default_if_empty( $settings ) { $tab = ''; if ( ! empty( $_GET['tab'] ) ) { $tab = sanitize_key( $_GET['tab'] ); @@ -2355,7 +2354,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $section = sanitize_key( $_GET['section'] ); } - if ( 'access' === $tab && empty( $section ) ) { if ( ! array_key_exists( 'access_exclude_uris', $settings ) ) { $settings['access_exclude_uris'] = array(); @@ -2365,14 +2363,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $settings; } - /** - * Remove empty values from multi text fields + * Remove empty values from multi text fields. * - * @param $settings + * @param array $settings * @return array */ - function remove_empty_values( $settings ) { + public function remove_empty_values( $settings ) { $tab = ''; if ( ! empty( $_GET['tab'] ) ) { $tab = sanitize_key( $_GET['tab'] ); @@ -2383,9 +2380,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $section = sanitize_key( $_GET['section'] ); } - if ( isset( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) { + if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['form_sections'] ) ) { + $fields = array(); + foreach ( $this->settings_structure[ $tab ]['sections'][ $section ]['form_sections'] as $section_key => $section_data ) { + if ( ! empty( $section_data['fields'] ) ) { + $fields[] = $section_data['fields']; + } + } + $fields = array_merge( ...$fields ); + } elseif ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) { $fields = $this->settings_structure[ $tab ]['sections'][ $section ]['fields']; - } else { + } elseif ( ! empty( $this->settings_structure[ $tab ]['form_sections'] ) ) { + $fields = array(); + foreach ( $this->settings_structure[ $tab ]['form_sections'] as $section_key => $section_data ) { + if ( ! empty( $section_data['fields'] ) ) { + $fields[] = $section_data['fields']; + } + } + $fields = array_merge( ...$fields ); + } elseif ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) { $fields = $this->settings_structure[ $tab ]['fields']; } @@ -2393,15 +2406,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $settings; } - $filtered_settings = array(); foreach ( $settings as $key => $value ) { - $filtered_settings[ $key ] = $value; foreach ( $fields as $field ) { - if ( $field['id'] == $key && isset( $field['type'] ) && $field['type'] == 'multi_text' ) { - $filtered_settings[ $key ] = array_filter( $settings[ $key ] ); + if ( $field['id'] === $key && array_key_exists( 'type', $field ) && 'multi_text' === $field['type'] ) { + $filtered_settings[ $key ] = array_filter( $value ); } } } @@ -2409,7 +2420,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $filtered_settings; } - /** * */ From a127946e1720d6dd0b18cdfbabc57034aac98bdd Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 3 Jan 2024 14:24:40 +0200 Subject: [PATCH 11/76] - fix the emails background color --- includes/core/class-mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index 8bd1acd7..add641e5 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -305,7 +305,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * } * add_filter( 'um_email_template_body_attrs', 'my_email_template_body_attrs', 10, 3 ); */ - $body_attrs = apply_filters( 'um_email_template_body_attrs', 'style="background: #f2f2f2;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"', $slug, $args ); + $body_attrs = apply_filters( 'um_email_template_body_attrs', 'style="background: #fff;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"', $slug, $args ); ?> > From b03b4a5a76341ffe1d3dd7f6eed4754a68608f76 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 12 Jan 2024 11:03:04 +0200 Subject: [PATCH 12/76] - page_select field for the Settings > General > Pages; --- assets/js/admin/forms.js | 47 ++++++ assets/js/admin/forms.min.js | 2 +- includes/admin/core/class-admin-forms.php | 73 ++++++++++ includes/admin/core/class-admin-settings.php | 144 +++++++++++++++---- includes/ajax/class-init.php | 13 ++ includes/ajax/class-pages.php | 69 +++++++++ includes/class-config.php | 93 +++++++++++- includes/class-init.php | 7 +- includes/core/class-options.php | 17 ++- includes/um-core-functions.php | 84 +++++++++++ 10 files changed, 517 insertions(+), 32 deletions(-) create mode 100644 includes/ajax/class-pages.php create mode 100755 includes/um-core-functions.php diff --git a/assets/js/admin/forms.js b/assets/js/admin/forms.js index 3b3196d7..6c59baf4 100644 --- a/assets/js/admin/forms.js +++ b/assets/js/admin/forms.js @@ -97,6 +97,52 @@ function um_admin_init_users_select() { } +function um_admin_init_pages_select() { + // multiple select with AJAX search + jQuery('.um-pages-select2').select2({ + ajax: { + url: wp.ajax.settings.url, + dataType: 'json', + delay: 250, // delay in ms while typing when to perform a AJAX search + data: function( params ) { + return { + search: params.term, // search query + action: 'um_get_pages_list', // AJAX action for admin-ajax.php + page: params.page || 1, // infinite scroll pagination + nonce: um_admin_scripts.nonce + }; + }, + processResults: function( data, params ) { + params.page = params.page || 1; + var options = []; + + if ( data ) { + + // data is the array of arrays, and each of them contains ID and the Label of the option + jQuery.each( data, function( index, text ) { // do not forget that "index" is just auto incremented value + if ( index === 'total_count' ) { + return; + } + options.push( { id: text[0], text: text[1] } ); + }); + + } + + return { + results: options, + pagination: { + more: ( params.page * 10 ) < data.total_count + } + }; + }, + cache: true + }, + placeholder: jQuery(this).data('placeholder'), + minimumInputLength: 0, // the minimum of symbols to input before perform a search + allowClear: true, + }); +} + /** * * @param field_key @@ -123,6 +169,7 @@ function um_same_page_something_wrong( field_key ) { jQuery(document).ready( function() { um_admin_init_users_select(); + um_admin_init_pages_select(); /** * Same page upgrade field diff --git a/assets/js/admin/forms.min.js b/assets/js/admin/forms.min.js index 9b666199..98d1cf4e 100644 --- a/assets/js/admin/forms.min.js +++ b/assets/js/admin/forms.min.js @@ -1 +1 @@ -function um_admin_init_users_select(){function e(a){var t;if(!a.id)return a.text;if(void 0!==a.img)t=jQuery(' '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).parents("label").siblings(".um-same-page-update-"+e).show():jQuery(this).parents("label").siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,h,g;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==h&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(h=u.prop("tagName").toLowerCase())?(g=u.attr("type"),d="checkbox"==g?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==h&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return h=u.prop("tagName").toLowerCase(),(d="input"==h&&"checkbox"==(g=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0 '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),um_admin_init_pages_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).parents("label").siblings(".um-same-page-update-"+e).show():jQuery(this).parents("label").siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,g,h;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==g&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==g&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return g=u.prop("tagName").toLowerCase(),(d="input"==g&&"checkbox"==(h=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0form_data['prefix_id'] ) ? sanitize_title( $this->form_data['prefix_id'] ) : '' ) . '_' . $field_data['id']; + $id_attr = ' id="' . esc_attr( $id ) . '" '; + + $class = ! empty( $field_data['class'] ) ? $field_data['class'] . ' ' : ' '; + $class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field'; + $class_attr = ' class="um-forms-field um-pages-select2 ' . esc_attr( $class ) . '" '; + + $data = array( + 'field_id' => $field_data['id'], + ); + + if ( ! empty( $field_data['placeholder'] ) ) { + $data['placeholder'] = $field_data['placeholder']; + } + + $data_attr = ''; + foreach ( $data as $key => $value ) { + $data_attr .= ' data-' . $key . '="' . esc_attr( $value ) . '" '; + } + + $name = $field_data['id']; + $name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name; + $hidden_name_attr = ' name="' . $name . '" '; + $name = $name . ( ! empty( $field_data['multi'] ) ? '[]' : '' ); + $name_attr = ' name="' . $name . '" '; + + $value = $this->get_field_value( $field_data ); + + $options = ''; + if ( ! empty( $field_data['options'] ) ) { + foreach ( $field_data['options'] as $key => $option ) { + if ( ! empty( $field_data['multi'] ) ) { + + if ( ! is_array( $value ) || empty( $value ) ) { + $value = array(); + } + + $options .= ''; + } else { + $options .= ''; + } + } + } + + $hidden = ''; + if ( ! empty( $multiple ) ) { + $hidden = ""; + } + + $button = ''; + $slug = str_replace( 'core_', '', $field_data['id'] ); + if ( ! um_get_predefined_page_id( $slug ) || 'publish' !== get_post_status( um_get_predefined_page_id( $slug ) ) ) { + $button = ' ' . esc_html__( 'Create Default', 'ultimate-member' ) . ''; + } + + $html = "$hidden$button"; + + return $html; + } /** * @param $field_data diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 6cb5320c..6acfddd7 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -253,37 +253,131 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ); - $core_pages = UM()->config()->core_pages; - - foreach ( $core_pages as $page_s => $page ) { - $have_pages = UM()->query()->wp_pages(); - $page_id = UM()->options()->get_core_page_id( $page_s ); +// $core_pages = UM()->config()->core_pages; +// +// foreach ( $core_pages as $page_s => $page ) { +// $have_pages = UM()->query()->wp_pages(); +// $page_id = UM()->options()->get_core_page_id( $page_s ); +// +// $page_title = ! empty( $page['title'] ) ? $page['title'] : ''; +// +// if ( 'reached_maximum_limit' === $have_pages ) { +// $general_pages_fields[] = array( +// 'id' => $page_id, +// 'type' => 'text', +// // translators: %s: Page title +// 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ), +// 'placeholder' => __( 'Add page ID', 'ultimate-member' ), +// 'compiler' => true, +// 'size' => 'small', +// ); +// } else { +// $general_pages_fields[] = array( +// 'id' => $page_id, +// 'type' => 'select', +// // translators: %s: Page title +// 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ), +// 'options' => UM()->query()->wp_pages(), +// 'placeholder' => __( 'Choose a page...', 'ultimate-member' ), +// 'compiler' => true, +// 'size' => 'small', +// ); +// } +// +// $settings_map[ $page_id ] = array( +// 'sanitize' => 'absint', +// ); +// } + foreach ( UM()->config()->get( 'predefined_pages' ) as $slug => $page ) { + $page_id = UM()->options()->get_predefined_page_option_key( $slug ); $page_title = ! empty( $page['title'] ) ? $page['title'] : ''; - if ( 'reached_maximum_limit' === $have_pages ) { - $general_pages_fields[] = array( - 'id' => $page_id, - 'type' => 'text', - // translators: %s: Page title - 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ), - 'placeholder' => __( 'Add page ID', 'ultimate-member' ), - 'compiler' => true, - 'size' => 'small', - ); + $options = array(); + $page_value = ''; + + $pre_result = apply_filters( 'um_admin_settings_pages_list_value', false, $page_id ); + if ( false === $pre_result ) { + if ( ! empty( $opt_value = UM()->options()->get( $page_id ) ) ) { + if ( 'publish' === get_post_status( $opt_value ) ) { + $title = get_the_title( $opt_value ); + $title = ( mb_strlen( $title ) > 50 ) ? mb_substr( $title, 0, 49 ) . '...' : $title; + $title = sprintf( __( '%s (ID: %s)', 'ultimate-member' ), $title, $opt_value ); + + $options = array( $opt_value => $title ); + $page_value = $opt_value; + } + } } else { - $general_pages_fields[] = array( - 'id' => $page_id, - 'type' => 'select', - // translators: %s: Page title - 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ), - 'options' => UM()->query()->wp_pages(), - 'placeholder' => __( 'Choose a page...', 'ultimate-member' ), - 'compiler' => true, - 'size' => 'small', - ); + // `page_value` variable that we transfer from 3rd-party hook for getting filtered option value also + $page_value = $pre_result['page_value']; + unset( $pre_result['page_value'] ); + + $options = $pre_result; } + $page_setting_description = ''; + if ( ! empty( $page_value ) ) { + $content = get_the_content( null, false, $page_value ); + switch ( $slug ) { + case 'account': + if ( $page_value === um_get_predefined_page_id( 'user' ) ) { + $page_setting_description = __( 'Warning: Account page and User page must be separate pages.', 'ultimate-member' ); + } elseif ( ! has_shortcode( $content, 'ultimatemember_account' ) ) { + $page_setting_description = __( 'Warning: Account page must contain shortcode [ultimatemember_account].', 'ultimate-member' ); + } elseif ( function_exists( 'wc_get_page_id' ) && wc_get_page_id( 'myaccount' ) === um_get_predefined_page_id( 'account' ) ) { + $page_setting_description = __( 'Warning: Account page and WooCommerce "My account" page should be separate pages.', 'ultimate-member' ); + } + break; + case 'login': + if ( $page_value === um_get_predefined_page_id( 'logout' ) ) { + $page_setting_description = __( 'Warning: Login page and Logout page must be separate pages.', 'ultimate-member' ); + } elseif ( ! has_shortcode( $content, 'ultimatemember' ) ) { + $page_setting_description = __( 'Warning: Login page must contain a login form shortcode. You can get existing shortcode or create a new one here.', 'ultimate-member' ); + } + break; + case 'logout': + if ( $page_value === (int) get_option( 'page_on_front' ) ) { + $page_setting_description = __( 'Warning: Home page and Logout page must be separate pages.', 'ultimate-member' ); + } elseif ( $page_value === um_get_predefined_page_id( 'login' ) ) { + $page_setting_description = __( 'Warning: Login page and Logout page must be separate pages.', 'ultimate-member' ); + } + break; + case 'password-reset': + if ( ! has_shortcode( $content, 'ultimatemember_password' ) ) { + $page_setting_description = __( 'Warning: Password Reset page must contain shortcode [ultimatemember_password].', 'ultimate-member' ); + } + break; + case 'register': + if ( ! has_shortcode( $content, 'ultimatemember' ) ) { + $page_setting_description = __( 'Warning: Register page must contain a registration form shortcode. You can get existing shortcode or create a new one here.', 'ultimate-member' ); + } + break; + case 'user': + if ( $page_value === um_get_predefined_page_id( 'account' ) ) { + $description = __( 'Warning: Account page and User page must be separate pages.', 'ultimate-member' ); + } elseif ( ! has_shortcode( $content, 'ultimatemember' ) ) { + $page_setting_description = __( 'Warning: User page must contain a profile form shortcode. You can get existing shortcode or create a new one here.', 'ultimate-member' ); + } + break; + default: + $page_setting_description = apply_filters( 'um_pages_settings_description', $page_setting_description, $content, $slug ); + break; + } + } + + $general_pages_fields[] = array( + 'id' => $page_id, + 'type' => 'page_select', + // translators: %s: Page title + 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ), + 'options' => $options, + 'value' => $page_value, + 'placeholder' => __( 'Choose a page...', 'ultimate-member' ), + 'size' => 'small', + 'description' => $page_setting_description, + ); + $settings_map[ $page_id ] = array( 'sanitize' => 'absint', ); diff --git a/includes/ajax/class-init.php b/includes/ajax/class-init.php index 4772a48c..45ae7e2c 100644 --- a/includes/ajax/class-init.php +++ b/includes/ajax/class-init.php @@ -20,9 +20,22 @@ if ( ! class_exists( 'um\ajax\Init' ) ) { * @used-by \UM::includes() */ public function includes() { + $this->pages(); $this->secure(); } + /** + * @since 2.8.3 + * + * @return Pages + */ + public function pages() { + if ( empty( UM()->classes['um\ajax\pages'] ) ) { + UM()->classes['um\ajax\pages'] = new Pages(); + } + return UM()->classes['um\ajax\pages']; + } + /** * @since 2.6.8 * diff --git a/includes/ajax/class-pages.php b/includes/ajax/class-pages.php new file mode 100644 index 00000000..60bd674b --- /dev/null +++ b/includes/ajax/class-pages.php @@ -0,0 +1,69 @@ +admin()->check_ajax_nonce(); + + // we will pass post IDs and titles to this array + $return = array(); + + $pre_result = apply_filters( 'um_admin_settings_get_pages_list', false ); + + if ( false === $pre_result ) { + $query_args = array( + 'post_type' => 'page', + 'post_status' => 'publish', // if you don't want drafts to be returned + 'ignore_sticky_posts' => 1, + 'posts_per_page' => 10, // how much to show at once + 'paged' => absint( $_GET['page'] ), + 'orderby' => 'title', + 'order' => 'asc', + ); + + if ( ! empty( $_GET['search'] ) ) { + $query_args['s'] = sanitize_text_field( $_GET['search'] ); // the search query + } + + $search_results = new \WP_Query( $query_args ); + + if ( $search_results->have_posts() ) { + while ( $search_results->have_posts() ) { + $search_results->the_post(); + + // shorten the title a little + $title = ( mb_strlen( $search_results->post->post_title ) > 50 ) ? mb_substr( $search_results->post->post_title, 0, 49 ) . '...' : $search_results->post->post_title; + $title = sprintf( __( '%s (ID: %s)', 'ultimate-member' ), $title, $search_results->post->ID ); + $return[] = array( $search_results->post->ID, $title ); // array( Post ID, Post Title ) + } + } + + $return['total_count'] = $search_results->found_posts; + } else { + // got already calculated posts array from 3rd-party integrations (e.g. WPML, Polylang) + $return = $pre_result; + } + + wp_send_json( $return ); + } +} diff --git a/includes/class-config.php b/includes/class-config.php index 2b570c3b..44bd055d 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -31,6 +31,13 @@ if ( ! class_exists( 'um\Config' ) ) { */ public $core_pages; + /** + * @since 2.8.3 + * + * @var array + */ + public $predefined_pages; + /** * @var array */ @@ -841,6 +848,90 @@ if ( ! class_exists( 'um\Config' ) ) { 'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ), ) ); } - //end class + + /** + * Get variable from config + * + * @param string $key + * + * @return mixed + * + * @since 2.8.3 + */ + public function get( $key ) { + if ( empty( $this->$key ) ) { + $this->{'init_' . $key}(); + } + return apply_filters( 'um_config_get', $this->$key, $key ); + } + + /** + * Init plugin core pages. + * + * @since 2.8.3 + */ + public function init_predefined_pages() { + $core_forms = get_option( 'um_core_forms', array() ); + $setup_shortcodes = array_merge( + array( + 'profile' => '', + 'login' => '', + 'register' => '', + ), + $core_forms + ); + + $this->predefined_pages = array( + 'user' => array( + 'title' => __( 'User', 'ultimate-member' ), + 'content' => ! empty( $setup_shortcodes['profile'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['profile'] . '"]' : '', + ), + 'login' => array( + 'title' => __( 'Login', 'ultimate-member' ), + 'content' => ! empty( $setup_shortcodes['login'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['login'] . '"]' : '', + ), + 'register' => array( + 'title' => __( 'Register', 'ultimate-member' ), + 'content' => ! empty( $setup_shortcodes['register'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['register'] . '"]' : '', + ), + 'logout' => array( + 'title' => __( 'Logout', 'ultimate-member' ), + 'content' => '', + ), + 'account' => array( + 'title' => __( 'Account', 'ultimate-member' ), + 'content' => '[ultimatemember_account]', + ), + 'password-reset' => array( + 'title' => __( 'Password Reset', 'ultimate-member' ), + 'content' => '[ultimatemember_password]', + ), + ); + + /** + * Filters Ultimate Member predefined pages. + * + * @param {array} $pages Predefined pages. + * + * @return {array} Predefined pages. + * + * @since 2.8.3 + * @hook um_predefined_pages + * + * @example
    + * function my_predefined_pages( $pages ) { + * // your code here + * $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) ); + * return $pages; + * } + * add_filter( 'um_predefined_pages', 'my_predefined_pages' ); + */ + $this->predefined_pages = apply_filters( 'um_predefined_pages', $this->predefined_pages ); + + // since 2.8.3 legacy hook + // @todo remove in 3.0 version + $this->predefined_pages = apply_filters( 'um_core_pages', $this->predefined_pages ); + $this->core_pages = $this->predefined_pages; + } } } diff --git a/includes/class-init.php b/includes/class-init.php index 210caebf..0a7d33b4 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -228,7 +228,8 @@ if ( ! class_exists( 'UM' ) ) { // init widgets add_action( 'widgets_init', array( &$this, 'widgets_init' ) ); - //include short non class functions + // Include short non-class functions + require_once 'um-core-functions.php'; require_once 'um-short-functions.php'; require_once 'um-deprecated-functions.php'; } @@ -585,8 +586,6 @@ if ( ! class_exists( 'UM' ) ) { $this->theme_updater(); } elseif ( $this->is_request( 'frontend' ) ) { $this->frontend()->includes(); - $this->account(); - $this->password(); $this->login(); $this->register(); $this->user_posts(); @@ -594,6 +593,8 @@ if ( ! class_exists( 'UM' ) ) { } //common includes + $this->account(); + $this->password(); $this->rewrite(); $this->mail(); $this->rest_api(); diff --git a/includes/core/class-options.php b/includes/core/class-options.php index a453e1f9..66a0ca97 100644 --- a/includes/core/class-options.php +++ b/includes/core/class-options.php @@ -1,8 +1,9 @@ config()->get( 'predefined_pages' ); + return array_key_exists( $slug, $predefined_pages ); +} + +/** + * @param string $slug + * + * @return false|int + */ +function um_get_predefined_page_id( $slug ) { + if ( ! um_predefined_page_slug_exists( $slug ) ) { + return false; + } + + $option_key = UM()->options()->get_predefined_page_option_key( $slug ); + return apply_filters( 'um_get_predefined_page_id', UM()->options()->get( $option_key ), $slug ); +} + +/** + * + * @param string $slug + * @param null|int|\WP_Post $post + * + * @return bool + */ +function um_is_predefined_page( $slug, $post = null ) { + // handle $post inside, just we need make $post as \WP_Post. Otherwise something is wrong and return false + if ( ! $post ) { + global $post; + + if ( empty( $post ) ) { + return false; + } + } else { + if ( is_numeric( $post ) ) { + $post = get_post( $post ); + + if ( empty( $post ) ) { + return false; + } + } + } + + if ( empty( $post->ID ) ) { + return false; + } + + return um_get_predefined_page_id( $slug ) === $post->ID; +} + +/** + * Get predefined page URL + * + * @param string $slug + * + * @return false|string + */ +function um_get_predefined_page_url( $slug ) { + $url = false; + + if ( $page_id = um_get_predefined_page_id( $slug ) ) { + $url = get_permalink( $page_id ); + } + + return $url; +} From 5340a65858e31d042bb5b9f61b951acd1aed73c3 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 16 Jan 2024 01:30:16 +0200 Subject: [PATCH 13/76] - updated version; --- README.md | 2 +- ultimate-member.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 734786ff..e5fe5998 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ GNU Version 2 or Any Later Version ### IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION -[Official Release Version: 2.8.2](https://github.com/ultimatemember/ultimatemember/releases/tag/2.8.2). +[Official Release Version: 2.8.3](https://github.com/ultimatemember/ultimatemember/releases/tag/2.8.3). ## Changelog diff --git a/ultimate-member.php b/ultimate-member.php index 608bd39a..82bb8b5f 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.8.2 + * Version: 2.8.3-alpha * Author: Ultimate Member * Author URI: http://ultimatemember.com/ * Text Domain: ultimate-member From d9021373ce86eeed5926545302813d2fba6db421 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 16 Jan 2024 14:00:22 +0200 Subject: [PATCH 14/76] - add meta to user --- includes/class-config.php | 4 ++-- includes/core/class-mail.php | 29 ++++++++------------------- includes/core/class-password.php | 5 +++++ includes/core/class-user.php | 12 +++-------- includes/core/um-actions-register.php | 17 +++++++++------- templates/email/welcome_email.php | 4 ++-- 6 files changed, 30 insertions(+), 41 deletions(-) diff --git a/includes/class-config.php b/includes/class-config.php index 2b570c3b..27e2f6e6 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -334,8 +334,8 @@ if ( ! class_exists( 'um\Config' ) ) { 'subject' => 'Welcome to {site_name}!', 'body' => 'Hi {display_name},

    ' . 'Thank you for signing up with {site_name}! Your account is now active.

    ' . - 'To login please visit the following url:

    ' . - '{login_url}

    ' . + '{action_title}:

    ' . + '{action_url}

    ' . 'Your account e-mail: {email}
    ' . 'Your account username: {username}

    ' . 'If you have any problems, please contact us at {admin_email}

    ' . diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index af429cf2..c71d194e 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -423,9 +423,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ) ); add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ) ); - if ( array_key_exists( 'generated_pass', $args ) && 1 === absint( $args['generated_pass'] ) ) { - add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder_set_password' ) ); - } /** * Filters email notification subject. @@ -624,9 +621,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $placeholders[] = '{admin_email}'; $placeholders[] = '{submitted_registration}'; $placeholders[] = '{login_url}'; - $placeholders[] = '{login_button}'; $placeholders[] = '{password}'; $placeholders[] = '{account_activation_link}'; + $placeholders[] = '{action_url}'; + $placeholders[] = '{action_title}'; return $placeholders; } @@ -643,25 +641,14 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $replace_placeholders[] = um_admin_email(); $replace_placeholders[] = um_user_submitted_registration_formatted(); $replace_placeholders[] = um_get_core_page( 'login' ); - $replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' ); $replace_placeholders[] = esc_html__( 'Your set password', 'ultimate-member' ); $replace_placeholders[] = um_user( 'account_activation_link' ); - return $replace_placeholders; - } - - - public function add_replace_placeholder_set_password( $replace_placeholders ) { - $key = array_search( um_get_core_page( 'login' ), $replace_placeholders, true ); - if ( false !== $key ) { - $url = UM()->password()->reset_url(); - $replace_placeholders[ $key ] = add_query_arg( array( 'set_pass' => 'new_user' ), $url ); - } - - $button = esc_html__( 'Login to our site', 'ultimate-member' ); - $button_key = array_search( $button, $replace_placeholders , true ); - if ( false !== $key ) { - $url = UM()->password()->reset_url(); - $replace_placeholders[ $button_key ] = esc_html__( 'Set your password', 'ultimate-member' ); + if ( true === (bool) get_user_meta( um_user( 'ID' ), 'um_password_generated', true ) ) { + $replace_placeholders[] = um_user( 'password_reset_link' ); + $replace_placeholders[] = esc_html__( 'Set your password', 'ultimate-member' ); + } else { + $replace_placeholders[] = um_get_core_page( 'login' ); + $replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' ); } return $replace_placeholders; } diff --git a/includes/core/class-password.php b/includes/core/class-password.php index a5e1c882..06d69997 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -599,6 +599,11 @@ if ( ! class_exists( 'um\core\Password' ) ) { } $this->setcookie( $rp_cookie, false ); + $password_generated = get_user_meta( $user->ID, 'um_password_generated', true ); + if ( $password_generated ) { + delete_user_meta( $user->ID, 'um_password_generated' ); + } + /** * UM hook * diff --git a/includes/core/class-user.php b/includes/core/class-user.php index c47690f3..9a96da1f 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -1690,7 +1690,7 @@ if ( ! class_exists( 'um\core\User' ) ) { ?> * */ - function approve( $repeat = true, $args = array() ) { + public function approve( $repeat = true ) { $user_id = um_user( 'ID' ); if ( ! $repeat ) { @@ -1702,7 +1702,7 @@ if ( ! class_exists( 'um\core\User' ) ) { delete_option( "um_cache_userdata_{$user_id}" ); - if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) { + if ( 'awaiting_admin_review' === um_user( 'account_status' ) ) { $userdata = get_userdata( $user_id ); $this->maybe_generate_password_reset_key( $userdata ); @@ -1712,13 +1712,7 @@ if ( ! class_exists( 'um\core\User' ) ) { } else { //$userdata = get_userdata( $user_id ); //get_password_reset_key( $userdata ); - $welcome_email_args = array(); - if ( true === (bool) $args['generated_pass'] ) { - $welcome_email_args = array( - 'generated_pass' => 1, - ); - } - UM()->mail()->send( um_user( 'user_email' ), 'welcome_email', $welcome_email_args ); + UM()->mail()->send( um_user( 'user_email' ), 'welcome_email' ); } $this->set_status( 'approved' ); diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index f85c4ad4..14938c8f 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -8,12 +8,12 @@ if ( ! defined( 'ABSPATH' ) ) { * * @param int $user_id */ -function um_post_registration_approved_hook( $user_id, $args ) { +function um_post_registration_approved_hook( $user_id ) { um_fetch_user( $user_id ); - UM()->user()->approve( true, $args ); + UM()->user()->approve( true ); } -add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2 ); +add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 1 ); /** * Account needs email validation. @@ -417,8 +417,10 @@ function um_submit_form_register( $args, $form_data ) { $user_email = $args['user_email']; } + $generate_password = false; if ( ! isset( $args['user_password'] ) ) { - $user_password = UM()->validation()->generate( 8 ); + $generate_password = true; + $user_password = UM()->validation()->generate( 8 ); } else { $user_password = $args['user_password']; } @@ -456,9 +458,6 @@ function um_submit_form_register( $args, $form_data ) { 'user_password' => $user_password, 'user_email' => trim( $user_email ), ); - if ( ! isset( $args['user_password'] ) ) { - $credentials['generated_pass'] = true; - } // @todo test when ready maybe remove if ( ! empty( $args['submitted'] ) ) { @@ -523,6 +522,10 @@ function um_submit_form_register( $args, $form_data ) { return; } + if ( true === $generate_password ) { + update_user_meta( $user_id, 'um_password_generated', true ); + } + /** * Fires after complete UM user registration. * diff --git a/templates/email/welcome_email.php b/templates/email/welcome_email.php index ac4ab960..ffb7c6f8 100644 --- a/templates/email/welcome_email.php +++ b/templates/email/welcome_email.php @@ -21,9 +21,9 @@ if ( ! defined( 'ABSPATH' ) ) {
    -
    Thank you for signing up!Your account is now active.
    +
    Thank you for signing up! Your account is now active.
    - +
    If you have any problems, please contact us at {admin_email}
    From c8ddd5d23c3face99725accb604a9ef022c59268 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 16 Jan 2024 16:09:26 +0200 Subject: [PATCH 15/76] - fix emails placeholders --- includes/core/class-mail.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index c71d194e..965e36dd 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -643,13 +643,15 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $replace_placeholders[] = um_get_core_page( 'login' ); $replace_placeholders[] = esc_html__( 'Your set password', 'ultimate-member' ); $replace_placeholders[] = um_user( 'account_activation_link' ); - if ( true === (bool) get_user_meta( um_user( 'ID' ), 'um_password_generated', true ) ) { - $replace_placeholders[] = um_user( 'password_reset_link' ); - $replace_placeholders[] = esc_html__( 'Set your password', 'ultimate-member' ); - } else { + + if ( 'pending' === um_user( 'status' ) || ! get_user_meta( um_user( 'ID' ), 'um_password_generated', true ) ) { $replace_placeholders[] = um_get_core_page( 'login' ); $replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' ); + } else { + $replace_placeholders[] = um_user( 'password_reset_link' ); + $replace_placeholders[] = esc_html__( 'Set your password', 'ultimate-member' ); } + return $replace_placeholders; } } From 9e61abfa7a6e5b5edec7dca0cd2aaf241f158294 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 17 Jan 2024 13:24:40 +0200 Subject: [PATCH 16/76] - change password text --- templates/password-change.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/password-change.php b/templates/password-change.php index 46bf34a6..322a2e65 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -57,12 +57,16 @@ if ( ! defined( 'ABSPATH' ) ) { foreach ( $fields as $key => $data ) { $output .= UM()->fields()->edit_field( $key, $data ); } - echo $output; ?> + echo wp_kses( $output, UM()->get_allowed_html( 'templates' ) ); ?>
    - + + + + +
    From 7ce364f87414e57667af678d3e230f794f275296 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 17 Jan 2024 13:40:53 +0200 Subject: [PATCH 17/76] - small wpcs fix --- templates/password-change.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/password-change.php b/templates/password-change.php index 322a2e65..9834b066 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -57,7 +57,8 @@ if ( ! defined( 'ABSPATH' ) ) { foreach ( $fields as $key => $data ) { $output .= UM()->fields()->edit_field( $key, $data ); } - echo wp_kses( $output, UM()->get_allowed_html( 'templates' ) ); ?> + echo wp_kses( $output, UM()->get_allowed_html( 'templates' ) ); + ?>
    From 205a3ea9bce39b62ff26e377c74bfc84dc7dd8a7 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 17 Jan 2024 16:06:58 +0200 Subject: [PATCH 18/76] - reviewed #1428; --- includes/core/class-mail.php | 3 ++- includes/core/class-password.php | 15 ++++++++++++--- includes/core/um-actions-register.php | 6 +++--- templates/email/welcome_email.php | 2 +- templates/password-change.php | 5 +++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index 965e36dd..349aae5f 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -644,7 +644,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $replace_placeholders[] = esc_html__( 'Your set password', 'ultimate-member' ); $replace_placeholders[] = um_user( 'account_activation_link' ); - if ( 'pending' === um_user( 'status' ) || ! get_user_meta( um_user( 'ID' ), 'um_password_generated', true ) ) { + $set_password_required = get_user_meta( um_user( 'ID' ), 'um_set_password_required', true ); + if ( empty( $set_password_required ) || 'pending' === um_user( 'status' ) ) { $replace_placeholders[] = um_get_core_page( 'login' ); $replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' ); } else { diff --git a/includes/core/class-password.php b/includes/core/class-password.php index 06d69997..b76de3b5 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -155,6 +155,7 @@ if ( ! class_exists( 'um\core\Password' ) ) { if ( false !== $this->change_password ) { // then COOKIE are valid then get data from them and populate hidden fields for the password reset form + $args['rp_mode'] = 'pw_change'; $args['template'] = 'password-change'; $args['rp_key'] = ''; $rp_cookie = 'wp-resetpass-' . COOKIEHASH; @@ -163,6 +164,14 @@ if ( ! class_exists( 'um\core\Password' ) ) { $args['login'] = $rp_login; $args['rp_key'] = $rp_key; + + $rp_user_obj = get_user_by( 'login', $rp_login ); + if ( false !== $rp_user_obj ) { + $set_password_required = get_user_meta( $rp_user_obj->ID, 'um_set_password_required', true ); + if ( ! empty( $set_password_required ) ) { + $args['rp_mode'] = 'pw_set'; + } + } } } @@ -599,9 +608,9 @@ if ( ! class_exists( 'um\core\Password' ) ) { } $this->setcookie( $rp_cookie, false ); - $password_generated = get_user_meta( $user->ID, 'um_password_generated', true ); - if ( $password_generated ) { - delete_user_meta( $user->ID, 'um_password_generated' ); + $password_generated = get_user_meta( $user->ID, 'um_set_password_required', true ); + if ( ! empty( $password_generated ) ) { + delete_user_meta( $user->ID, 'um_set_password_required' ); } /** diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 14938c8f..5d4bf6ac 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -11,9 +11,9 @@ if ( ! defined( 'ABSPATH' ) ) { function um_post_registration_approved_hook( $user_id ) { um_fetch_user( $user_id ); - UM()->user()->approve( true ); + UM()->user()->approve(); } -add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 1 ); +add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook' ); /** * Account needs email validation. @@ -523,7 +523,7 @@ function um_submit_form_register( $args, $form_data ) { } if ( true === $generate_password ) { - update_user_meta( $user_id, 'um_password_generated', true ); + update_user_meta( $user_id, 'um_set_password_required', true ); } /** diff --git a/templates/email/welcome_email.php b/templates/email/welcome_email.php index ffb7c6f8..b81eb789 100644 --- a/templates/email/welcome_email.php +++ b/templates/email/welcome_email.php @@ -5,7 +5,7 @@ * * This template can be overridden by copying it to {your-theme}/ultimate-member/email/welcome_email.php * - * @version 2.6.1 + * @version 2.8.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/templates/password-change.php b/templates/password-change.php index 9834b066..98c6e3b7 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -6,8 +6,9 @@ * * Call: function ultimatemember_password() * - * @version 2.7.0 + * @version 2.8.3 * + * @var string $rp_mode * @var string $mode * @var string $rp_key * @var int $form_id @@ -63,7 +64,7 @@ if ( ! defined( 'ABSPATH' ) ) {
    - + From f026f44323d37d9dfdf4bda20a6fefd8d0cbc2ce Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 18 Jan 2024 11:30:49 +0200 Subject: [PATCH 19/76] - reviewed #1428; --- includes/core/class-password.php | 4 +- includes/core/class-permalinks.php | 10 ++++- includes/core/um-actions-core.php | 3 +- templates/password-change.php | 67 ++++++++++++------------------ 4 files changed, 40 insertions(+), 44 deletions(-) diff --git a/includes/core/class-password.php b/includes/core/class-password.php index b76de3b5..77f4c5cb 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -608,8 +608,8 @@ if ( ! class_exists( 'um\core\Password' ) ) { } $this->setcookie( $rp_cookie, false ); - $password_generated = get_user_meta( $user->ID, 'um_set_password_required', true ); - if ( ! empty( $password_generated ) ) { + $set_password_required = get_user_meta( $user->ID, 'um_set_password_required', true ); + if ( ! empty( $set_password_required ) ) { delete_user_meta( $user->ID, 'um_set_password_required' ); } diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php index 48779ce8..5d66a799 100644 --- a/includes/core/class-permalinks.php +++ b/includes/core/class-permalinks.php @@ -125,8 +125,14 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { wp_die( __( 'This activation link is expired.', 'ultimate-member' ) ); } + $redirect = um_get_core_page( 'login', 'account_active' ); + $set_password_required = get_user_meta( $user_id, 'um_set_password_required', true ); + um_fetch_user( $user_id ); UM()->user()->approve(); + if ( ! empty( $set_password_required ) ) { + $redirect = um_user( 'password_reset_link' ); + } um_reset_user(); $user_role = UM()->roles()->get_priority_user_role( $user_id ); @@ -167,7 +173,9 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { */ do_action( 'um_after_email_confirmation', $user_id ); - $redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after e-mail activation" + if ( empty( $set_password_required ) ) { + $redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after e-mail activation" + } $redirect = apply_filters( 'um_after_email_confirmation_redirect', $redirect, $user_id, $login ); exit( wp_redirect( $redirect ) ); diff --git a/includes/core/um-actions-core.php b/includes/core/um-actions-core.php index 9c195a81..8779fafc 100644 --- a/includes/core/um-actions-core.php +++ b/includes/core/um-actions-core.php @@ -100,10 +100,11 @@ function um_action_request_process() { wp_die( esc_html__( 'You do not have permission to make this action.', 'ultimate-member' ) ); } + um_fetch_user( $uid ); + add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 ); add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 ); - um_fetch_user( $uid ); UM()->user()->approve(); exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) ); break; diff --git a/templates/password-change.php b/templates/password-change.php index 98c6e3b7..6ad5b9c1 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -8,18 +8,16 @@ * * @version 2.8.3 * - * @var string $rp_mode - * @var string $mode - * @var string $rp_key - * @var int $form_id - * @var array $args + * @var string $rp_mode 'pw_set' or 'pw_change' for display it differently. + * @var string $rp_key Reset password key. + * @var array $args Change password arguments */ if ( ! defined( 'ABSPATH' ) ) { exit; } ?> -
    +
    @@ -30,23 +28,18 @@ if ( ! defined( 'ABSPATH' ) ) { Add hidden field at the start of the change password form. + * function my_custom_change_password_page_hidden_fields( $cp_args ) { + * echo '' * } - * ?> + * add_action( 'um_change_password_page_hidden_fields', 'my_custom_change_password_page_hidden_fields' ); */ do_action( 'um_change_password_page_hidden_fields', $args ); @@ -58,11 +51,12 @@ if ( ! defined( 'ABSPATH' ) ) { foreach ( $fields as $key => $data ) { $output .= UM()->fields()->edit_field( $key, $data ); } - echo wp_kses( $output, UM()->get_allowed_html( 'templates' ) ); + if ( $output ) { + echo wp_kses( $output, UM()->get_allowed_html( 'templates' ) ); + } ?>
    -
    @@ -72,29 +66,22 @@ if ( ! defined( 'ABSPATH' ) ) {
    -
    Add hidden field at the start of the change password form. + * function my_custom_change_password_form( $cp_args ) { + * echo '' * } - * ?> + * add_action( 'um_change_password_form', 'my_custom_change_password_form' ); */ do_action( 'um_change_password_form', $args ); /** This action is documented in includes/core/um-actions-profile.php */ From 328de82d60ac2f66c0c9ca77c958e3ca2ab93e23 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 18 Jan 2024 16:00:11 +0200 Subject: [PATCH 20/76] - added UM_DEV_MODE constant -> display Experimental features; --- includes/admin/class-enqueue.php | 2 +- includes/admin/core/class-admin-metabox.php | 2 +- includes/admin/core/class-admin-settings.php | 26 +++++++++++++++++--- ultimate-member.php | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index dba671c6..01118a53 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -555,7 +555,7 @@ final class Enqueue extends \um\common\Enqueue { wp_enqueue_style( 'um_admin_common' ); if ( self::$um_cpt_form_screen ) { - if ( defined( 'UM_LEGACY_BUILDER_OFF' ) && UM_LEGACY_BUILDER_OFF ) { + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE && UM()->options()->get( 'enable_new_form_builder' ) ) { // Do new assets. } else { $this->load_builder(); diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 96546ada..f48dcad8 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1021,7 +1021,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { public function add_metabox_form() { add_meta_box( 'submitdiv', __( 'Publish', 'ultimate-member' ), array( $this, 'custom_submitdiv' ), 'um_form', 'side', 'high' ); - if ( defined( 'UM_LEGACY_BUILDER_OFF' ) && UM_LEGACY_BUILDER_OFF ) { + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE && UM()->options()->get( 'enable_new_form_builder' ) ) { // Do new metabox. } else { add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' ); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 1531c22d..275a2358 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2025,11 +2025,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'These features are either experimental or incomplete, enable them at your own risk!', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'disable_legacy_fonicons', + 'id' => 'enable_new_ui', + 'type' => 'checkbox', + 'label' => __( 'Design scheme', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable new UI (for developers only)', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable new UI.', 'ultimate-member' ), + ), + array( + 'id' => 'enable_new_form_builder', + 'type' => 'checkbox', + 'label' => __( 'Form Builder', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable new Form Builder (for developers only)', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable new Form Builder.', 'ultimate-member' ), + ), + array( + 'id' => 'enable_legacy_fonticons', 'type' => 'checkbox', 'label' => __( 'Legacy fonticons', 'ultimate-member' ), - 'checkbox_label' => __( 'Disable legacy fonticons', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to disable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable legacy fonticons', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), ), ), ), @@ -2062,6 +2076,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), // @todo remove since 2.9.0 ) ); + + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE ) { + + } else { + unset( $this->settings_structure['advanced']['sections']['features']['form_sections']['beta_features'] ); + } } /** diff --git a/ultimate-member.php b/ultimate-member.php index 82bb8b5f..b08fcaeb 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -32,7 +32,7 @@ define( 'UM_PATH', plugin_dir_path( __FILE__ ) ); define( 'UM_PLUGIN', plugin_basename( __FILE__ ) ); define( 'UM_VERSION', $plugin_data['Version'] ); define( 'UM_PLUGIN_NAME', $plugin_data['Name'] ); -// define( 'UM_LEGACY_BUILDER_OFF', true ); +// define( 'UM_DEV_MODE', true ); require_once 'includes/class-functions.php'; require_once 'includes/class-init.php'; From 41f9e34ece97c99a364277cbe43b62e487998968 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Mon, 22 Jan 2024 15:45:54 +0200 Subject: [PATCH 21/76] - delete wrong span tag in emails --- templates/email/notification_deletion.php | 2 +- templates/email/notification_new_user.php | 2 +- templates/email/notification_review.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/email/notification_deletion.php b/templates/email/notification_deletion.php index 6d58d35b..87f2f8d4 100644 --- a/templates/email/notification_deletion.php +++ b/templates/email/notification_deletion.php @@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
    -
    {display_name} has just deleted their {site_name} account.
    +
    {display_name} has just deleted their {site_name} account.
    diff --git a/templates/email/notification_new_user.php b/templates/email/notification_new_user.php index 59be08f7..14529ee8 100644 --- a/templates/email/notification_new_user.php +++ b/templates/email/notification_new_user.php @@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
    -
    {display_name} has just created an account on {site_name}.
    +
    {display_name} has just created an account on {site_name}.
    To view their profile click here: {user_profile_link}
    diff --git a/templates/email/notification_review.php b/templates/email/notification_review.php index cab18131..4a1f08fb 100644 --- a/templates/email/notification_review.php +++ b/templates/email/notification_review.php @@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
    -
    {display_name} has just applied for membership to {site_name} and is waiting to be reviewed.
    +
    {display_name} has just applied for membership to {site_name} and is waiting to be reviewed.
    To review this member please click the following link: {user_profile_link}
    From d9c53fcbc873519e0ba98d3c1599f0ba93e64a6c Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 30 Jan 2024 13:24:13 +0200 Subject: [PATCH 22/76] - fix login field validate option --- includes/admin/core/class-admin-metabox.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index f48dcad8..9327ff6d 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1494,7 +1494,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { break; case '_validate': - if ( array_key_exists( 'mode', $form_data ) && 'login' === $form_data['mode'] && in_array( $field_args['metakey'], array( 'username', 'user_login', 'user_email' ), true ) ) { + if ( array_key_exists( 'mode', $form_data ) && 'login' === $form_data['mode'] && array_key_exists( 'metakey', $field_args ) && in_array( $field_args['metakey'], array( 'username', 'user_login', 'user_email' ), true ) ) { return; } ?> From deb7c14678d7c33250b6c5c3c4a845019c90eccf Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 30 Jan 2024 16:10:03 +0200 Subject: [PATCH 23/76] - fix search icon CSS --- assets/css/um-styles.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css index 5380916d..108cdfa7 100644 --- a/assets/css/um-styles.css +++ b/assets/css/um-styles.css @@ -898,12 +898,20 @@ small.um-max-filesize span{ .um-search-area .um-search-field { width: 100%; + margin: 0; } .um-search-area .um-search-icon { position: absolute; - top: 7px; + height: 100%; right: 10px; + top: 0; +} +.um-faicon-search:before { + display: flex; + align-items: center; + justify-content: center; + height: 100%; } /* From 83d58e1ebced1328aae87666877610caabe59e5c Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 31 Jan 2024 13:37:33 +0200 Subject: [PATCH 24/76] - fix theme update message --- .../admin/core/class-admin-theme-updater.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/admin/core/class-admin-theme-updater.php b/includes/admin/core/class-admin-theme-updater.php index 144ccac4..5c460b58 100644 --- a/includes/admin/core/class-admin-theme-updater.php +++ b/includes/admin/core/class-admin-theme-updater.php @@ -85,7 +85,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { } $old_version = get_option( 'theme_version ' . $theme->get( 'Name' ) ); - $version = $theme->get( 'Version' ); + $version = $theme->get( 'Version' ); if ( $old_version === $version ) { return; } @@ -98,14 +98,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { $um_dir = $theme->get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'ultimate-member'; @mkdir( $um_dir, 0777, true ); - $src = realpath( $temp_dir ); + $src = realpath( $temp_dir ); $dest = realpath( $um_dir ); if ( $src && $dest ) { self::recurse_copy( $src, $dest ); - error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates restored." ); + error_log( "UM Log. Theme '" . $theme->get( 'Name' ) . "' templates restored." ); UM()->files()->remove_dir( $src ); } else { - error_log( "UM Error. Can not restore theme templates." ); + error_log( 'UM Error. Can not restore theme templates.' ); } delete_option( 'theme_version ' . $theme->get( 'Name' ) ); @@ -140,13 +140,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { $temp_dir = UM()->uploader()->get_core_temp_dir() . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme->get( 'template' ); @mkdir( $temp_dir, 0777, true ); - $src = realpath( $um_dir ); + $src = realpath( $um_dir ); $dest = realpath( $temp_dir ); if ( $src && $dest ) { self::recurse_copy( $src, $dest ); - error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates saved." ); + error_log( "UM Log. Theme '" . $theme->get( 'Name' ) . "' templates saved." ); } else { - error_log( "UM Error. Can not save theme templates." ); + error_log( 'UM Error. Can not save theme templates.' ); } update_option( 'theme_version ' . $theme->get( 'Name' ), $theme->get( 'Version' ) ); @@ -156,7 +156,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { /** * Filter: upgrader_package_options - * + * * @param array $options * @return array */ @@ -170,7 +170,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { /** * Action: upgrader_process_complete - * + * * @param \WP_Upgrader $WP_Upgrader * @param array $options */ @@ -184,4 +184,4 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) { } -} \ No newline at end of file +} From 41fb47ea559b4d1b37071d8e723b456dd4d0d02c Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 31 Jan 2024 15:40:01 +0200 Subject: [PATCH 25/76] - fix modal responsive --- assets/js/um-functions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/um-functions.js b/assets/js/um-functions.js index 972a724f..e83e324b 100644 --- a/assets/js/um-functions.js +++ b/assets/js/um-functions.js @@ -593,7 +593,11 @@ function um_modal_responsive() { if ( w <= 500 ) { modal.animate({ 'bottom' : 0 }, 300); } else { - modal.animate({ 'bottom' : half_gap }, 300); + if ( h - parseInt(half_gap) > h ) { + modal.animate({ 'bottom' : 0 }, 300); + } else { + modal.animate({ 'bottom' : half_gap }, 300); + } } } } From c61008bdbe1ce8de4597b41c7aad8dfda88f527d Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 2 Feb 2024 02:19:15 +0200 Subject: [PATCH 26/76] - fixed security issue with mysql query escape; - wpcs; --- includes/core/class-member-directory-meta.php | 441 +++++++++++------- 1 file changed, 260 insertions(+), 181 deletions(-) diff --git a/includes/core/class-member-directory-meta.php b/includes/core/class-member-directory-meta.php index bb094cde..d34eb10c 100644 --- a/includes/core/class-member-directory-meta.php +++ b/includes/core/class-member-directory-meta.php @@ -31,15 +31,32 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { /** * @var bool */ - var $roles_in_query = false; + private $roles_in_query = false; - var $general_meta_joined = false; + /** + * @var bool + */ + public $general_meta_joined = false; - var $having = ''; - var $select = ''; - var $sql_limit = ''; - var $sql_order = ''; + /** + * @var string + */ + private $having = ''; + /** + * @var string + */ + private $select = ''; + + /** + * @var string + */ + private $sql_limit = ''; + + /** + * @var string + */ + public $sql_order = ''; /** * Member_Directory_Meta constructor. @@ -55,28 +72,27 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { add_action( 'um_delete_custom_field', array( &$this, 'on_delete_custom_field' ), 10, 2 ); } - /** * Delete custom field and metakey from UM usermeta table * * @param $metakey * @param $args */ - function on_delete_custom_field( $metakey, $args ) { + public function on_delete_custom_field( $metakey, $args ) { $metakeys = get_option( 'um_usermeta_fields', array() ); - if ( in_array( $metakey, $metakeys ) ) { - unset( $metakeys[ array_search( $metakey, $metakeys ) ] ); + if ( in_array( $metakey, $metakeys, true ) ) { + unset( $metakeys[ array_search( $metakey, $metakeys, true ) ] ); global $wpdb; $wpdb->delete( "{$wpdb->prefix}um_metadata", array( - 'um_key' => $metakey + 'um_key' => $metakey, ), array( - '%s' + '%s', ) ); @@ -86,17 +102,16 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { do_action( 'um_metadata_on_delete_custom_field', $metakeys, $metakey, $args ); } - /** * Add metakey to usermeta fields * * @param $metakey * @param $args */ - function on_new_field_added( $metakey, $args ) { + public function on_new_field_added( $metakey, $args ) { $metakeys = get_option( 'um_usermeta_fields', array() ); - if ( ! in_array( $metakey, $metakeys ) ) { + if ( ! in_array( $metakey, $metakeys, true ) ) { $metakeys[] = $metakey; update_option( 'um_usermeta_fields', array_values( $metakeys ) ); } @@ -104,7 +119,6 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { do_action( 'um_metadata_on_new_field_added', $metakeys, $metakey, $args ); } - /** * When you delete usermeta - remove row from um_metadata * @@ -113,9 +127,9 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { * @param string $meta_key * @param mixed $_meta_value */ - function on_delete_usermeta( $meta_ids, $object_id, $meta_key, $_meta_value ) { + public function on_delete_usermeta( $meta_ids, $object_id, $meta_key, $_meta_value ) { $metakeys = get_option( 'um_usermeta_fields', array() ); - if ( ! in_array( $meta_key, $metakeys ) ) { + if ( ! in_array( $meta_key, $metakeys, true ) ) { return; } @@ -124,17 +138,16 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $wpdb->delete( "{$wpdb->prefix}um_metadata", array( - 'user_id' => $object_id, - 'um_key' => $meta_key + 'user_id' => $object_id, + 'um_key' => $meta_key, ), array( '%d', - '%s' + '%s', ) ); } - /** * When you add/update usermeta - add/update row from um_metadata * @@ -143,32 +156,33 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { * @param string $meta_key * @param mixed $_meta_value */ - function on_update_usermeta( $meta_id, $object_id, $meta_key, $_meta_value ) { - + public function on_update_usermeta( $meta_id, $object_id, $meta_key, $_meta_value ) { $metakeys = get_option( 'um_usermeta_fields', array() ); - if ( ! in_array( $meta_key, $metakeys ) ) { + if ( ! in_array( $meta_key, $metakeys, true ) ) { return; } global $wpdb; - $result = $wpdb->get_var( $wpdb->prepare( - "SELECT umeta_id - FROM {$wpdb->prefix}um_metadata - WHERE user_id = %d AND - um_key = %s - LIMIT 1", - $object_id, - $meta_key - ) ); + $result = $wpdb->get_var( + $wpdb->prepare( + "SELECT umeta_id + FROM {$wpdb->prefix}um_metadata + WHERE user_id = %d AND + um_key = %s + LIMIT 1", + $object_id, + $meta_key + ) + ); if ( empty( $result ) ) { $wpdb->insert( "{$wpdb->prefix}um_metadata", array( - 'user_id' => $object_id, - 'um_key' => $meta_key, - 'um_value' => maybe_serialize( $_meta_value ), + 'user_id' => $object_id, + 'um_key' => $meta_key, + 'um_value' => maybe_serialize( $_meta_value ), ), array( '%d', @@ -180,10 +194,10 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $wpdb->update( "{$wpdb->prefix}um_metadata", array( - 'um_value' => maybe_serialize( $_meta_value ), + 'um_value' => maybe_serialize( $_meta_value ), ), array( - 'umeta_id' => $result, + 'umeta_id' => $result, ), array( '%s', @@ -195,74 +209,100 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { } } - /** * @param $directory_data * @param $field * @param $value - * @param $i + * @param int $i * @param bool $is_default */ - function handle_filter_query( $directory_data, $field, $value, $i, $is_default = false ) { + protected function handle_filter_query( $directory_data, $field, $value, $i, $is_default = false ) { global $wpdb; - $join_slug = $is_default ? 'ummd' : 'umm' ; + $join_slug = $is_default ? 'ummd' : 'umm'; + $join_alias = esc_sql( $join_slug . $i ); $blog_id = get_current_blog_id(); switch ( $field ) { default: - $filter_type = $this->filter_types[ $field ]; /** - * UM hook + * Filters marker for skipping default filter handle in member directory queries. + * Hook handle filter queries for the custom usermeta table only. + * Note: $field is the field meta key. * - * @type filter - * @title um_query_args_{$field}__filter - * @description Change field's query for search at Members Directory - * @input_vars - * [{"var":"$field_query","type":"array","desc":"Field query"}] - * @change_log - * ["Since: 2.0"] - * @usage - * - * @example - * Skip filter by rating default handler and add 3rd-party handlers in callback. + * function um_custom_query_args_filter_rating__filter_meta( $skip, $member_directory_meta, $field, $value, $filter_type, $is_default ) { + * $skip = true; + * $member_directory_meta->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata ummreviews ON ( ummreviews.user_id = u.ID AND ummreviews.um_key = '_reviews_avg' )"; + * return $skip; * } - * ?> + * add_filter( 'um_query_args_filter_rating__filter_meta', 'um_custom_query_args_filter_rating__filter_meta', 10, 6 ); */ $skip_default = apply_filters( "um_query_args_{$field}__filter_meta", false, $this, $field, $value, $filter_type, $is_default ); - + /** + * Filters marker for skipping default filter handle in member directory queries. + * Hook handle filter queries for the custom usermeta table only. + * + * @since 2.1 + * @hook um_query_args_filter_global_meta + * + * @param {bool} $skip Skip default filter handler marker. + * @param {object} $member_directory_meta Member_Directory_Meta class instance. + * @param {string} $field Filter's field key. + * @param {mixed} $value Filter value. + * @param {string} $filter_type Filter type. + * @param {bool} $is_default If it's admin filtering option then `true`. + * + * @return {bool} Skip default filter handler marker. + * + * @example
    + * function um_custom_query_args_filter_global_meta( $skip, $member_directory_meta, $field, $value, $filter_type, $is_default ) { + * if ( 'filter_rating' === $field ) { + * $skip = true; + * $member_directory_meta->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata ummreviews ON ( ummreviews.user_id = u.ID AND ummreviews.um_key = '_reviews_avg' )"; + * } + * return $skip; + * } + * add_filter( 'um_query_args_filter_global_meta', 'um_custom_query_args_filter_global_meta', 10, 6 ); + */ $skip_default = apply_filters( 'um_query_args_filter_global_meta', $skip_default, $this, $field, $value, $filter_type, $is_default ); if ( ! $skip_default ) { - switch ( $filter_type ) { default: - do_action( "um_query_args_{$field}_{$filter_type}__filter_meta", $field, $value, $filter_type, $i, $is_default ); break; case 'text': + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; - - $value = trim( stripslashes( $value ) ); - + $value = trim( stripslashes( $value ) ); $compare = apply_filters( 'um_members_directory_filter_text', '=', $field ); - $value = apply_filters( 'um_members_directory_filter_text_meta_value', $value, $field ); + $compare = esc_sql( $compare ); + $value = apply_filters( 'um_members_directory_filter_text_meta_value', $value, $field ); - $this->where_clauses[] = $wpdb->prepare( "{$join_slug}{$i}.um_key = %s AND {$join_slug}{$i}.um_value {$compare} %s", $field, $value ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias and $compare variables are pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "{$join_alias}.um_key = %s AND {$join_alias}.um_value {$compare} %s", $field, $value ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; case 'select': @@ -270,51 +310,57 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $value = array( $value ); } - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; $values_array = array(); foreach ( $value as $single_val ) { $single_val = trim( stripslashes( $single_val ) ); - $values_array[] = $wpdb->prepare( "{$join_slug}{$i}.um_value LIKE %s", '%"' . $single_val . '"%' ); - $values_array[] = $wpdb->prepare( "{$join_slug}{$i}.um_value LIKE %s", '%' . serialize( (string) $single_val ) . '%' ); - $values_array[] = $wpdb->prepare( "{$join_slug}{$i}.um_value = %s", $single_val ); + // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias and $compare variables are pre-escaped. + $values_array[] = $wpdb->prepare( "{$join_alias}.um_value LIKE %s", '%"' . $wpdb->esc_like( $single_val ) . '"%' ); + $values_array[] = $wpdb->prepare( "{$join_alias}.um_value LIKE %s", '%' . $wpdb->esc_like( maybe_serialize( (string) $single_val ) ) . '%' ); + $values_array[] = $wpdb->prepare( "{$join_alias}.um_value = %s", $single_val ); if ( is_numeric( $single_val ) ) { - $values_array[] = $wpdb->prepare( "{$join_slug}{$i}.um_value LIKE %s", '%' . serialize( (int) $single_val ) . '%' ); + $values_array[] = $wpdb->prepare( "{$join_alias}.um_value LIKE %s", '%' . $wpdb->esc_like( maybe_serialize( (int) $single_val ) ) . '%' ); } + // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. } $values = implode( ' OR ', $values_array ); - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = %s AND ( {$values} ) )", $field ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias and $values variables are pre-escaped or $wpdb->prepare. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = %s AND ( {$values} ) )", $field ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; - case 'slider': - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; + case 'slider': + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; $min = min( $value ); $max = max( $value ); - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = %s AND {$join_slug}{$i}.um_value BETWEEN %d AND %d )", $field, $min, $max ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = %s AND {$join_alias}.um_value BETWEEN %d AND %d )", $field, $min, $max ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; - case 'datepicker': + case 'datepicker': $offset = 0; if ( ! $is_default ) { + // phpcs:disable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) { $offset = (int) $_POST['gmt_offset']; } + // phpcs:enable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. } else { $gmt_offset = get_post_meta( $directory_data['form_id'], '_um_search_filters_gmt', true ); if ( is_numeric( $gmt_offset ) ) { @@ -324,103 +370,112 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset $to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59 + // @todo: rewrite date() in WP5.3 standards. $from_date = date( 'Y/m/d', $from_date ); - $to_date = date( 'Y/m/d', $to_date ); + $to_date = date( 'Y/m/d', $to_date ); - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = %s AND {$join_slug}{$i}.um_value BETWEEN %s AND %s )", $field, $from_date, $to_date ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = %s AND {$join_alias}.um_value BETWEEN %s AND %s )", $field, $from_date, $to_date ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = array( $from_date, $to_date ); } - break; - case 'timepicker': - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; - if ( $value[0] == $value[1] ) { - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = %s AND {$join_slug}{$i}.um_value = %s )", $field, $value[0] ); + case 'timepicker': + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; + if ( $value[0] === $value[1] ) { + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = %s AND {$join_alias}.um_value = %s )", $field, $value[0] ); } else { - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = %s AND CAST( {$join_slug}{$i}.um_value AS TIME ) BETWEEN %s AND %s )", $field, $value[0], $value[1] ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = %s AND CAST( {$join_alias}.um_value AS TIME ) BETWEEN %s AND %s )", $field, $value[0], $value[1] ); } if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; + } - } - break; + case 'role': $value = array_map( 'strtolower', $value ); if ( empty( $this->roles ) && ! is_multisite() ) { - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = '" . $wpdb->get_blog_prefix( $blog_id ) . "capabilities' )"; - $this->roles = $value; + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = %s )", $wpdb->get_blog_prefix( $blog_id ) . 'capabilities' ); + $this->roles = $value; $this->roles_in_query = true; } $roles_clauses = array(); foreach ( $value as $role ) { - $roles_clauses[] = $wpdb->prepare( "umm_roles.um_value LIKE %s", '%"' . $role . '"%' ); + $roles_clauses[] = $wpdb->prepare( 'umm_roles.um_value LIKE %s', '%"' . $wpdb->esc_like( $role ) . '"%' ); } + // $roles_clauses is pre-prepared. $this->where_clauses[] = '( ' . implode( ' OR ', $roles_clauses ) . ' )'; if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; + case 'birth_date': - + // @todo: rewrite date() in WP5.3 standards. $from_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ), date( 'Y', time() - min( $value ) * YEAR_IN_SECONDS ) ) ); - $to_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ) + 1, date( 'Y', time() - ( max( $value ) + 1 ) * YEAR_IN_SECONDS ) ) ); + $to_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ) + 1, date( 'Y', time() - ( max( $value ) + 1 ) * YEAR_IN_SECONDS ) ) ); - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; - - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = 'birth_date' AND {$join_slug}{$i}.um_value BETWEEN %s AND %s )", $to_date, $from_date ); + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = 'birth_date' AND {$join_alias}.um_value BETWEEN %s AND %s )", $to_date, $from_date ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = array( $to_date, $from_date ); } - break; - case 'user_registered': + case 'user_registered': $offset = 0; if ( ! $is_default ) { + // phpcs:disable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) { $offset = (int) $_POST['gmt_offset']; } + // phpcs:enable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. } else { $gmt_offset = get_post_meta( $directory_data['form_id'], '_um_search_filters_gmt', true ); if ( is_numeric( $gmt_offset ) ) { $offset = (int) $gmt_offset; } } - + // @todo: rewrite date() in WP5.3 standards. $from_date = date( 'Y-m-d H:i:s', strtotime( min( $value ) ) + $offset * HOUR_IN_SECONDS ); // client time zone offset - $to_date = date( 'Y-m-d H:i:s', strtotime( max( $value ) ) + $offset * HOUR_IN_SECONDS + DAY_IN_SECONDS - 1 ); // time 23:59 + $to_date = date( 'Y-m-d H:i:s', strtotime( max( $value ) ) + $offset * HOUR_IN_SECONDS + DAY_IN_SECONDS - 1 ); // time 23:59 - $this->where_clauses[] = $wpdb->prepare( "u.user_registered BETWEEN %s AND %s", $from_date, $to_date ); + $this->where_clauses[] = $wpdb->prepare( 'u.user_registered BETWEEN %s AND %s', $from_date, $to_date ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; + case 'last_login': $offset = 0; if ( ! $is_default ) { + // phpcs:disable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) { $offset = (int) $_POST['gmt_offset']; } + // phpcs:enable WordPress.Security.NonceVerification -- early verified in `ajax_get_members()`. } else { $gmt_offset = get_post_meta( $directory_data['form_id'], '_um_search_filters_gmt', true ); if ( is_numeric( $gmt_offset ) ) { @@ -431,42 +486,42 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $from_date = gmdate( 'Y-m-d H:i:s', (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ) ); // client time zone offset $to_date = gmdate( 'Y-m-d H:i:s', (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1 ); // time 23:59 - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID"; - - $this->where_clauses[] = $wpdb->prepare( "( {$join_slug}{$i}.um_key = '_um_last_login' AND {$join_slug}{$i}.um_value BETWEEN %s AND %s )", $from_date, $to_date ); + // $join_alias is pre-escaped. + $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $join_alias is pre-escaped. + $this->where_clauses[] = $wpdb->prepare( "( {$join_alias}.um_key = '_um_last_login' AND {$join_alias}.um_value BETWEEN %s AND %s )", $from_date, $to_date ); if ( ! $is_default ) { $this->custom_filters_in_query[ $field ] = $value; } - break; + } } - /** * Main Query function for getting members via AJAX */ - function ajax_get_members() { + public function ajax_get_members() { UM()->check_ajax_nonce(); global $wpdb; $blog_id = get_current_blog_id(); - + // phpcs:disable WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. if ( empty( $_POST['directory_id'] ) ) { wp_send_json_error( __( 'Wrong member directory data', 'ultimate-member' ) ); } $directory_id = $this->get_directory_by_hash( sanitize_key( $_POST['directory_id'] ) ); - if ( empty( $directory_id ) ) { wp_send_json_error( __( 'Wrong member directory data', 'ultimate-member' ) ); } + // phpcs:enable WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. $directory_data = UM()->query()->post_data( $directory_id ); - //predefined result for user without capabilities to see other members + // Predefined result for user without capabilities to see other members. $this->predefined_no_caps( $directory_data ); do_action( 'um_member_directory_before_query' ); @@ -474,7 +529,6 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { // Prepare for BIG SELECT query $wpdb->query( 'SET SQL_BIG_SELECTS=1' ); - if ( ! empty( $directory_data['show_these_users'] ) ) { $show_these_users = maybe_unserialize( $directory_data['show_these_users'] ); @@ -482,7 +536,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $users_array = array(); foreach ( $show_these_users as $username ) { if ( false !== ( $exists_id = username_exists( $username ) ) ) { - $users_array[] = $exists_id; + $users_array[] = absint( $exists_id ); } } @@ -499,7 +553,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $users_array = array(); foreach ( $exclude_these_users as $username ) { if ( false !== ( $exists_id = username_exists( $username ) ) ) { - $users_array[] = $exists_id; + $users_array[] = absint( $exists_id ); } } @@ -522,21 +576,24 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { if ( ! UM()->roles()->um_user_can( 'can_edit_everyone' ) ) { if ( ! $this->general_meta_joined ) { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_general ON umm_general.user_id = u.ID"; + $this->general_meta_joined = true; } + // $profile_photo_where and $cover_photo_where are static in code. $this->where_clauses[] = "( umm_general.um_key = 'um_member_directory_data' AND umm_general.um_value LIKE '%s:14:\"account_status\";s:8:\"approved\";%' AND umm_general.um_value LIKE '%s:15:\"hide_in_members\";b:0;%'{$profile_photo_where}{$cover_photo_where} )"; } else { if ( ! empty( $cover_photo_where ) || ! empty( $profile_photo_where ) ) { if ( ! $this->general_meta_joined ) { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_general ON umm_general.user_id = u.ID"; + $this->general_meta_joined = true; } + // $profile_photo_where and $cover_photo_where are static in code. $this->where_clauses[] = "( umm_general.um_key = 'um_member_directory_data'{$profile_photo_where}{$cover_photo_where} )"; } } - //$this->roles = array(); if ( UM()->roles()->um_user_can( 'can_view_all' ) ) { $view_roles = um_user( 'can_view_roles' ); @@ -560,58 +617,65 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { } if ( ! empty( $this->roles ) ) { - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = '" . $wpdb->get_blog_prefix( $blog_id ) . "capabilities' )"; + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = %s )", $wpdb->get_blog_prefix( $blog_id ) . 'capabilities' ); $roles_clauses = array(); foreach ( $this->roles as $role ) { - $roles_clauses[] = $wpdb->prepare( 'umm_roles.um_value LIKE %s', '%"' . $role . '"%' ); + $roles_clauses[] = $wpdb->prepare( 'umm_roles.um_value LIKE %s', '%"' . $wpdb->esc_like( $role ) . '"%' ); } + // $roles_clauses is pre-prepared. $this->where_clauses[] = '( ' . implode( ' OR ', $roles_clauses ) . ' )'; } else { - if ( ! $this->roles_in_query && is_multisite() ) { // select users who have capabilities for current blog - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = '" . $wpdb->get_blog_prefix( $blog_id ) . "capabilities' )"; - $this->where_clauses[] = "umm_roles.um_value IS NOT NULL"; + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_roles ON ( umm_roles.user_id = u.ID AND umm_roles.um_key = %s )", $wpdb->get_blog_prefix( $blog_id ) . 'capabilities' ); + $this->where_clauses[] = 'umm_roles.um_value IS NOT NULL'; } elseif ( $this->roles_in_query ) { - $member_directory_response = apply_filters( 'um_ajax_get_members_response', array( - 'pagination' => $this->calculate_pagination( $directory_data, 0 ), - 'users' => array(), - 'is_search' => $this->is_search, - ), $directory_data ); + $member_directory_response = array( + 'pagination' => $this->calculate_pagination( $directory_data, 0 ), + 'users' => array(), + 'is_search' => $this->is_search, + ); + $member_directory_response = apply_filters( 'um_ajax_get_members_response', $member_directory_response, $directory_data ); wp_send_json_success( $member_directory_response ); } } + // phpcs:disable WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. if ( ! empty( $_POST['search'] ) ) { $search_line = $this->prepare_search( $_POST['search'] ); + // phpcs:enable WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. if ( ! empty( $search_line ) ) { $searches = array(); foreach ( $this->core_search_fields as $field ) { - $searches[] = $wpdb->prepare( "u.{$field} LIKE %s", '%' . $search_line . '%' ); + $field = esc_sql( $field ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $field is pre-escaped. + $searches[] = $wpdb->prepare( "u.{$field} LIKE %s", '%' . $wpdb->esc_like( $search_line ) . '%' ); } $core_search = implode( ' OR ', $searches ); $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_search ON umm_search.user_id = u.ID"; - $additional_search = apply_filters( 'um_member_directory_meta_general_search_meta_query', '',$search_line ); + $additional_search = apply_filters( 'um_member_directory_meta_general_search_meta_query', '', $search_line ); - $search_like_string = apply_filters( 'um_member_directory_meta_search_like_type', '%' . $search_line . '%', $search_line ); + $search_like_string = apply_filters( 'um_member_directory_meta_search_like_type', '%' . $wpdb->esc_like( $search_line ) . '%', $search_line ); - $this->where_clauses[] = $wpdb->prepare( "( umm_search.um_value = %s OR umm_search.um_value LIKE %s OR umm_search.um_value LIKE %s OR {$core_search}{$additional_search})", $search_line, $search_like_string, '%' . serialize( (string) $search_line ) . '%' ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $core_search and $additional_search are pre-prepared. + $this->where_clauses[] = $wpdb->prepare( "( umm_search.um_value = %s OR umm_search.um_value LIKE %s OR umm_search.um_value LIKE %s OR {$core_search}{$additional_search})", $search_line, $search_like_string, '%' . $wpdb->esc_like( maybe_serialize( (string) $search_line ) ) . '%' ); $this->is_search = true; } } - //filters + // Filters $filter_query = array(); if ( ! empty( $directory_data['search_fields'] ) ) { $search_filters = maybe_unserialize( $directory_data['search_fields'] ); if ( ! empty( $search_filters ) && is_array( $search_filters ) ) { + // phpcs:ignore WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. $filter_query = array_intersect_key( $_POST, array_flip( $search_filters ) ); } } @@ -663,15 +727,16 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { //} $order = 'ASC'; + // phpcs:ignore WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. $sortby = ! empty( $_POST['sorting'] ) ? sanitize_text_field( $_POST['sorting'] ) : $directory_data['sortby']; - $sortby = ( $sortby == 'other' ) ? $directory_data['sortby_custom'] : $sortby; + $sortby = ( 'other' === $sortby ) ? $directory_data['sortby_custom'] : $sortby; $custom_sort = array(); if ( ! empty( $directory_data['sorting_fields'] ) ) { $sorting_fields = maybe_unserialize( $directory_data['sorting_fields'] ); foreach ( $sorting_fields as $field ) { if ( is_array( $field ) ) { - $field_keys = array_keys( $field ); + $field_keys = array_keys( $field ); $custom_sort[] = $field_keys[0]; } } @@ -698,10 +763,10 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { // handle sorting options // sort members by - if ( $sortby == $directory_data['sortby_custom'] || in_array( $sortby, $custom_sort ) ) { + if ( $sortby === $directory_data['sortby_custom'] || in_array( $sortby, $custom_sort, true ) ) { $custom_sort_order = ! empty( $directory_data['sortby_custom_order'] ) ? $directory_data['sortby_custom_order'] : 'ASC'; - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '{$sortby}' )"; + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); $meta_query = new \WP_Meta_Query(); $custom_sort_type = ! empty( $directory_data['sortby_custom_type'] ) ? $meta_query->get_cast_for_type( $directory_data['sortby_custom_type'] ) : 'CHAR'; @@ -721,46 +786,52 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { /** This filter is documented in includes/core/class-member-directory.php */ $custom_sort_type = apply_filters( 'um_member_directory_custom_sorting_type', $custom_sort_type, $sortby, $directory_data ); - $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS {$custom_sort_type} ) {$custom_sort_order} "; + $custom_sort_type = esc_sql( $custom_sort_type ); + $custom_sort_order = esc_sql( $custom_sort_order ); + $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS {$custom_sort_type} ) {$custom_sort_order} "; - } elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys ) ) { + } elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys, true ) ) { - if ( strstr( $sortby, '_desc' ) ) { + if ( false !== strpos( $sortby, '_desc' ) ) { $sortby = str_replace( '_desc', '', $sortby ); - $order = 'DESC'; + $order = 'DESC'; } - if ( strstr( $sortby, '_asc' ) ) { + if ( false !== strpos( $sortby, '_asc' ) ) { $sortby = str_replace( '_asc', '', $sortby ); - $order = 'ASC'; + $order = 'ASC'; } - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '{$sortby}' )"; + $order = esc_sql( $order ); + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS SIGNED ) {$order}, u.user_registered DESC "; - } elseif ( 'username' == $sortby ) { + } elseif ( 'username' === $sortby ) { + $order = esc_sql( $order ); $this->sql_order = " ORDER BY u.user_login {$order} "; - } elseif ( 'display_name' == $sortby ) { + } elseif ( 'display_name' === $sortby ) { $display_name = UM()->options()->get( 'display_name' ); - if ( $display_name == 'username' ) { + if ( 'username' === $display_name ) { + $order = esc_sql( $order ); $this->sql_order = " ORDER BY u.user_login {$order} "; } else { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = 'full_name' )"; + $order = esc_sql( $order ); $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order}, u.display_name {$order} "; } + } elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ), true ) ) { - } elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ) ) ) { - - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '{$sortby}' )"; + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); + $order = esc_sql( $order ); $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} "; } elseif ( 'last_login' === $sortby ) { @@ -768,20 +839,22 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '_um_last_login' )"; $this->sql_order = ' ORDER BY CAST( umm_sort.um_value AS DATETIME ) DESC '; - } elseif ( $sortby == 'last_first_name' ) { + } elseif ( 'last_first_name' === $sortby ) { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = 'last_name' )"; $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort2 ON ( umm_sort2.user_id = u.ID AND umm_sort2.um_key = 'first_name' )"; - $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) ASC, CAST( umm_sort2.um_value AS CHAR ) ASC "; + $this->sql_order = ' ORDER BY CAST( umm_sort.um_value AS CHAR ) ASC, CAST( umm_sort2.um_value AS CHAR ) ASC '; - } elseif ( $sortby == 'random' ) { + } elseif ( 'random' === $sortby ) { if ( um_is_session_started() === false ) { + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged @session_start(); } // Reset seed on load of initial + // phpcs:ignore WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. if ( empty( $_REQUEST['directory_id'] ) && isset( $_SESSION['um_member_directory_seed'] ) ) { unset( $_SESSION['um_member_directory_seed'] ); } @@ -794,29 +867,34 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { // Set new seed if none exists if ( ! $seed ) { - $seed = rand(); + $seed = wp_rand(); + $_SESSION['um_member_directory_seed'] = $seed; } + $seed = esc_sql( $seed ); $this->sql_order = 'ORDER BY RAND(' . $seed . ')'; } else { - if ( strstr( $sortby, '_desc' ) ) { + if ( false !== strpos( $sortby, '_desc' ) ) { $sortby = str_replace( '_desc', '', $sortby ); - $order = 'DESC'; + $order = 'DESC'; } - if ( strstr( $sortby, '_asc' ) ) { + if ( false !== strpos( $sortby, '_asc' ) ) { $sortby = str_replace( '_asc', '', $sortby ); - $order = 'ASC'; + $order = 'ASC'; } $metakeys = get_option( 'um_usermeta_fields', array() ); - if ( false !== array_search( $sortby, $metakeys ) ) { - $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '{$sortby}' )"; + if ( in_array( $sortby, $metakeys, true ) ) { + $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); + $order = esc_sql( $order ); $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} "; } else { + $sortby = esc_sql( $sortby ); + $order = esc_sql( $order ); $this->sql_order = " ORDER BY u.{$sortby} {$order} "; } } @@ -829,11 +907,11 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { } $query_number = ( ! empty( $directory_data['max_users'] ) && $directory_data['max_users'] <= $profiles_per_page ) ? $directory_data['max_users'] : $profiles_per_page; - $query_paged = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; + $query_paged = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification -- verified via `UM()->check_ajax_nonce();`. $number = $query_number; - if ( ! empty( $directory_data['max_users'] ) && $query_paged*$query_number > $directory_data['max_users'] ) { - $number = ( $query_paged*$query_number - ( $query_paged*$query_number - $directory_data['max_users'] ) ) % $query_number; + if ( ! empty( $directory_data['max_users'] ) && $query_paged * $query_number > $directory_data['max_users'] ) { + $number = ( $query_paged * $query_number - ( $query_paged * $query_number - $directory_data['max_users'] ) ) % $query_number; } // limit @@ -843,11 +921,11 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { do_action( 'um_pre_users_query', $this, $directory_data, $sortby ); - $sql_join = implode( ' ', $this->joins ); - $sql_where = implode( ' AND ', $this->where_clauses ); - $sql_where = ! empty( $sql_where ) ? 'AND ' . $sql_where : ''; - - global $wpdb; + $sql_select = esc_sql( $this->select ); + $sql_having = esc_sql( $this->having ); + $sql_join = implode( ' ', $this->joins ); + $sql_where = implode( ' AND ', $this->where_clauses ); + $sql_where = ! empty( $sql_where ) ? 'AND ' . $sql_where : ''; /* * @@ -857,11 +935,11 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { * */ $user_ids = $wpdb->get_col( "SELECT SQL_CALC_FOUND_ROWS DISTINCT u.ID - {$this->select} + {$sql_select} FROM {$wpdb->users} AS u {$sql_join} WHERE 1=1 {$sql_where} - {$this->having} + {$sql_having} {$this->sql_order} {$this->sql_limit}" ); @@ -901,7 +979,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $this->cover_size = UM()->mobile()->isTablet() ? $sizes[1] : end( $sizes ); - $avatar_size = UM()->options()->get( 'profile_photosize' ); + $avatar_size = UM()->options()->get( 'profile_photosize' ); $this->avatar_size = str_replace( 'px', '', $avatar_size ); $users = array(); @@ -912,11 +990,12 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { um_reset_user(); // end of user card - $member_directory_response = apply_filters( 'um_ajax_get_members_response', array( - 'pagination' => $pagination_data, - 'users' => $users, - 'is_search' => $this->is_search, - ), $directory_data ); + $member_directory_response = array( + 'pagination' => $pagination_data, + 'users' => $users, + 'is_search' => $this->is_search, + ); + $member_directory_response = apply_filters( 'um_ajax_get_members_response', $member_directory_response, $directory_data ); wp_send_json_success( $member_directory_response ); } From e00f17edc16d45fe1fe3d889c383bdcb3d777247 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Fri, 2 Feb 2024 11:13:38 +0200 Subject: [PATCH 27/76] - fix unique value on registration --- includes/core/um-actions-form.php | 83 ++++++++++++++----------------- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 1cbf29e5..1e585a98 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -821,7 +821,7 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { case 'soundcloud_url': if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'soundcloud.com' ) ) { // translators: %s: label. - UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL','ultimate-member'), $array['label'] ) ); + UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) ); } break; @@ -840,7 +840,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'instagram_url': - if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'instagram.com' ) ) { // translators: %s: label. UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) ); @@ -861,7 +860,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'tiktok_url': - if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'tiktok.com' ) ) { // translators: %s: label. UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) ); @@ -869,7 +867,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'twitch_url': - if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'twitch.tv' ) ) { // translators: %s: label. UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) ); @@ -877,7 +874,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'reddit_url': - if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'reddit.com' ) ) { // translators: %s: label. UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) ); @@ -891,10 +887,9 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'unique_username': - - if ( $submitted_data[ $key ] == '' ) { + if ( '' === $submitted_data[ $key ] ) { UM()->form()->add_error( $key, __( 'You must provide a username', 'ultimate-member' ) ); - } elseif ( $mode == 'register' && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) { + } elseif ( 'register' === $mode && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) { UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) ); } elseif ( is_email( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'Username cannot be an email', 'ultimate-member' ) ); @@ -905,12 +900,11 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'unique_username_or_email': - - if ( $submitted_data[ $key ] == '' ) { + if ( '' === $submitted_data[ $key ] ) { UM()->form()->add_error( $key, __( 'You must provide a username or email', 'ultimate-member' ) ); - } elseif ( $mode == 'register' && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) { + } elseif ( 'register' === $mode && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) { UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) ); - } elseif ( $mode == 'register' && email_exists( $submitted_data[ $key ] ) ) { + } elseif ( 'register' === $mode && email_exists( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) ); @@ -919,98 +913,92 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; case 'unique_email': - $submitted_data[ $key ] = trim( $submitted_data[ $key ] ); - if ( in_array( $key, array( 'user_email' ) ) ) { - - if ( ! isset( $submitted_data['user_id'] ) ){ + if ( in_array( $key, array( 'user_email' ), true ) ) { + if ( ! isset( $submitted_data['user_id'] ) ) { $submitted_data['user_id'] = um_get_requested_user(); } $email_exists = email_exists( $submitted_data[ $key ] ); - if ( $submitted_data[ $key ] == '' && in_array( $key, array( 'user_email' ) ) ) { + if ( '' === $submitted_data[ $key ] && in_array( $key, array( 'user_email' ), true ) ) { UM()->form()->add_error( $key, __( 'You must provide your email', 'ultimate-member' ) ); - } elseif ( in_array( $mode, array( 'register' ) ) && $email_exists ) { + } elseif ( in_array( $mode, array( 'register' ), true ) && $email_exists ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); - } elseif ( in_array( $mode, array( 'profile' ) ) && $email_exists && $email_exists != $submitted_data['user_id'] ) { + } elseif ( in_array( $mode, array( 'profile' ), true ) && $email_exists && $email_exists !== $submitted_data['user_id'] ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } elseif ( ! is_email( $submitted_data[ $key ] ) ) { - UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member') ); + UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) { - UM()->form()->add_error( $key, __( 'Your email contains invalid characters', 'ultimate-member' ) ); + UM()->form()->add_error( $key, __( 'Your email contains invalid characters', 'ultimate-member' ) ); } - } else { - if ( $submitted_data[ $key ] != '' && ! is_email( $submitted_data[ $key ] ) ) { + if ( '' !== $submitted_data[ $key ] && ! is_email( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); - } elseif ( $submitted_data[ $key ] != '' && email_exists( $submitted_data[ $key ] ) ) { + } elseif ( '' !== $submitted_data[ $key ] && email_exists( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); - } elseif ( $submitted_data[ $key ] != '' ) { + } elseif ( '' !== $submitted_data[ $key ] ) { $users = get_users( 'meta_value=' . $submitted_data[ $key ] ); foreach ( $users as $user ) { - if ( $user->ID != $submitted_data['user_id'] ) { + if ( $user->ID !== $submitted_data['user_id'] ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } } - } - } break; case 'is_email': - $submitted_data[ $key ] = trim( $submitted_data[ $key ] ); - if ( $submitted_data[ $key ] != '' && ! is_email( $submitted_data[ $key ] ) ) { + if ( '' !== $submitted_data[ $key ] && ! is_email( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'This is not a valid email', 'ultimate-member' ) ); } break; case 'unique_value': + if ( '' !== $submitted_data[ $key ] ) { - if ( $submitted_data[ $key ] != '' ) { + if ( ! isset( $submitted_data['user_id'] ) ) { + $submitted_data['user_id'] = um_get_requested_user(); + } $args_unique_meta = array( - 'meta_key' => $key, - 'meta_value' => $submitted_data[ $key ], - 'compare' => '=', - 'exclude' => array( $submitted_data['user_id'] ), + 'meta_key' => $key, + 'meta_value' => $submitted_data[ $key ], + 'compare' => '=', + 'exclude' => array( $submitted_data['user_id'] ), ); $meta_key_exists = get_users( $args_unique_meta ); if ( $meta_key_exists ) { - UM()->form()->add_error( $key , __( 'You must provide a unique value', 'ultimate-member' ) ); + UM()->form()->add_error( $key, __( 'You must provide a unique value', 'ultimate-member' ) ); } } break; case 'alphabetic': - - if ( $submitted_data[ $key ] != '' ) { + if ( '' !== $submitted_data[ $key ] ) { if ( ! preg_match( '/^\p{L}+$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { UM()->form()->add_error( $key, __( 'You must provide alphabetic letters', 'ultimate-member' ) ); } - } break; case 'lowercase': + if ( '' !== $submitted_data[ $key ] ) { - if ( $submitted_data[ $key ] != '' ) { - - if ( ! ctype_lower( str_replace(' ', '', $submitted_data[ $key ] ) ) ) { - UM()->form()->add_error( $key , __( 'You must provide lowercase letters.', 'ultimate-member' ) ); + if ( ! ctype_lower( str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { + UM()->form()->add_error( $key, __( 'You must provide lowercase letters.', 'ultimate-member' ) ); } } @@ -1076,9 +1064,12 @@ add_action( 'um_submit_form_errors_hook_', 'um_submit_form_errors_hook_', 10, 2 * @return string */ function um_invalid_nonce_redirect_url( $url ) { - $url = add_query_arg( [ - 'um-hash' => substr( md5( rand() ), 0, 6 ), - ], remove_query_arg( 'um-hash', $url ) ); + $url = add_query_arg( + array( + 'um-hash' => substr( md5( rand() ), 0, 6 ), + ), + remove_query_arg( 'um-hash', $url ) + ); return $url; } From b406edc0ac29322947dea6ffbb5f39979db2eaad Mon Sep 17 00:00:00 2001 From: ashubawork Date: Fri, 2 Feb 2024 12:18:16 +0200 Subject: [PATCH 28/76] - add english letters validation --- includes/core/um-actions-form.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 1cbf29e5..8cde2e5d 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -1016,6 +1016,16 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; + case 'english': + if ( '' !== $submitted_data[ $key ] ) { + + if ( ! preg_match( '/^[a-zA-Z]*$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { + UM()->form()->add_error( $key, __( 'You must provide english letters', 'ultimate-member' ) ); + } + } + + break; + } } // end if ( isset in args array ) From a49b3061ded1630e4f6860b4ebece5ccf0a493d2 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 2 Feb 2024 13:16:14 +0200 Subject: [PATCH 29/76] - changed doc's example; --- includes/core/um-actions-profile.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 49e58869..763c67c8 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -1576,7 +1576,8 @@ function um_submit_form_profile( $args, $form_data ) { * function my_user_edit_profile( $post, $form_data ) { * // your code here * } - * add_action( 'um_user_edit_profile', 'my_user_edit_profile', 10, 2 ); + * // Don't use priority >= 10 because there is native Ultimate Member handler on it. + * add_action( 'um_user_edit_profile', 'my_user_edit_profile', 9, 2 ); */ do_action( 'um_user_edit_profile', $args, $form_data ); } From 476de92f4c9aaa56c3e2f5527b242ce0476f4655 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 5 Feb 2024 10:54:54 +0200 Subject: [PATCH 30/76] - added validation before escape sql; --- includes/core/class-member-directory-meta.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/core/class-member-directory-meta.php b/includes/core/class-member-directory-meta.php index d34eb10c..af7ec747 100644 --- a/includes/core/class-member-directory-meta.php +++ b/includes/core/class-member-directory-meta.php @@ -785,9 +785,11 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { /** This filter is documented in includes/core/class-member-directory.php */ $custom_sort_type = apply_filters( 'um_member_directory_custom_sorting_type', $custom_sort_type, $sortby, $directory_data ); + $custom_sort_type = esc_sql( $custom_sort_type ); + $custom_sort_type = in_array( strtoupper( $custom_sort_type ), $this->sort_data_types, true ) ? $custom_sort_type : 'CHAR'; - $custom_sort_type = esc_sql( $custom_sort_type ); $custom_sort_order = esc_sql( $custom_sort_order ); + $custom_sort_order = in_array( strtoupper( $custom_sort_order ), array( 'ASC', 'DESC' ), true ) ? $custom_sort_order : 'ASC'; $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS {$custom_sort_type} ) {$custom_sort_order} "; } elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys, true ) ) { @@ -803,12 +805,14 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { } $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS SIGNED ) {$order}, u.user_registered DESC "; } elseif ( 'username' === $sortby ) { $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY u.user_login {$order} "; } elseif ( 'display_name' === $sortby ) { @@ -817,6 +821,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { if ( 'username' === $display_name ) { $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY u.user_login {$order} "; } else { @@ -824,6 +829,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = 'full_name' )"; $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order}, u.display_name {$order} "; } @@ -832,6 +838,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} "; } elseif ( 'last_login' === $sortby ) { @@ -862,7 +869,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { // Get seed from session variable if it exists $seed = false; if ( isset( $_SESSION['um_member_directory_seed'] ) ) { - $seed = $_SESSION['um_member_directory_seed']; + $seed = (int) $_SESSION['um_member_directory_seed']; } // Set new seed if none exists @@ -891,10 +898,12 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { if ( in_array( $sortby, $metakeys, true ) ) { $this->joins[] = $wpdb->prepare( "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = %s )", $sortby ); $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} "; - } else { + } elseif ( in_array( $sortby, $this->core_search_fields, true ) ) { $sortby = esc_sql( $sortby ); $order = esc_sql( $order ); + $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY u.{$sortby} {$order} "; } } From 94b236cc178673b2b5f0df818b7283bcb9cb6001 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 01:16:34 +0200 Subject: [PATCH 31/76] - wpcs; --- includes/core/um-actions-form.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 1e585a98..c1c7689e 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -896,7 +896,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { } elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) ); } - break; case 'unique_username_or_email': @@ -909,24 +908,23 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { } elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) ); } - break; case 'unique_email': $submitted_data[ $key ] = trim( $submitted_data[ $key ] ); - if ( in_array( $key, array( 'user_email' ), true ) ) { + if ( 'user_email' === $key ) { if ( ! isset( $submitted_data['user_id'] ) ) { $submitted_data['user_id'] = um_get_requested_user(); } $email_exists = email_exists( $submitted_data[ $key ] ); - if ( '' === $submitted_data[ $key ] && in_array( $key, array( 'user_email' ), true ) ) { + if ( '' === $submitted_data[ $key ] ) { UM()->form()->add_error( $key, __( 'You must provide your email', 'ultimate-member' ) ); - } elseif ( in_array( $mode, array( 'register' ), true ) && $email_exists ) { + } elseif ( 'register' === $mode && $email_exists ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); - } elseif ( in_array( $mode, array( 'profile' ), true ) && $email_exists && $email_exists !== $submitted_data['user_id'] ) { + } elseif ( 'profile' === $mode && $email_exists && $email_exists !== $submitted_data['user_id'] ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } elseif ( ! is_email( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); @@ -950,16 +948,13 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { } } } - break; case 'is_email': $submitted_data[ $key ] = trim( $submitted_data[ $key ] ); - if ( '' !== $submitted_data[ $key ] && ! is_email( $submitted_data[ $key ] ) ) { UM()->form()->add_error( $key, __( 'This is not a valid email', 'ultimate-member' ) ); } - break; case 'unique_value': @@ -986,22 +981,18 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { case 'alphabetic': if ( '' !== $submitted_data[ $key ] ) { - if ( ! preg_match( '/^\p{L}+$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { UM()->form()->add_error( $key, __( 'You must provide alphabetic letters', 'ultimate-member' ) ); } } - break; case 'lowercase': if ( '' !== $submitted_data[ $key ] ) { - if ( ! ctype_lower( str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { UM()->form()->add_error( $key, __( 'You must provide lowercase letters.', 'ultimate-member' ) ); } } - break; } From 7698bd1c36994dd15f67657ee9b20d667f89a0fd Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 01:49:56 +0200 Subject: [PATCH 32/76] - reviewed #1449; --- includes/admin/core/class-admin-settings.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 275a2358..6e130073 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -3542,8 +3542,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $settings; } + $wp_default_protocols = wp_allowed_protocols(); + $protocols = array_merge( $wp_default_protocols, array( 'data' ) ); + $template = $settings['um_email_template']; - $content = wp_kses( stripslashes( $settings[ $template ] ), 'post', array( 'data' ) ); + $content = wp_kses( stripslashes( $settings[ $template ] ), 'post', $protocols ); $theme_template_path = UM()->mail()->get_template_file( 'theme', $template ); if ( ! file_exists( $theme_template_path ) ) { From 928ae8396848732d126885f3a9aee6f83feea459 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 01:51:38 +0200 Subject: [PATCH 33/76] - minified scripts; --- assets/css/admin/forms.min.css | 2 +- assets/js/admin/forms.min.js | 2 +- assets/js/um-functions.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/css/admin/forms.min.css b/assets/css/admin/forms.min.css index 7ef70bc9..4bde8a55 100644 --- a/assets/css/admin/forms.min.css +++ b/assets/css/admin/forms.min.css @@ -1 +1 @@ -.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2 select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} +.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2>select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file diff --git a/assets/js/admin/forms.min.js b/assets/js/admin/forms.min.js index 7117ccbf..0dce460a 100644 --- a/assets/js/admin/forms.min.js +++ b/assets/js/admin/forms.min.js @@ -1 +1 @@ -function um_admin_init_users_select(){function e(a){var t;if(!a.id)return a.text;if(void 0!==a.img)t=jQuery(' '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),um_admin_init_pages_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).parents("label").siblings(".um-same-page-update-"+e).show():jQuery(this).parents("label").siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,g,h;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==g&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==g&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return g=u.prop("tagName").toLowerCase(),(d="input"==g&&"checkbox"==(h=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0 '+a.text+"");else{let e;t=(e=void 0!==a.element&&void 0!==a.element.attributes["data-img"]?a.element.attributes["data-img"].value:e)?jQuery(' '+a.text+""):jQuery(""+a.text+"")}return t}var a,t;jQuery(".um-user-select-field:visible:not(.um-select2-inited)").length&&(a={ajax:{url:wp.ajax.settings.url,dataType:"json",delay:250,data:function(e){var a={action:"um_get_users",search:e.term,page:e.page||1,nonce:um_admin_scripts.nonce};return jQuery.each(jQuery(this)[0].attributes,function(){var e;this.specified&&-1!==this.name.indexOf("data-ajax-args-")&&(e=this.name.replace("data-ajax-args-","").trim(),a[e]=this.value)}),a},processResults:function(e,a){a.page=a.page||1;var t=[];return e.data.users&&jQuery.each(e.data.users,function(e,a){void 0!==a.img?t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")",img:a.img}):t.push({id:a.ID,text:a.user_login+" (#"+a.ID+")"})}),{results:t,pagination:{more:20*a.page")}function um_same_page_wrong_ajax(e){um_add_same_page_log(e,wp.i18n.__("Wrong AJAX response...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}function um_same_page_something_wrong(e){um_add_same_page_log(e,wp.i18n.__("Something went wrong with AJAX request...","ultimate-member")),um_add_same_page_log(e,wp.i18n.__("Your upgrade was crashed, please contact with support","ultimate-member"))}jQuery(document).ready(function(){um_admin_init_users_select(),um_admin_init_pages_select(),jQuery(document.body).on("click",".um-forms-field[data-log-object]",function(){var e=jQuery(this).data("log-object");jQuery(this).is(":checked")?jQuery(this).parents("label").siblings(".um-same-page-update-"+e).show():jQuery(this).parents("label").siblings(".um-same-page-update-"+e).hide()}),jQuery(document.body).on("click",".um-admin-form-same-page-update",function(){var t,a,i,s=jQuery(this).data("upgrade_cb");jQuery(this).prop("disabled",!0),um_add_same_page_log(s,wp.i18n.__("Upgrade Process Started...","ultimate-member")),"sync_metatable"===s?(t=0,a=500,jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_usermeta_fields",nonce:um_admin_scripts.nonce},success:function(e){i=1,um_add_same_page_log(s,wp.i18n.__("Getting metadata","ultimate-member")),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_get_metadata",nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data.count?(um_add_same_page_log(s,wp.i18n.__("There are ","ultimate-member")+e.data.count+wp.i18n.__(" metadata rows...","ultimate-member")),um_add_same_page_log(s,wp.i18n.__("Start metadata upgrading...","ultimate-member")),t=Math.ceil(e.data.count/a),function a(){i<=t?jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_same_page_update",cb_func:"um_update_metadata_per_page",page:i,nonce:um_admin_scripts.nonce},success:function(e){void 0!==e.data?(um_add_same_page_log(s,e.data.message),i++,a()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}}):window.location=um_forms_data.successfully_redirect}()):um_same_page_wrong_ajax(s)},error:function(){um_same_page_something_wrong(s)}})},error:function(){um_same_page_something_wrong(s)}})):wp.hooks.doAction("um_same_page_upgrade",s)}),jQuery(".um-sortable-items-field").sortable({items:".um-sortable-item",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0,update:function(e,a){var t=[];jQuery(this).find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||t.push(jQuery(this).data("tab-id"))}),jQuery(this).siblings(".um-sortable-items-value").val(t.join(","))}}),jQuery(".um-multi-selects-list.um-sortable-multi-selects").sortable({items:".um-admin-drag-fld",connectWith:".um-admin-drag-col,.um-admin-drag-group",forcePlaceholderSize:!0}),jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each(function(){"other"===jQuery(this).find(".um-field-wrapper:not(.um-custom-order-fields) select").val()?jQuery(this).find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery('.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option').on("click",function(){var e=jQuery(this).siblings("ul.um-multi-selects-list"),a=e.hasClass("um-sortable-multi-selects"),t=(e.data("field_id"),0),i=(0").append(e.siblings(".um-hidden-multi-selects").clone()).html()),s='
  • ';a&&(s+='');let l="";jQuery.each(um_forms_data.md_sorting_data_types,function(e,a){l+='"}),s+=''+i+''+wp.i18n.__("Remove","ultimate-member")+'
  • ',e.append(s),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t).trigger("change"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][meta_key]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][label]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="data_type"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][data_type]"),jQuery("#"+e.data("id_attr")+"-"+t).parents("li").find('.um-field-wrapper.um-custom-order-fields select[name="order"]').attr("name","um_metadata[_um_sorting_fields][other_data]["+t+"][order]")}),jQuery(document.body).on("change",'.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select',function(){"other"===jQuery(this).val()?jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").show():jQuery(this).parents("li").find(".um-field-wrapper.um-custom-order-fields").hide()}),jQuery(document.body).on("click",".um-multi-selects-option-line .um-select-delete",function(){jQuery(this).parents("li.um-multi-selects-option-line").remove()}),jQuery(document.body).on("click",".um-md-default-filters-option-line .um-select-delete",function(){jQuery(this).parents("li.um-md-default-filters-option-line").remove()}),jQuery(".um-multi-selects-add-option").on("click",function(){var e,a,t,i;jQuery(this).parents('.um-forms-line[data-field_type="md_sorting_fields"]').length||(a=(e=jQuery(this).siblings("ul.um-multi-selects-list")).hasClass("um-sortable-multi-selects"),e.data("field_id"),(t=0)',a&&(i+=''),i+=''+jQuery("
    ").append(e.siblings(".um-hidden-multi-selects").clone()).html()+''+wp.i18n.__("Remove","ultimate-member")+"",e.append(i),e.find("li:last .um-hidden-multi-selects").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-selects").attr("id",e.data("id_attr")+"-"+t))});var t,e=-(new Date).getTimezoneOffset()/60,i=(jQuery('input[name="um-gmt-offset"]').val(e),jQuery(".um-admin-metabox").find(".um-slider").each(function(){var e=jQuery(this),a=parseInt(e.data("min")),t=parseInt(e.data("max")),a=[a=void 0!==jQuery("#"+e.data("field_name")+"_min").val()?jQuery("#"+e.data("field_name")+"_min").val():a,t=void 0!==jQuery("#"+e.data("field_name")+"_max").val()?jQuery("#"+e.data("field_name")+"_max").val():t];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),jQuery(".um-admin-metabox").find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur(),e.siblings(".picker").find(".picker__button--close").addClass("button")},onClose:function(){e.blur()},onSet:function(e){}}).pickadate("picker").set("select",1e3*e.data("value"))}),jQuery(".um-admin-metabox").find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})}),!1);function s(e,a){var t,i="",s=e.siblings(".um-slider-range").data("placeholder-s"),l=e.siblings(".um-slider-range").data("placeholder-p"),a=a?(i=(a.values[0]===a.values[1]?s.replace("{value}",a.values[0]):l.replace("{min_range}",a.values[0]).replace("{max_range}",a.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=a.values[0],a.values[1]):(i=(e.slider("values",0)===e.slider("values",1)?s.replace("{value}",e.slider("values",0)):l.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function a(){jQuery(".um-forms-line").removeClass("um-forms-line-conditioned").each(function(){void 0===jQuery(this).data("conditional")||jQuery(this).hasClass("um-forms-line-conditioned")||(!function i(e){e.addClass("um-forms-line-conditioned");var a=e.data("conditional");var t=a[1];var s=a[2];var l=e.data("prefix");var n=!0;{var r,u;"="===t||"!="===t?-1===a[0].indexOf("||")&&void 0!==(u=jQuery("#"+l+"_"+a[0])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line"))):"~"===t?(m=a[0].split("|"),r=[],jQuery.each(m,function(e){r.push(jQuery("#"+l+"_"+m[e]))}),void 0!==r[0].parents(".um-forms-line").data("conditional")&&(n=i(r[0].parents(".um-forms-line")))):"><"===t&&void 0!==(u=jQuery("#"+l+"_"+a[0]+"_"+a[2])).parents(".um-forms-line").data("conditional")&&(n=i(u.parents(".um-forms-line")))}var d=!1;{var m,o,c,p,f,_,g,h;if("="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?e.is(":checked"):!e.is(":checked"):Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s):"select"===t&&(d=Array.isArray(s)?-1!==s.indexOf(e.val()):e.val()==s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?u.is(":checked"):!u.is(":checked"):Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s):"select"==g&&(d=Array.isArray(s)?-1!==s.indexOf(u.val()):u.val()==s),d&&n);if("!="===t)return-1!==a[0].indexOf("||")?(m=a[0].split("||"),o=!1,jQuery.each(m,function(e){var a,e=jQuery("#"+l+"_"+m[e]),t=(n=!(d=!1),void 0!==e.parents(".um-forms-line").data("conditional")&&(n=i(e.parents(".um-forms-line"))),e.prop("tagName").toLowerCase());"input"===t?(a=e.attr("type"),d="checkbox"===a?"1"==s?!e.is(":checked"):e.is(":checked"):e.val()!=s):"select"===t&&(d=e.val()!=s),d&&n&&(o=!0)}),o):("input"==(g=u.prop("tagName").toLowerCase())?(h=u.attr("type"),d="checkbox"==h?"1"==s?!u.is(":checked"):u.is(":checked"):u.val()!=s):"select"==g&&(d=u.val()!=s),d&&n);if("~"===t)return p=[],"sortable_items"===e.data("field_type")?(c=e.find(".um-sortable-items-value").data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.siblings(".um-sortable-items-field").find("li").addClass("um-hidden-item"),jQuery.each(p,function(e){f.siblings(".um-sortable-items-field").find('li[data-tab-id="'+p[e]+'"]').removeClass("um-hidden-item")}),_=[],f.siblings(".um-sortable-items-field").find("li").each(function(){jQuery(this).hasClass("um-hidden-item")||_.push(jQuery(this).data("tab-id"))}),f.val(_.join(",")),f.siblings(".um-sortable-items-field").sortable("refresh"),d=!0):f.val(null)):(c=e.find(e.data("field_type")).data("field_id"),jQuery.each(r,function(e){var e=r[e],a=e.prop("tagName").toLowerCase();"input"===a?"checkbox"===e.attr("type")&&"1"==s&&e.is(":checked")&&p.push(e.data("fill_"+c)):"select"==a&&!s&&e.val()&&(p=(p=p.concat(e.val())).filter(y))}),f=jQuery('[data-field_id="'+c+'"]'),p.length?(f.find("option").hide(),jQuery.each(p,function(e){f.find('option[value="'+p[e]+'"]').show()}),-1===p.indexOf(f.val())&&(f.val(p[0]),f.find("option").attr("selected",!1).prop("selected",!1),f.find('option[value="'+p[0]+'"]').attr("selected",!0).prop("selected",!0)),d=!0):(f.val(null),f.find("option").attr("selected",!1).prop("selected",!1))),d&&n;if("><"===t)return g=u.prop("tagName").toLowerCase(),(d="input"==g&&"checkbox"==(h=u.attr("type"))?u.is(":checked"):d)&&n}return!1}(jQuery(this))?jQuery(this).hide():(jQuery(this).show(),um_admin_init_users_select()))})}function y(e,a,t){return t.indexOf(e)===a}jQuery(document.body).on("change",".um-md-default-filters-option-line .um-field-wrapper select",function(){var t,e,a;i||(e=(t=jQuery(this)).val(),a=t.data("member_directory"),i=!0,wp.ajax.send("um_member_directory_default_filter_settings",{data:{key:e,directory_id:a,nonce:um_admin_scripts.nonce},success:function(e){var a=t.parents(".um-md-default-filters-option-line").find(".um-field-wrapper2");a.html(e.field_html),i=!1,a.find(".um-slider").each(function(){var e=jQuery(this),a=[parseInt(e.data("min")),parseInt(e.data("max"))];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:a,create:function(e,a){},step:1,slide:function(e,a){s(jQuery(this),a)},stop:function(e,a){}}),s(e)}),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),a=new Date(1e3*e.data("date_min")),t=new Date(1e3*e.data("date_max"));e.pickadate({selectYears:!0,min:a,max:t,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur(),e.siblings(".picker").find(".picker__button--close").addClass("button")},onClose:function(){e.blur()},onSet:function(e){}})}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),a=e.data("min"),t=e.data("max"),a=a.split(":"),t=t.split(":");e.pickatime({format:e.data("format"),interval:parseInt(e.data("intervals")),min:[a[0],a[1]],max:[t[0],t[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()},onSet:function(e){}})})},error:function(e){return!1}}))}),jQuery(".um-md-default-filters-add-option").on("click",function(){var e,a,t;i||((e=jQuery(this).siblings("ul.um-md-default-filters-list")).data("field_id"),(a=0)").append(e.siblings(".um-hidden-md-default-filters").clone()).html(),e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+'
  • '),e.find("li:last .um-hidden-md-default-filters").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-md-default-filters").attr("id",e.data("id_attr")+"-"+a),e.find("li:last .um-field-wrapper select").trigger("change"))}),jQuery(document.body).on("click",".um-text-delete",function(){jQuery(this).parents("li.um-multi-text-option-line").remove()}),jQuery(".um-multi-text-add-option").on("click",function(){var e=jQuery(this).siblings("ul.um-multi-text-list"),a=0,t=(0").append(e.siblings(".um-hidden-multi-text").clone()).html()),i=e.data("item_class");e.append('
  • '+t+''+wp.i18n.__("Remove","ultimate-member")+"
  • "),e.find("li:last .um-hidden-multi-text").attr("name",jQuery(this).data("name")).addClass("um-forms-field um-long-field").removeClass("um-hidden-multi-text").attr("id",e.data("id_attr")+"-"+a)}),jQuery(".um-media-upload").each(function(){var e=jQuery(this).find(".um-forms-field"),a=e.data("default");""!=e.val()&&e.val()!=a?(e.siblings(".um-set-image").hide(),e.siblings(".um-clear-image").show(),e.siblings(".icon_preview").show()):(e.val()==a&&e.siblings(".icon_preview").show(),e.siblings(".um-set-image").show(),e.siblings(".um-clear-image").hide())}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&(jQuery(".um-set-image").on("click",function(e){var a=jQuery(this);e.preventDefault(),t&&t.remove(),(t=wp.media({title:a.data("upload_frame"),button:{text:wp.i18n.__("Select","ultimate-member")},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();a.siblings(".icon_preview").attr("src",e.url).show(),a.siblings(".um-forms-field").val(e.url),a.siblings(".um-media-upload-data-id").val(e.id),a.siblings(".um-media-upload-data-width").val(e.width),a.siblings(".um-media-upload-data-height").val(e.height),a.siblings(".um-media-upload-data-thumbnail").val(e.thumbnail),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(e.url),a.siblings(".um-clear-image").show(),a.hide(),jQuery(document).trigger("um_media_upload_select",[a,e])}),t.open()}),jQuery(".icon_preview").on("click",function(e){jQuery(this).siblings(".um-set-image").trigger("click")}),jQuery(".um-clear-image").on("click",function(e){var a=jQuery(this),t=a.siblings(".um-forms-field").data("default");a.siblings(".um-set-image").show(),a.hide(),a.siblings(".icon_preview").attr("src",t),a.siblings(".um-media-upload-data-id").val(""),a.siblings(".um-media-upload-data-width").val(""),a.siblings(".um-media-upload-data-height").val(""),a.siblings(".um-media-upload-data-thumbnail").val(""),a.siblings(".um-forms-field").val(t),a.siblings(".um-media-upload-data-url").trigger("change"),a.siblings(".um-media-upload-url").val(t),jQuery(document).trigger("um_media_upload_clear",a)})),jQuery(document.body).on("change",".um-forms-field",function(){(0'+d.data("upload_help_text")+"":"",icon=d.data("icon")?'':"",upload_text=d.data("upload_text")?''+d.data("upload_text")+"":"";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),d.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:d.data("key"),set_id:d.data("set_id"),set_mode:d.data("set_mode"),_wpnonce:d.data("nonce"),timestamp:d.data("timestamp"),user_id:e},fileName:d.data("key"),allowedTypes:d.data("allowed_types"),maxFileSize:d.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:d.data("max_size_error"),extErrorStr:d.data("extension_error"),maxFileCountErrorStr:d.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){d.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,o,a){d.selectedFiles=0,o.success&&0==o.success||void 0!==o.data.error?(d.parents(".um-modal-body").append('
    '+o.data.error+"
    "),d.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(o.data,function(e,o){var a=d.parents(".um-modal-body").find(".um-single-image-preview img"),t=d.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",o.url+"?"+i.getTime()),a.data("file",o.file),a.on("load",function(){d.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),d.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),t.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(t){upload_help_text=t.data("upload_help_text")?''+t.data("upload_help_text")+"":"",icon=t.data("icon")?'':"",upload_text=t.data("upload_text")?''+t.data("upload_text")+"":"",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),t.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:t.data("key"),set_id:t.data("set_id"),user_id:t.data("user_id"),set_mode:t.data("set_mode"),_wpnonce:t.data("nonce"),timestamp:t.data("timestamp")},fileName:t.data("key"),allowedTypes:t.data("allowed_types"),maxFileSize:t.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:t.data("max_size_error"),extErrorStr:t.data("extension_error"),maxFileCountErrorStr:t.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){t.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,o,a){t.selectedFiles=0,o.success&&0==o.success||void 0!==o.data.error?(t.parents(".um-modal-body").append('
    '+o.data.error+"
    "),t.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(o.data,function(e,o){t.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),t.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),t.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?t.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(o):"icon_bg"==e?t.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":o}):"filename"==e?t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",o):"original_name"==e?(t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",o),t.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(o)):"url"==e&&t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",o)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function um_new_modal(e,o,a,t){var i,d,s,r=jQuery(".um-modal-overlay"),r=(0!==r.length&&(r.hide(),r.next(".um-modal").hide()),UM.common.tipsy.hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),jQuery('
    ')),u=r.filter(".um-modal");u.append(jQuery("#"+e)),jQuery("body").append(r),a?(i=jQuery(''),d=jQuery(window).width()-60,s=jQuery(window).height()-.25*jQuery(window).height(),i.on("load",function(){u.find(".um-modal-photo").html(i),u.addClass("is-photo").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}).show().children().show(),i.css({opacity:0,"max-width":d,"max-height":s}).animate({opacity:1},1e3),um_modal_responsive()})):(u.addClass("no-photo").show().children().show(),um_modal_size(o),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive())}function um_modal_responsive(){var e,o,a=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,i=jQuery(".um-modal:visible").not(".um-modal-hidden"),d=i.find(".um-modal-body.photo:visible");(d.length||i.length)&&(e=(t-i.innerHeight())/2+"px",i.removeClass("uimob340").removeClass("uimob500"),d.length?(d=a-60,t=t-.25*t,(o=jQuery(".um-modal-photo img")).css({opacity:0}),o.css({"max-width":d}),o.css({"max-height":t}),i.css({width:o.width(),"margin-left":"-"+o.width()/2+"px"}),o.animate({opacity:1},1e3),i.animate({bottom:e},300)):i.length&&(a<=340?i.addClass("uimob340"):a<=500&&i.addClass("uimob500"),UM.frontend.cropper.init(),a<=500?i.animate({bottom:0},300):i.animate({bottom:e},300)))}function um_remove_modal(){wp.hooks.doAction("um_remove_modal"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('body > .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('
    '),jQuery("body").append('
    '),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),UM.common.tipsy.hide(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),UM.common.tipsy.init())}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(350<(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80)&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){e=jQuery(e);e.parents("div").find("a").removeClass("active"),e.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var o,a=jQuery(e),t=200,e=jQuery("html").attr("dir"),i=a.attr("data-element"),d=a.attr("data-position"),s=a.attr("data-trigger"),r=i&&jQuery(i).length?jQuery(i):a.siblings("a").length?a.siblings("a").first():a.parent(),u=(r.addClass("um-trigger-menu-on-"+s),0),n=(r.outerWidth()-t)/2,l=r.outerHeight(),i=r.offset();switch(r.is(".um-profile-photo")&&(o=r.find(".um-profile-photo-img"),l=r.closest("div.uimob500").length?r.outerHeight()-o.outerHeight()/4:(n=(o.outerWidth()-t)/2,o.outerHeight()/4)),r.is(".um-cover")&&(o=r.find(".um-cover-e"),l=r.closest("div.uimob500").length?(n=(o.outerWidth()-t)/2,o.outerHeight()/2+24):(n=(o.outerWidth()-t)/2,o.outerHeight()/2+46)),"lc"===d&&"rtl"===e&&(d="rc"),r.outerWidth()'+d.data("upload_help_text")+"":"",icon=d.data("icon")?'':"",upload_text=d.data("upload_text")?''+d.data("upload_text")+"":"";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),d.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:d.data("key"),set_id:d.data("set_id"),set_mode:d.data("set_mode"),_wpnonce:d.data("nonce"),timestamp:d.data("timestamp"),user_id:e},fileName:d.data("key"),allowedTypes:d.data("allowed_types"),maxFileSize:d.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:d.data("max_size_error"),extErrorStr:d.data("extension_error"),maxFileCountErrorStr:d.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){d.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,o,a){d.selectedFiles=0,o.success&&0==o.success||void 0!==o.data.error?(d.parents(".um-modal-body").append('
    '+o.data.error+"
    "),d.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(o.data,function(e,o){var a=d.parents(".um-modal-body").find(".um-single-image-preview img"),t=d.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",o.url+"?"+i.getTime()),a.data("file",o.file),a.on("load",function(){d.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),d.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),t.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(t){upload_help_text=t.data("upload_help_text")?''+t.data("upload_help_text")+"":"",icon=t.data("icon")?'':"",upload_text=t.data("upload_text")?''+t.data("upload_text")+"":"",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),t.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:t.data("key"),set_id:t.data("set_id"),user_id:t.data("user_id"),set_mode:t.data("set_mode"),_wpnonce:t.data("nonce"),timestamp:t.data("timestamp")},fileName:t.data("key"),allowedTypes:t.data("allowed_types"),maxFileSize:t.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:t.data("max_size_error"),extErrorStr:t.data("extension_error"),maxFileCountErrorStr:t.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){t.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,o,a){t.selectedFiles=0,o.success&&0==o.success||void 0!==o.data.error?(t.parents(".um-modal-body").append('
    '+o.data.error+"
    "),t.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(o.data,function(e,o){t.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),t.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),t.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?t.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(o):"icon_bg"==e?t.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":o}):"filename"==e?t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",o):"original_name"==e?(t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",o),t.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(o)):"url"==e&&t.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",o)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function um_new_modal(e,o,a,t){var i,d,s,r=jQuery(".um-modal-overlay"),r=(0!==r.length&&(r.hide(),r.next(".um-modal").hide()),UM.common.tipsy.hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),jQuery('
    ')),u=r.filter(".um-modal");u.append(jQuery("#"+e)),jQuery("body").append(r),a?(i=jQuery(''),d=jQuery(window).width()-60,s=jQuery(window).height()-.25*jQuery(window).height(),i.on("load",function(){u.find(".um-modal-photo").html(i),u.addClass("is-photo").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}).show().children().show(),i.css({opacity:0,"max-width":d,"max-height":s}).animate({opacity:1},1e3),um_modal_responsive()})):(u.addClass("no-photo").show().children().show(),um_modal_size(o),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive())}function um_modal_responsive(){var e,o,a,t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,d=jQuery(".um-modal:visible").not(".um-modal-hidden"),s=d.find(".um-modal-body.photo:visible");(s.length||d.length)&&(e=(i-d.innerHeight())/2+"px",d.removeClass("uimob340").removeClass("uimob500"),s.length?(s=t-60,a=i-.25*i,(o=jQuery(".um-modal-photo img")).css({opacity:0}),o.css({"max-width":s}),o.css({"max-height":a}),d.css({width:o.width(),"margin-left":"-"+o.width()/2+"px"}),o.animate({opacity:1},1e3),d.animate({bottom:e},300)):d.length&&(t<=340?d.addClass("uimob340"):t<=500&&d.addClass("uimob500"),UM.frontend.cropper.init(),t<=500||i-parseInt(e)>i?d.animate({bottom:0},300):d.animate({bottom:e},300)))}function um_remove_modal(){wp.hooks.doAction("um_remove_modal"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('body > .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('
    '),jQuery("body").append('
    '),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),UM.common.tipsy.hide(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),UM.common.tipsy.init())}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(350<(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80)&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){e=jQuery(e);e.parents("div").find("a").removeClass("active"),e.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var o,a=jQuery(e),t=200,e=jQuery("html").attr("dir"),i=a.attr("data-element"),d=a.attr("data-position"),s=a.attr("data-trigger"),r=i&&jQuery(i).length?jQuery(i):a.siblings("a").length?a.siblings("a").first():a.parent(),u=(r.addClass("um-trigger-menu-on-"+s),0),n=(r.outerWidth()-t)/2,l=r.outerHeight(),i=r.offset();switch(r.is(".um-profile-photo")&&(o=r.find(".um-profile-photo-img"),l=r.closest("div.uimob500").length?r.outerHeight()-o.outerHeight()/4:(n=(o.outerWidth()-t)/2,o.outerHeight()/4)),r.is(".um-cover")&&(o=r.find(".um-cover-e"),l=r.closest("div.uimob500").length?(n=(o.outerWidth()-t)/2,o.outerHeight()/2+24):(n=(o.outerWidth()-t)/2,o.outerHeight()/2+46)),"lc"===d&&"rtl"===e&&(d="rc"),r.outerWidth() Date: Tue, 6 Feb 2024 01:55:46 +0200 Subject: [PATCH 34/76] - fixed typo; --- includes/core/um-actions-form.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index c5955100..51b2b4a4 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -997,9 +997,8 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { case 'english': if ( '' !== $submitted_data[ $key ] ) { - if ( ! preg_match( '/^[a-zA-Z]*$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { - UM()->form()->add_error( $key, __( 'You must provide english letters', 'ultimate-member' ) ); + UM()->form()->add_error( $key, __( 'You must provide English letters.', 'ultimate-member' ) ); } } From 2ff2c42395715a9137b4e49c9fb7c7a05862e914 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 6 Feb 2024 10:26:56 +0200 Subject: [PATCH 35/76] - fix aria-invalid attribute --- includes/core/um-actions-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 49e58869..5bf9da35 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -1017,7 +1017,7 @@ function um_profile_header( $args ) { */ do_action( 'um_pre_header_editprofile', $args ); ?> -
    fields()->aria_valid_attributes( UM()->fields()->is_error( 'profile_photo' ), 'profile_photo' ) ); ?>> +
    fields()->aria_valid_attributes( UM()->fields()->is_error( 'profile_photo' ), 'profile_photo' ), UM()->get_allowed_html( 'templates' ) ); ?>> Date: Tue, 6 Feb 2024 10:46:06 +0200 Subject: [PATCH 36/76] - fix bio textarea --- includes/core/um-actions-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 5bf9da35..91893ee6 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -1278,7 +1278,7 @@ function um_profile_header( $args ) { + name="" fields()->aria_valid_attributes( UM()->fields()->is_error( $description_key ), 'um-meta-bio' ), UM()->get_allowed_html( 'templates' ) ); ?>> From d26de2a85caea08cc36bb109feab0c152b5934f8 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 6 Feb 2024 15:19:33 +0200 Subject: [PATCH 37/76] - add alpha_numeric validation to fields --- includes/core/um-actions-form.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 51b2b4a4..259ac140 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -987,6 +987,14 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { } break; + case 'alpha_numeric': + if ( '' !== $submitted_data[ $key ] ) { + if ( ! preg_match( '/^[\p{L}0-9\s]+$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { + UM()->form()->add_error( $key, __( 'You must provide alphabetic letters or numbers', 'ultimate-member' ) ); + } + } + break; + case 'lowercase': if ( '' !== $submitted_data[ $key ] ) { if ( ! ctype_lower( str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { From a747192027835d2eeb073ff218778f3a69998dab Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 15:22:38 +0200 Subject: [PATCH 38/76] - minified styles; --- assets/css/um-styles.min.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/um-styles.min.css b/assets/css/um-styles.min.css index b60d09dd..2db1f52c 100644 --- a/assets/css/um-styles.min.css +++ b/assets/css/um-styles.min.css @@ -1 +1 @@ -.um:not(.um-admin){width:100%;text-align:left;box-sizing:border-box;color:#666;font-size:15px;margin-bottom:30px!important;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important;opacity:0}.um-s1,.um-s2{display:none}.um:not(.um-admin) :after,.um:not(.um-admin) :before{box-sizing:content-box}.um-account-side li a,.um-cover a,.um-field-value a,.um-header a,.um-member-less a,.um-member-more a,.um-member-name a,.um-member-photo a,.um-members a,.um-members-pagi a,.um-members-pagi span{border-bottom:0!important}.um-modal a:focus,.um:not(.um-admin) a:focus{outline:0!important}.um:not(.um-admin) a .image-overlay,.um:not(.um-admin) a:hover .image-overlay,.um:not(.um-admin) a:hover .image-overlay *{display:none!important;width:0!important;height:0!important;position:static!important}.um.um-in-admin{padding-top:0}.um.um-in-admin .um-tip{display:none!important}.um:not(.um-admin):not(.um-directory) input,.um:not(.um-admin):not(.um-directory) select,.um:not(.um-admin):not(.um-directory) textarea{font-size:15px}.um:not(.um-admin) *{-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important}.um-left{float:left}.um-right{float:right}.um-clear{clear:both}.um-center{text-align:center}.um-center .um-button{display:inline-block!important;width:auto!important;min-width:250px!important}.um-half{width:48%}.um-field-half{width:48%;float:left}.um-field-half.right{float:right}.um-field-tri{width:30%;float:left;margin-right:3%}.um img{box-shadow:none!important}.um-col{padding-bottom:20px}.um-col-alt{margin:15px 0 5px 0}.um-col-alt-s{padding-top:10px}.um-col-alt-b{padding-top:20px}.um-col-121{float:left;width:48%}.um-col-122{float:right;width:48%}.um-col-131{float:left;width:30%}.um-col-132{float:left;width:30%;margin:0 5%}.um-col-133{float:left;width:30%}.um-raty i{font-size:26px}.um-field-half .um-raty i{font-size:21px}.um-field-tri .um-raty i{font-size:21px}.um-button i{font-size:22px;width:22px;height:12px!important;display:inline-block;line-height:12px!important;vertical-align:middle!important;position:relative;top:-6px;margin-right:8px}.um-row-heading{padding:5px 0;font-size:16px}.um-row-heading i{font-size:24px;height:24px;line-height:24px;margin:0 12px 0 0;display:inline-block;width:30px;text-align:center}.um-row-heading i:before{vertical-align:middle!important}p.um-notice{width:auto;color:#fff;box-sizing:border-box;font-size:15px;padding:12px!important;margin:12px 0 0 0!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative}p.um-notice a{color:#fff;text-decoration:underline}p.um-notice i{position:absolute;right:14px;font-size:36px;cursor:pointer;top:7px;display:block;height:30px;line-height:30px}p.um-notice.success{background:#7acf58}p.um-notice.err{background:#c74a4a}p.um-notice.warning{background:#f9f9d1;color:#666;border:1px solid #efe4a2;padding:8px 15px!important}p.um-notice.warning a{color:#666;text-decoration:underline}.um-field-error{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:12px 0 0 0}.um-field-error a{color:#fff!important;text-decoration:underline!important}.um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#c74a4a;font-size:28px;line-height:1em!important}.um-error-block{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-field-notice{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:5px 0 0 0}.um-field-notice a{color:#fff!important;text-decoration:underline!important}.um-field-notice .um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#497bc7!important;font-size:28px;line-height:1em!important}.um-notice-block{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-tip{margin:0 0 0 8px;cursor:pointer;display:inline-block;position:relative;top:3px}.um-tip i{font-size:22px;height:22px;line-height:22px;display:block;position:relative}.um-tip-text{display:block;font-size:13px;line-height:15px;color:#999}.um-form button::-moz-focus-inner,.um-form input::-moz-focus-inner{border:0!important;padding:0!important}.um-field{position:relative;padding:15px 0 0 0}.um-field-b,.um-field-c{padding-top:0!important}.um-field-label{display:block;margin:0 0 8px 0}.um-field-label .um-field-label-icon{float:left;margin:0 8px 0 0;height:22px;line-height:18px;display:inline-block;width:24px;text-align:center}.um-field-label .um-field-label-icon i{font-size:22px;position:relative;top:1px}.um-field-label label{font-size:15px!important;line-height:22px!important;font-weight:700;font-weight:600}.um-field-area{position:relative;word-wrap:break-word}.um-field-area-password{position:relative}.um-toggle-password{cursor:pointer;display:block;position:absolute;right:0;top:0;height:100%;width:40px;text-align:center;box-sizing:border-box;font-size:20px;line-height:2}.um-toggle-password i{transition:all .2s linear}.um-toggle-password:hover i{color:#44b0ec}.um-field-value p{margin:0 0 6px 0!important;padding:0}.um-field-block{color:#777;font-size:17px}.um-field-spacing{width:100%}.um-field-divider{width:100%;margin:0 0 12px 0;height:24px;position:relative}.um-field-divider-text{position:absolute;width:100%;text-align:center;bottom:-24px;left:0;font-size:16px;padding:10px 0}.um-field-divider-text span{background:#fff;color:#555;display:inline-block;padding:0 15px}.um-field-icon{position:absolute;cursor:default;text-align:center!important;top:2px;left:0;width:44px;font-size:22px;line-height:1.7em;z-index:1}.um-form input[type=number],.um-form input[type=password],.um-form input[type=search],.um-form input[type=tel],.um-form input[type=text]{padding:0 12px!important;width:100%;display:block!important;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;outline:0!important;cursor:text!important;font-size:15px!important;height:40px!important;box-sizing:border-box!important;box-shadow:none!important;margin:0!important;position:static}.um-form .um-field-area-password input[type=password]{padding-right:40px!important}.um-form input[type=number]{width:auto;padding:0 0 0 5px!important;height:30px!important}.um-form input[type=number]:focus,.um-form input[type=password]:focus,.um-form input[type=search]:focus,.um-form input[type=tel]:focus,.um-form input[type=text]:focus,.um-form textarea:focus{box-shadow:none!important;outline:0!important}.um-form input[type=password].um-iconed,.um-form input[type=tel].um-iconed,.um-form input[type=text].um-iconed{padding-left:44px!important}.um-form input[type=password].um-error,.um-form input[type=tel].um-error,.um-form input[type=text].um-error{border-color:#c74a4a!important}.um-form textarea{width:100%;padding:8px 12px!important;display:block;font-size:15px!important;line-height:22px!important;background:#fff;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;box-sizing:border-box;min-height:80px!important;box-shadow:none;outline:0!important}.um-form .um-meta-text textarea{max-width:100%}.um-form .wp-editor-container{border:1px solid #ddd}.um-form .wp-editor-container textarea{background:#ddd!important;color:#222!important;border-radius:0}.um-field-c .um-field-checkbox{margin-bottom:14px;margin-top:0!important;position:relative}.um-field-checkbox:not(.um-field),.um-field-radio:not(.um-field){display:block;margin:8px 0;position:relative}.um-profile.um-editing .um-field-checkbox,.um-profile.um-editing .um-field-radio{cursor:pointer!important}.um-field-checkbox:hover i,.um-field-radio:hover i{color:#666}.um-field-checkbox input,.um-field-radio input{opacity:0!important;display:inline!important;width:0!important;float:left}.um-field-checkbox-state,.um-field-radio-state{position:absolute;top:0;left:1px;width:24px;height:24px}.um-field-checkbox-state i,.um-field-radio-state i{font-size:24px;line-height:24px;height:24px;color:#aaa;transition:all .2s linear}.um-field-checkbox-option,.um-field-radio-option{margin:0 0 0 36px;line-height:24px;color:#888!important;display:block}.um-field-group{margin-top:20px}.um-field-group-head{cursor:pointer;color:#fff;font-size:16px;line-height:22px;padding:10px 20px;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;border-top:1px solid transparent!important;border-bottom:2px solid rgba(0,0,0,.1)!important}.um-field-group-head i{font-size:20px;margin:0 8px 0 0}.um-field-group-head i:before{vertical-align:middle!important}.um-field-group-body{display:none;margin:15px 0 0 0;padding:15px 20px 5px 20px;background:#f9f9f9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative;box-sizing:border-box;width:100%}.um-field-group-body div.um-field{padding:0 0 15px 0}.um-field-group-cancel{font-size:18px;position:absolute;z-index:800;right:8px;top:8px;color:#ccc!important;text-decoration:none!important}.um-field-group-cancel:hover{color:#777!important}.um div.disabled,.um input[type=number]:disabled,.um input[type=submit]:disabled,.um input[type=text]:disabled,.um-disabled{opacity:.6!important;cursor:no-drop!important}input[type=submit].um-button,input[type=submit].um-button:focus{vertical-align:middle!important;height:auto!important;font-size:15px;cursor:pointer!important;width:100%;box-shadow:none;text-shadow:none;font-family:inherit;outline:0!important;margin:0;opacity:1;-webkit-appearance:none}input[type=submit].um-button:hover{opacity:1}.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button:hover{-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)}.um-button.um-btn-auto-width{width:auto;display:inline-block;padding:14px 20px!important;min-width:200px;max-width:450px}a.um-link-alt{line-height:22px;color:#888!important;display:block!important;text-decoration:none!important;font-weight:400;text-align:center;border-bottom:none!important}a.um-link-alt:hover{text-decoration:underline!important}.um-dropdown{position:absolute;height:auto;background:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;z-index:55;display:none;border:1px solid #e5e5e5;box-sizing:border-box;-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 1px rgba(0,0,0,.1)}.um-dropdown li,.um-dropdown ul{list-style-type:none!important;padding:0!important;margin:0!important}.um-dropdown ul{background:#fff;position:relative;z-index:16}.um-dropdown li a{display:block;padding:8px 12px;color:#666;font-size:14px;line-height:18px}.um-dropdown li:last-child a{border-top:1px solid #e5e5e5;padding:12px}.um-dropdown-b{position:relative}.um-dropdown-arr{position:absolute;font-size:24px;width:24px;height:24px;overflow:hidden;z-index:15;color:#eee}.um-dropdown-arr *{display:block!important;width:24px!important;height:24px!important;vertical-align:bottom!important;overflow:hidden!important;line-height:24px!important}div.um-photo{margin:20px auto 0 auto;text-align:center;box-sizing:border-box;max-width:100%}div.um-photo,div.um-photo a,div.um-photo img{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}div.um-photo a{border:1px solid #e5e5e5;padding:5px;box-sizing:border-box;display:inline-block;box-shadow:0 1px 1px #eee;margin:0 auto;max-width:100%}div.um-photo img{max-height:300px;max-width:100%}span.um-req{margin:0 0 0 8px;font-size:14px;display:inline-block}small.um-max-filesize{display:block;color:#999;padding-top:5px}small.um-max-filesize span{font-size:12px}.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched,.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched:focus,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists:focus{border-color:#db2929!important}.um-form .um-field .um-field-area input.um-searching-username{background-image:url(../img/loading.gif);background-position:right center;background-repeat:no-repeat;background-size:24px 24px}.um-search-area{position:relative;max-width:300px}.um-search-area .um-search-field{width:100%}.um-search-area .um-search-icon{position:absolute;top:7px;right:10px}.um-field .select2-container.select2-container--open,.um-search-filter .select2-container.select2-container--open{z-index:9999999}.um-field .select2.select2-container .select2-selection,.um-search-filter .select2.select2-container .select2-selection{display:block!important;height:40px;padding:0 0 0 12px!important;overflow:hidden!important;position:relative!important;white-space:nowrap!important;line-height:35px!important;color:#666!important;font-size:15px!important;-moz-border-radius:2px!important;-webkit-border-radius:2px!important;border-radius:2px!important;background-clip:padding-box!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff!important;border:1px solid #ddd!important}.rtl .um-field .select2.select2-container .select2-selection,.rtl .um-search-filter .select2.select2-container .select2-selection{padding:0 12px 0 0!important}.um-field .select2.select2-container .select2-selection .select2-selection__arrow,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{display:inline-block!important;width:34px!important;height:100%!important;position:absolute;right:0;top:0;text-align:center;background:0 0!important;border:none!important}.rtl .um-field .select2.select2-container .select2-selection .select2-selection__arrow,.rtl .um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{right:initial;left:0}.um-field .select2.select2-container .select2-selection .select2-selection__arrow:before,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow:before{content:"\f3d0"!important;font-size:28px!important;font-family:Ionicons!important;display:block;height:100%;line-height:40px;min-width:1em;text-align:center;color:#aaa}.um-field .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation],.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation]{display:none}.um-field .select2-container.select2-container--open .select2-dropdown,.um-search-filter .select2-container.select2-container--open .select2-dropdown{border:1px solid #ddd!important;border-radius:0}.um-field .select2-container.select2-container--open .select2-dropdown .select2-results li,.um-search-filter .select2-container.select2-container--open .select2-dropdown .select2-results li{list-style:none;display:list-item;background:0 0;font-size:15px;margin:5px!important;color:#666!important;padding:3px 7px 4px!important;cursor:pointer;min-height:1em}.um-field .select2.select2-container .select2-selection.select2-selection--multiple,.um-search-filter .select2.select2-container .select2-selection.select2-selection--multiple{height:auto!important;line-height:.8!important;min-height:40px;padding-bottom:4px!important}.um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:37px;padding-left:0;padding-right:24px}.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{padding-left:24px;padding-right:0}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{line-height:37px;box-sizing:border-box;list-style:none;margin:0;padding-left:0;padding-right:30px;width:100%;font-size:13px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:30px;padding-right:0}.um-field .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted,.um-search-filter .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted{background:#f4f4f4;color:#666}.um-field .select2-dropdown .select2-results li.select2-results__option[aria-selected=true],.um-search-filter .select2-dropdown .select2-results li.select2-results__option[aria-selected=true]{background-color:#ddd}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-field .select2-container--default .select2-selection--single .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{color:#aaa;font-size:28px;font-weight:400;line-height:34px;margin:0!important;right:0;text-align:center;width:1em}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{left:0;right:initial}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear{position:absolute}.um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 5px 0 0;max-height:28px;padding:3px 3px 3px 5px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px;padding:3px 5px 3px 3px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 5px 0 0;padding:0}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 0 0 5px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input{border:none!important;padding:0!important;max-height:28px}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered li,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered li{overflow-x:hidden;text-overflow:ellipsis;max-width:100%;box-sizing:border-box;line-height:20px}.um-field-multiselect .um-field-area .um-field-icon,.um-field-select .um-field-area .um-field-icon{z-index:99999999}.um-field-select .um-field-area.um-field-area-has-icon .select2-selection__rendered{text-indent:20px}.um-field-multiselect .um-field-area.um-field-area-has-icon ul:first-child{margin-left:30px!important}.um-field-area .wp-switch-editor{float:none;height:auto} \ No newline at end of file +.um:not(.um-admin){width:100%;text-align:left;box-sizing:border-box;color:#666;font-size:15px;margin-bottom:30px!important;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important;opacity:0}.um-s1,.um-s2{display:none}.um:not(.um-admin) :after,.um:not(.um-admin) :before{box-sizing:content-box}.um-account-side li a,.um-cover a,.um-field-value a,.um-header a,.um-member-less a,.um-member-more a,.um-member-name a,.um-member-photo a,.um-members a,.um-members-pagi a,.um-members-pagi span{border-bottom:0!important}.um-modal a:focus,.um:not(.um-admin) a:focus{outline:0!important}.um:not(.um-admin) a .image-overlay,.um:not(.um-admin) a:hover .image-overlay,.um:not(.um-admin) a:hover .image-overlay *{display:none!important;width:0!important;height:0!important;position:static!important}.um.um-in-admin{padding-top:0}.um.um-in-admin .um-tip{display:none!important}.um:not(.um-admin):not(.um-directory) input,.um:not(.um-admin):not(.um-directory) select,.um:not(.um-admin):not(.um-directory) textarea{font-size:15px}.um:not(.um-admin) *{-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important}.um-left{float:left}.um-right{float:right}.um-clear{clear:both}.um-center{text-align:center}.um-center .um-button{display:inline-block!important;width:auto!important;min-width:250px!important}.um-half{width:48%}.um-field-half{width:48%;float:left}.um-field-half.right{float:right}.um-field-tri{width:30%;float:left;margin-right:3%}.um img{box-shadow:none!important}.um-col{padding-bottom:20px}.um-col-alt{margin:15px 0 5px 0}.um-col-alt-s{padding-top:10px}.um-col-alt-b{padding-top:20px}.um-col-121{float:left;width:48%}.um-col-122{float:right;width:48%}.um-col-131{float:left;width:30%}.um-col-132{float:left;width:30%;margin:0 5%}.um-col-133{float:left;width:30%}.um-raty i{font-size:26px}.um-field-half .um-raty i{font-size:21px}.um-field-tri .um-raty i{font-size:21px}.um-button i{font-size:22px;width:22px;height:12px!important;display:inline-block;line-height:12px!important;vertical-align:middle!important;position:relative;top:-6px;margin-right:8px}.um-row-heading{padding:5px 0;font-size:16px}.um-row-heading i{font-size:24px;height:24px;line-height:24px;margin:0 12px 0 0;display:inline-block;width:30px;text-align:center}.um-row-heading i:before{vertical-align:middle!important}p.um-notice{width:auto;color:#fff;box-sizing:border-box;font-size:15px;padding:12px!important;margin:12px 0 0 0!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative}p.um-notice a{color:#fff;text-decoration:underline}p.um-notice i{position:absolute;right:14px;font-size:36px;cursor:pointer;top:7px;display:block;height:30px;line-height:30px}p.um-notice.success{background:#7acf58}p.um-notice.err{background:#c74a4a}p.um-notice.warning{background:#f9f9d1;color:#666;border:1px solid #efe4a2;padding:8px 15px!important}p.um-notice.warning a{color:#666;text-decoration:underline}.um-field-error{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:12px 0 0 0}.um-field-error a{color:#fff!important;text-decoration:underline!important}.um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#c74a4a;font-size:28px;line-height:1em!important}.um-error-block{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-field-notice{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:5px 0 0 0}.um-field-notice a{color:#fff!important;text-decoration:underline!important}.um-field-notice .um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#497bc7!important;font-size:28px;line-height:1em!important}.um-notice-block{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-tip{margin:0 0 0 8px;cursor:pointer;display:inline-block;position:relative;top:3px}.um-tip i{font-size:22px;height:22px;line-height:22px;display:block;position:relative}.um-tip-text{display:block;font-size:13px;line-height:15px;color:#999}.um-form button::-moz-focus-inner,.um-form input::-moz-focus-inner{border:0!important;padding:0!important}.um-field{position:relative;padding:15px 0 0 0}.um-field-b,.um-field-c{padding-top:0!important}.um-field-label{display:block;margin:0 0 8px 0}.um-field-label .um-field-label-icon{float:left;margin:0 8px 0 0;height:22px;line-height:18px;display:inline-block;width:24px;text-align:center}.um-field-label .um-field-label-icon i{font-size:22px;position:relative;top:1px}.um-field-label label{font-size:15px!important;line-height:22px!important;font-weight:700;font-weight:600}.um-field-area{position:relative;word-wrap:break-word}.um-field-area-password{position:relative}.um-toggle-password{cursor:pointer;display:block;position:absolute;right:0;top:0;height:100%;width:40px;text-align:center;box-sizing:border-box;font-size:20px;line-height:2}.um-toggle-password i{transition:all .2s linear}.um-toggle-password:hover i{color:#44b0ec}.um-field-value p{margin:0 0 6px 0!important;padding:0}.um-field-block{color:#777;font-size:17px}.um-field-spacing{width:100%}.um-field-divider{width:100%;margin:0 0 12px 0;height:24px;position:relative}.um-field-divider-text{position:absolute;width:100%;text-align:center;bottom:-24px;left:0;font-size:16px;padding:10px 0}.um-field-divider-text span{background:#fff;color:#555;display:inline-block;padding:0 15px}.um-field-icon{position:absolute;cursor:default;text-align:center!important;top:2px;left:0;width:44px;font-size:22px;line-height:1.7em;z-index:1}.um-form input[type=number],.um-form input[type=password],.um-form input[type=search],.um-form input[type=tel],.um-form input[type=text]{padding:0 12px!important;width:100%;display:block!important;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;outline:0!important;cursor:text!important;font-size:15px!important;height:40px!important;box-sizing:border-box!important;box-shadow:none!important;margin:0!important;position:static}.um-form .um-field-area-password input[type=password]{padding-right:40px!important}.um-form input[type=number]{width:auto;padding:0 0 0 5px!important;height:30px!important}.um-form input[type=number]:focus,.um-form input[type=password]:focus,.um-form input[type=search]:focus,.um-form input[type=tel]:focus,.um-form input[type=text]:focus,.um-form textarea:focus{box-shadow:none!important;outline:0!important}.um-form input[type=password].um-iconed,.um-form input[type=tel].um-iconed,.um-form input[type=text].um-iconed{padding-left:44px!important}.um-form input[type=password].um-error,.um-form input[type=tel].um-error,.um-form input[type=text].um-error{border-color:#c74a4a!important}.um-form textarea{width:100%;padding:8px 12px!important;display:block;font-size:15px!important;line-height:22px!important;background:#fff;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;box-sizing:border-box;min-height:80px!important;box-shadow:none;outline:0!important}.um-form .um-meta-text textarea{max-width:100%}.um-form .wp-editor-container{border:1px solid #ddd}.um-form .wp-editor-container textarea{background:#ddd!important;color:#222!important;border-radius:0}.um-field-c .um-field-checkbox{margin-bottom:14px;margin-top:0!important;position:relative}.um-field-checkbox:not(.um-field),.um-field-radio:not(.um-field){display:block;margin:8px 0;position:relative}.um-profile.um-editing .um-field-checkbox,.um-profile.um-editing .um-field-radio{cursor:pointer!important}.um-field-checkbox:hover i,.um-field-radio:hover i{color:#666}.um-field-checkbox input,.um-field-radio input{opacity:0!important;display:inline!important;width:0!important;float:left}.um-field-checkbox-state,.um-field-radio-state{position:absolute;top:0;left:1px;width:24px;height:24px}.um-field-checkbox-state i,.um-field-radio-state i{font-size:24px;line-height:24px;height:24px;color:#aaa;transition:all .2s linear}.um-field-checkbox-option,.um-field-radio-option{margin:0 0 0 36px;line-height:24px;color:#888!important;display:block}.um-field-group{margin-top:20px}.um-field-group-head{cursor:pointer;color:#fff;font-size:16px;line-height:22px;padding:10px 20px;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;border-top:1px solid transparent!important;border-bottom:2px solid rgba(0,0,0,.1)!important}.um-field-group-head i{font-size:20px;margin:0 8px 0 0}.um-field-group-head i:before{vertical-align:middle!important}.um-field-group-body{display:none;margin:15px 0 0 0;padding:15px 20px 5px 20px;background:#f9f9f9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative;box-sizing:border-box;width:100%}.um-field-group-body div.um-field{padding:0 0 15px 0}.um-field-group-cancel{font-size:18px;position:absolute;z-index:800;right:8px;top:8px;color:#ccc!important;text-decoration:none!important}.um-field-group-cancel:hover{color:#777!important}.um div.disabled,.um input[type=number]:disabled,.um input[type=submit]:disabled,.um input[type=text]:disabled,.um-disabled{opacity:.6!important;cursor:no-drop!important}input[type=submit].um-button,input[type=submit].um-button:focus{vertical-align:middle!important;height:auto!important;font-size:15px;cursor:pointer!important;width:100%;box-shadow:none;text-shadow:none;font-family:inherit;outline:0!important;margin:0;opacity:1;-webkit-appearance:none}input[type=submit].um-button:hover{opacity:1}.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button:hover{-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)}.um-button.um-btn-auto-width{width:auto;display:inline-block;padding:14px 20px!important;min-width:200px;max-width:450px}a.um-link-alt{line-height:22px;color:#888!important;display:block!important;text-decoration:none!important;font-weight:400;text-align:center;border-bottom:none!important}a.um-link-alt:hover{text-decoration:underline!important}.um-dropdown{position:absolute;height:auto;background:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;z-index:55;display:none;border:1px solid #e5e5e5;box-sizing:border-box;-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 1px rgba(0,0,0,.1)}.um-dropdown li,.um-dropdown ul{list-style-type:none!important;padding:0!important;margin:0!important}.um-dropdown ul{background:#fff;position:relative;z-index:16}.um-dropdown li a{display:block;padding:8px 12px;color:#666;font-size:14px;line-height:18px}.um-dropdown li:last-child a{border-top:1px solid #e5e5e5;padding:12px}.um-dropdown-b{position:relative}.um-dropdown-arr{position:absolute;font-size:24px;width:24px;height:24px;overflow:hidden;z-index:15;color:#eee}.um-dropdown-arr *{display:block!important;width:24px!important;height:24px!important;vertical-align:bottom!important;overflow:hidden!important;line-height:24px!important}div.um-photo{margin:20px auto 0 auto;text-align:center;box-sizing:border-box;max-width:100%}div.um-photo,div.um-photo a,div.um-photo img{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}div.um-photo a{border:1px solid #e5e5e5;padding:5px;box-sizing:border-box;display:inline-block;box-shadow:0 1px 1px #eee;margin:0 auto;max-width:100%}div.um-photo img{max-height:300px;max-width:100%}span.um-req{margin:0 0 0 8px;font-size:14px;display:inline-block}small.um-max-filesize{display:block;color:#999;padding-top:5px}small.um-max-filesize span{font-size:12px}.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched,.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched:focus,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists:focus{border-color:#db2929!important}.um-form .um-field .um-field-area input.um-searching-username{background-image:url(../img/loading.gif);background-position:right center;background-repeat:no-repeat;background-size:24px 24px}.um-search-area{position:relative;max-width:300px}.um-search-area .um-search-field{width:100%;margin:0}.um-search-area .um-search-icon{position:absolute;height:100%;right:10px;top:0}.um-faicon-search:before{display:flex;align-items:center;justify-content:center;height:100%}.um-field .select2-container.select2-container--open,.um-search-filter .select2-container.select2-container--open{z-index:9999999}.um-field .select2.select2-container .select2-selection,.um-search-filter .select2.select2-container .select2-selection{display:block!important;height:40px;padding:0 0 0 12px!important;overflow:hidden!important;position:relative!important;white-space:nowrap!important;line-height:35px!important;color:#666!important;font-size:15px!important;-moz-border-radius:2px!important;-webkit-border-radius:2px!important;border-radius:2px!important;background-clip:padding-box!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff!important;border:1px solid #ddd!important}.rtl .um-field .select2.select2-container .select2-selection,.rtl .um-search-filter .select2.select2-container .select2-selection{padding:0 12px 0 0!important}.um-field .select2.select2-container .select2-selection .select2-selection__arrow,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{display:inline-block!important;width:34px!important;height:100%!important;position:absolute;right:0;top:0;text-align:center;background:0 0!important;border:none!important}.rtl .um-field .select2.select2-container .select2-selection .select2-selection__arrow,.rtl .um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{right:initial;left:0}.um-field .select2.select2-container .select2-selection .select2-selection__arrow:before,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow:before{content:"\f3d0"!important;font-size:28px!important;font-family:Ionicons!important;display:block;height:100%;line-height:40px;min-width:1em;text-align:center;color:#aaa}.um-field .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation],.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation]{display:none}.um-field .select2-container.select2-container--open .select2-dropdown,.um-search-filter .select2-container.select2-container--open .select2-dropdown{border:1px solid #ddd!important;border-radius:0}.um-field .select2-container.select2-container--open .select2-dropdown .select2-results li,.um-search-filter .select2-container.select2-container--open .select2-dropdown .select2-results li{list-style:none;display:list-item;background:0 0;font-size:15px;margin:5px!important;color:#666!important;padding:3px 7px 4px!important;cursor:pointer;min-height:1em}.um-field .select2.select2-container .select2-selection.select2-selection--multiple,.um-search-filter .select2.select2-container .select2-selection.select2-selection--multiple{height:auto!important;line-height:.8!important;min-height:40px;padding-bottom:4px!important}.um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:37px;padding-left:0;padding-right:24px}.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{padding-left:24px;padding-right:0}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{line-height:37px;box-sizing:border-box;list-style:none;margin:0;padding-left:0;padding-right:30px;width:100%;font-size:13px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:30px;padding-right:0}.um-field .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted,.um-search-filter .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted{background:#f4f4f4;color:#666}.um-field .select2-dropdown .select2-results li.select2-results__option[aria-selected=true],.um-search-filter .select2-dropdown .select2-results li.select2-results__option[aria-selected=true]{background-color:#ddd}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-field .select2-container--default .select2-selection--single .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{color:#aaa;font-size:28px;font-weight:400;line-height:34px;margin:0!important;right:0;text-align:center;width:1em}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{left:0;right:initial}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear{position:absolute}.um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 5px 0 0;max-height:28px;padding:3px 3px 3px 5px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px;padding:3px 5px 3px 3px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 5px 0 0;padding:0}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 0 0 5px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input{border:none!important;padding:0!important;max-height:28px}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered li,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered li{overflow-x:hidden;text-overflow:ellipsis;max-width:100%;box-sizing:border-box;line-height:20px}.um-field-multiselect .um-field-area .um-field-icon,.um-field-select .um-field-area .um-field-icon{z-index:99999999}.um-field-select .um-field-area.um-field-area-has-icon .select2-selection__rendered{text-indent:20px}.um-field-multiselect .um-field-area.um-field-area-has-icon ul:first-child{margin-left:30px!important}.um-field-area .wp-switch-editor{float:none;height:auto} \ No newline at end of file From b77120f71fc931e510c0e0b5c42a040ebb8848d1 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 15:33:50 +0200 Subject: [PATCH 39/76] - enhancement related to issue #1455; - fixed #1455; --- includes/core/um-filters-login.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/includes/core/um-filters-login.php b/includes/core/um-filters-login.php index 18af141c..2f697ea0 100644 --- a/includes/core/um-filters-login.php +++ b/includes/core/um-filters-login.php @@ -53,45 +53,46 @@ function um_wp_form_errors_hook_ip_test( $user, $username, $password ) { } add_filter( 'authenticate', 'um_wp_form_errors_hook_ip_test', 10, 3 ); - /** * Login checks through the WordPress admin login. * - * @param $user - * @param $username - * @param $password + * @param WP_Error|WP_User $user * * @return WP_Error|WP_User */ -function um_wp_form_errors_hook_logincheck( $user, $username, $password ) { +function um_wp_form_errors_hook_logincheck( $user ) { + if ( is_wp_error( $user ) ) { + return $user; + } if ( isset( $user->ID ) ) { - um_fetch_user( $user->ID ); $status = um_user( 'account_status' ); - switch( $status ) { + $error = null; + switch ( $status ) { case 'inactive': - return new WP_Error( $status, __( 'Your account has been disabled.', 'ultimate-member' ) ); + $error = new WP_Error( $status, __( 'Your account has been disabled.', 'ultimate-member' ) ); break; case 'awaiting_admin_review': - return new WP_Error( $status, __( 'Your account has not been approved yet.', 'ultimate-member' ) ); + $error = new WP_Error( $status, __( 'Your account has not been approved yet.', 'ultimate-member' ) ); break; case 'awaiting_email_confirmation': - return new WP_Error( $status, __( 'Your account is awaiting e-mail verification.', 'ultimate-member' ) ); + $error = new WP_Error( $status, __( 'Your account is awaiting e-mail verification.', 'ultimate-member' ) ); break; case 'rejected': - return new WP_Error( $status, __( 'Your membership request has been rejected.', 'ultimate-member' ) ); + $error = new WP_Error( $status, __( 'Your membership request has been rejected.', 'ultimate-member' ) ); break; } + if ( null !== $error ) { + return $error; + } } return $user; - } -add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50, 3 ); - +add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50 ); /** * Change lost password url in UM Login form From fb2cc55359033c7a1a3dccf0a338afe250a4a553 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 6 Feb 2024 16:08:23 +0200 Subject: [PATCH 40/76] - prepared for release; --- readme.txt | 29 +++++++++++++++++++++++ templates/email/notification_deletion.php | 2 +- templates/email/notification_new_user.php | 2 +- templates/email/notification_review.php | 2 +- ultimate-member.php | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index c9f8bdf4..5a8c5a93 100644 --- a/readme.txt +++ b/readme.txt @@ -166,6 +166,35 @@ No specific extensions are needed. But we highly recommended keep active these P IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION += 2.8.3: February 12, 2024 = + +* Enhancements: + + - Tweak: Ultimate Member > Settings redesign + +* Bugfixes: + + - Fixed: aria-invalid attribute for the user description field + - Fixed: wp_kses protocols for email notifications content + - Fixed: PHP notice while registration form validation + - Fixed: Field validations (English letters, Alpha-numeric types) + - Fixed: Hidden buttons in the modal when uploading profile and cover photo + - Fixed: Theme updater log message + - Fixed: Search line shortcode layout + - Fixed: PHP notice while login form submission + - Fixed: Email notifications HTML layout + - Fixed: Default email notification body color + +* Templates required update: + + - email/notification_deletion.php + - email/notification_new_user.php + - email/notification_review.php + - email/welcome_email.php + - password-change.php + +* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade + = 2.8.2: January 15, 2024 = * Enhancements: diff --git a/templates/email/notification_deletion.php b/templates/email/notification_deletion.php index 87f2f8d4..c9b7eba5 100644 --- a/templates/email/notification_deletion.php +++ b/templates/email/notification_deletion.php @@ -5,7 +5,7 @@ * * This template can be overridden by copying it to {your-theme}/ultimate-member/email/notification_deletion.php * - * @version 2.6.1 + * @version 2.8.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/templates/email/notification_new_user.php b/templates/email/notification_new_user.php index 14529ee8..588a2f6b 100644 --- a/templates/email/notification_new_user.php +++ b/templates/email/notification_new_user.php @@ -5,7 +5,7 @@ * * This template can be overridden by copying it to {your-theme}/ultimate-member/email/notification_new_user.php * - * @version 2.6.1 + * @version 2.8.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/templates/email/notification_review.php b/templates/email/notification_review.php index 4a1f08fb..cc195ddf 100644 --- a/templates/email/notification_review.php +++ b/templates/email/notification_review.php @@ -5,7 +5,7 @@ * * This template can be overridden by copying it to {your-theme}/ultimate-member/email/notification_review.php * - * @version 2.6.1 + * @version 2.8.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/ultimate-member.php b/ultimate-member.php index b08fcaeb..c4edc25a 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.8.3-alpha + * Version: 2.8.3-rc.1 * Author: Ultimate Member * Author URI: http://ultimatemember.com/ * Text Domain: ultimate-member From a051715d6f6f705843e6a8a3945dc888108d4ca5 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 03:41:50 +0200 Subject: [PATCH 41/76] - updated settings texts; --- includes/admin/core/class-admin-settings.php | 681 +++++++++++-------- readme.txt | 2 +- 2 files changed, 390 insertions(+), 293 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 6e130073..c2a5bcad 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -385,9 +385,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $appearances_profile_menu_fields = array( array( - 'id' => 'profile_menu', - 'type' => 'checkbox', - 'label' => __( 'Enable profile menu', 'ultimate-member' ), + 'id' => 'profile_menu', + 'type' => 'checkbox', + 'label' => __( 'Profile menu', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable profile menu', 'ultimate-member' ), ), ); @@ -413,12 +414,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { if ( isset( $tab['default_privacy'] ) ) { $fields = array( array( - 'id' => 'profile_tab_' . $id, - 'type' => 'checkbox', + 'id' => 'profile_tab_' . $id, + 'type' => 'checkbox', // translators: %s: Tab title - 'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ), - 'conditional' => array( 'profile_menu', '=', 1 ), - 'data' => array( 'fill_profile_menu_default_tab' => $id ), + 'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ), + // translators: %s: Tab title + 'checkbox_label' => sprintf( __( 'Enable %s Tab', 'ultimate-member' ), $tab['name'] ), + 'conditional' => array( 'profile_menu', '=', 1 ), + 'data' => array( 'fill_profile_menu_default_tab' => $id ), ), ); @@ -429,19 +432,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $fields = array( array( - 'id' => 'profile_tab_' . $id, - 'type' => 'checkbox', + 'id' => 'profile_tab_' . $id, + 'type' => 'checkbox', // translators: %s: Tab title - 'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ), - 'conditional' => array( 'profile_menu', '=', 1 ), - 'data' => array( 'fill_profile_menu_default_tab' => $id ), + 'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ), + 'checkbox_label' => sprintf( __( 'Enable %s Tab', 'ultimate-member' ), $tab['name'] ), + 'conditional' => array( 'profile_menu', '=', 1 ), + 'data' => array( 'fill_profile_menu_default_tab' => $id ), ), array( 'id' => 'profile_tab_' . $id . '_privacy', 'type' => 'select', // translators: %s: Tab title 'label' => sprintf( __( 'Who can see %s Tab?', 'ultimate-member' ), $tab['name'] ), - 'tooltip' => __( 'Select which users can view this tab.', 'ultimate-member' ), + 'description' => __( 'Select which users can view this tab.', 'ultimate-member' ), 'options' => UM()->profile()->tabs_privacy(), 'conditional' => array( 'profile_tab_' . $id, '=', 1 ), 'size' => 'small', @@ -451,7 +455,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'select', 'multi' => true, 'label' => __( 'Allowed roles', 'ultimate-member' ), - 'tooltip' => __( 'Select the the user roles allowed to view this tab.', 'ultimate-member' ), + 'description' => __( 'Select the the user roles allowed to view this tab.', 'ultimate-member' ), 'options' => UM()->roles()->get_roles(), 'placeholder' => __( 'Choose user roles...', 'ultimate-member' ), 'conditional' => array( 'profile_tab_' . $id . '_privacy', '=', array( '4', '5' ) ), @@ -482,7 +486,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_menu_default_tab', 'type' => 'select', 'label' => __( 'Profile menu default tab', 'ultimate-member' ), - 'tooltip' => __( 'This will be the default tab on user profile page', 'ultimate-member' ), + 'description' => __( 'This will be the default tab on user profile page', 'ultimate-member' ), 'options' => $tabs_options, 'conditional' => array( implode( '|', $tabs_condition ), '~', 1 ), 'size' => 'small', @@ -496,11 +500,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $appearances_profile_menu_fields, array( array( - 'id' => 'profile_menu_icons', - 'type' => 'checkbox', - 'label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ), - 'description' => __( '"Desktop view" means the profile block\'s width lower than 800px', 'ultimate-member' ), - 'conditional' => array( 'profile_menu', '=', 1 ), + 'id' => 'profile_menu_icons', + 'type' => 'checkbox', + 'label' => __( 'Menu icons in desktop view', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ), + 'description' => __( '"Desktop view" means the profile block\'s width lower than 800px', 'ultimate-member' ), + 'conditional' => array( 'profile_menu', '=', 1 ), ), ) ); @@ -562,62 +567,65 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $access_fields = array( array( - 'id' => 'accessible', - 'type' => 'select', - 'label' => __( 'Global Site Access', 'ultimate-member' ), - 'tooltip' => __( 'Globally control the access of your site, you can have separate restrict options per post/page by editing the desired item.', 'ultimate-member' ), - 'options' => array( + 'id' => 'accessible', + 'type' => 'select', + 'label' => __( 'Global Site Access', 'ultimate-member' ), + 'description' => __( 'Globally control the access of your site, you can have separate restrict options per post/page by editing the desired item.', 'ultimate-member' ), + 'options' => array( 0 => __( 'Site accessible to Everyone', 'ultimate-member' ), 2 => __( 'Site accessible to Logged In Users', 'ultimate-member' ), ), - 'size' => 'medium', + 'size' => 'medium', ), array( - 'id' => 'access_redirect', + 'id' => 'a$access_fieldsccess_redirect', 'type' => 'text', 'label' => __( 'Custom Redirect URL', 'ultimate-member' ), - 'tooltip' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimate-member' ), + 'description' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimate-member' ), 'conditional' => array( 'accessible', '=', 2 ), ), array( 'id' => 'access_exclude_uris', 'type' => 'multi_text', 'label' => __( 'Exclude the following URLs', 'ultimate-member' ), - 'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ), + 'description' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ), 'add_text' => __( 'Add New URL', 'ultimate-member' ), 'conditional' => array( 'accessible', '=', 2 ), 'show_default_number' => 0, ), array( - 'id' => 'home_page_accessible', - 'type' => 'checkbox', - 'label' => __( 'Allow Homepage to be accessible', 'ultimate-member' ), - 'conditional' => array( 'accessible', '=', 2 ), + 'id' => 'home_page_accessible', + 'type' => 'checkbox', + 'label' => __( 'Allow Homepage to be accessible', 'ultimate-member' ), + 'checkbox_label' => __( 'Accessible Homepage', 'ultimate-member' ), + 'conditional' => array( 'accessible', '=', 2 ), ), array( - 'id' => 'category_page_accessible', - 'type' => 'checkbox', - 'label' => __( 'Allow Category pages to be accessible', 'ultimate-member' ), - 'conditional' => array( 'accessible', '=', 2 ), + 'id' => 'category_page_accessible', + 'type' => 'checkbox', + 'label' => __( 'Allow Category pages to be accessible', 'ultimate-member' ), + 'checkbox_label' => __( 'Accessible Category pages', 'ultimate-member' ), + 'conditional' => array( 'accessible', '=', 2 ), ), array( - 'id' => 'restricted_post_title_replace', - 'type' => 'checkbox', - 'label' => __( 'Replace the restricted Post Title', 'ultimate-member' ), - 'tooltip' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content', 'ultimate-member' ), + 'id' => 'restricted_post_title_replace', + 'type' => 'checkbox', + 'label' => __( 'Restricted Post Title', 'ultimate-member' ), + 'checkbox_label' => __( 'Replace the restricted Post Title', 'ultimate-member' ), + 'description' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content', 'ultimate-member' ), ), array( 'id' => 'restricted_access_post_title', 'type' => 'text', 'label' => __( 'Restricted Access Post Title', 'ultimate-member' ), - 'tooltip' => __( 'This is the post title shown to users that do not have permission to view the content', 'ultimate-member' ), + 'description' => __( 'If enabled, the text entered below will replace the title of the post/page/CPT for users who do not have permission to view the restricted content. Please see this doc for more information on this.', 'ultimate-member' ), 'conditional' => array( 'restricted_post_title_replace', '=', 1 ), ), array( - 'id' => 'restricted_access_message', - 'type' => 'wp_editor', - 'label' => __( 'Restricted Access Message', 'ultimate-member' ), - 'tooltip' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ), + 'id' => 'restricted_access_message', + 'type' => 'wp_editor', + 'label' => __( 'Restricted Access Message', 'ultimate-member' ), + 'description' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ), ), ); @@ -657,15 +665,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $access_fields, array( array( - 'id' => 'restricted_blocks', - 'type' => 'checkbox', - 'label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ), + 'id' => 'restricted_blocks', + 'type' => 'checkbox', + 'label' => __( 'Restricted Gutenberg Blocks', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ), + 'description' => __( 'If enabled then allows to set the blocks restriction settings in wp-admin', 'ultimate-member' ), ), array( 'id' => 'restricted_block_message', 'type' => 'textarea', 'label' => __( 'Restricted Access Block Message', 'ultimate-member' ), - 'tooltip' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ), + 'description' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ), 'conditional' => array( 'restricted_blocks', '=', 1 ), ), ) @@ -693,24 +703,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'value' => '', ), array( - 'id' => 'restricted_access_post_metabox', - 'type' => 'multi_checkbox', - 'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ), - 'tooltip' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), - 'options' => $post_types_options, - 'columns' => 3, - 'value' => $restricted_access_post_metabox_value, - 'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ), + 'id' => 'restricted_access_post_metabox', + 'type' => 'multi_checkbox', + 'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ), + 'description' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), + 'options' => $post_types_options, + 'columns' => 3, + 'value' => $restricted_access_post_metabox_value, + 'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ), ), array( - 'id' => 'restricted_access_taxonomy_metabox', - 'type' => 'multi_checkbox', - 'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ), - 'tooltip' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), - 'options' => $taxonomies_options, - 'columns' => 3, - 'value' => $restricted_access_taxonomy_metabox_value, - 'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ), + 'id' => 'restricted_access_taxonomy_metabox', + 'type' => 'multi_checkbox', + 'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ), + 'description' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), + 'options' => $taxonomies_options, + 'columns' => 3, + 'value' => $restricted_access_taxonomy_metabox_value, + 'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ), ), ) ); @@ -1054,115 +1064,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ) ); - $account_fields = array( - array( - 'id' => 'account_tab_password', - 'type' => 'checkbox', - 'label' => __( 'Password Account Tab', 'ultimate-member' ), - 'tooltip' => __( 'Enable/disable the Password account tab in account page', 'ultimate-member' ), - ), - array( - 'id' => 'account_tab_privacy', - 'type' => 'checkbox', - 'label' => __( 'Privacy Account Tab', 'ultimate-member' ), - 'tooltip' => __( 'Enable/disable the Privacy account tab in account page', 'ultimate-member' ), - ), - ); - if ( false !== UM()->account()->is_notifications_tab_visible() ) { - $account_fields[] = array( - 'id' => 'account_tab_notifications', - 'type' => 'checkbox', - 'label' => __( 'Notifications Account Tab', 'ultimate-member' ), - 'tooltip' => __( 'Enable/disable the Notifications account tab in account page', 'ultimate-member' ), - ); - $settings_map['account_tab_notifications'] = array( 'sanitize' => 'bool', ); } - $account_fields = array_merge( - $account_fields, - array( - array( - 'id' => 'account_tab_delete', - 'type' => 'checkbox', - 'label' => __( 'Delete Account Tab', 'ultimate-member' ), - 'tooltip' => __( 'Enable/disable the Delete account tab in account page', 'ultimate-member' ), - ), - array( - 'id' => 'delete_account_text', - 'type' => 'textarea', // bug with wp 4.4? should be editor - 'label' => __( 'Account Deletion Custom Text', 'ultimate-member' ), - 'tooltip' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site when password is required.', 'ultimate-member' ), - 'args' => array( - 'textarea_rows' => 6, - ), - ), - array( - 'id' => 'delete_account_no_pass_required_text', - 'type' => 'textarea', - 'label' => __( 'Account Deletion without password Custom Text', 'ultimate-member' ), - 'tooltip' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site when password isn\'t required.', 'ultimate-member' ), - 'args' => array( - 'textarea_rows' => 6, - ), - ), - array( - 'id' => 'account_name', - 'type' => 'checkbox', - 'label' => __( 'Add a First & Last Name fields', 'ultimate-member' ), - 'tooltip' => __( 'Whether to enable these fields on the user account page by default or hide them.', 'ultimate-member' ), - ), - array( - 'id' => 'account_name_disable', - 'type' => 'checkbox', - 'label' => __( 'Disable First & Last Name fields', 'ultimate-member' ), - 'tooltip' => __( 'Whether to allow users changing their first and last name in account page.', 'ultimate-member' ), - 'conditional' => array( 'account_name', '=', '1' ), - ), - array( - 'id' => 'account_name_require', - 'type' => 'checkbox', - 'label' => __( 'Require First & Last Name', 'ultimate-member' ), - 'tooltip' => __( 'Require first and last name?', 'ultimate-member' ), - 'conditional' => array( 'account_name', '=', '1' ), - ), - array( - 'id' => 'account_email', - 'type' => 'checkbox', - 'label' => __( 'Allow users to change e-mail', 'ultimate-member' ), - 'tooltip' => __( 'Whether to allow users changing their email in account page.', 'ultimate-member' ), - ), - array( - 'id' => 'account_general_password', - 'type' => 'checkbox', - 'label' => __( 'Password is required?', 'ultimate-member' ), - 'tooltip' => __( 'Password is required to save account data.', 'ultimate-member' ), - ), - array( - 'id' => 'account_hide_in_directory', - 'type' => 'checkbox', - 'label' => __( 'Allow users to hide their profiles from directory', 'ultimate-member' ), - 'tooltip' => __( 'Whether to allow users changing their profile visibility from member directory in account page.', 'ultimate-member' ), - 'conditional' => array( 'account_tab_privacy', '=', '1' ), - ), - array( - 'id' => 'account_hide_in_directory_default', - 'type' => 'select', - 'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ), - 'tooltip' => __( 'Set default value for the "Hide my profile from directory" option', 'ultimate-member' ), - 'options' => array( - 'No' => __( 'No', 'ultimate-member' ), - 'Yes' => __( 'Yes', 'ultimate-member' ), - ), - 'size' => 'small', - 'conditional' => array( 'account_hide_in_directory', '=', '1' ), - ), - ) - ); - $this->settings_map = apply_filters( 'um_settings_map', $settings_map ); /** @@ -1192,8 +1099,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'General', 'ultimate-member' ), 'sections' => array( '' => array( - 'title' => __( 'Pages', 'ultimate-member' ), - 'fields' => $general_pages_fields, + 'title' => __( 'Pages', 'ultimate-member' ), + 'description' => __( 'This section allows you to assign a page to one of the core elements required for the plugin to function properly. The plugin automatically creates and configures required pages on installation.
    You only need to use this tab, if you accidentally deleted pages that were automatically created when the plugin was activated for the first time.', 'ultimate-member' ), + 'fields' => $general_pages_fields, ), 'users' => array( 'title' => __( 'Users', 'ultimate-member' ), @@ -1372,74 +1280,227 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'account' => array( - 'title' => __( 'Account', 'ultimate-member' ), - 'fields' => $account_fields, + 'title' => __( 'Account', 'ultimate-member' ), + 'form_sections' => array( + 'account_tab' => array( + 'title' => __( 'Main account tab', 'ultimate-member' ), + 'description' => __( 'Allows you to control the fields on the main tab of Account page.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'account_name', + 'type' => 'checkbox', + 'label' => __( 'Display First & Last name fields', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable to display First & Last name fields', 'ultimate-member' ), + 'description' => __( 'If enabled, the First & Last name fields will be shown on the account page.', 'ultimate-member' ), + ), + array( + 'id' => 'account_name_disable', + 'type' => 'checkbox', + 'label' => __( 'Disable First & Last name field editing', 'ultimate-member' ), + 'checkbox_label' => __( 'Disabled First & Last name', 'ultimate-member' ), + 'description' => __( 'If enabled, this will prevent users from changing their First & Last name fields on the account page.', 'ultimate-member' ), + 'conditional' => array( 'account_name', '=', '1' ), + ), + array( + 'id' => 'account_name_require', + 'type' => 'checkbox', + 'label' => __( 'Require First & Last Name', 'ultimate-member' ), + 'checkbox_label' => __( 'Required First & Last Name', 'ultimate-member' ), + 'description' => __( 'If enabled, users will not be allowed to remove their first or last names when updating their account page.', 'ultimate-member' ), + 'conditional' => array( 'account_name', '=', '1' ), + ), + array( + 'id' => 'account_email', + 'type' => 'checkbox', + 'label' => __( 'Allow users to change email', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable changing email via Account', 'ultimate-member' ), + 'description' => __( 'If disabled, users will not be allowed to change their email address on the account page.', 'ultimate-member' ), + ), + array( + 'id' => 'account_general_password', + 'type' => 'checkbox', + 'label' => __( 'Require password to update account', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable required password', 'ultimate-member' ), + 'description' => __( 'If enabled, users will need to enter their password when updating their information via the account page.', 'ultimate-member' ), + ), + ), + ), + 'password_tab' => array( + 'title' => __( 'Change password tab', 'ultimate-member' ), + 'description' => __( 'Allows you to enable/disable the password tab from the account page.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'account_tab_password', + 'type' => 'checkbox', + 'label' => __( 'Password Account Tab', 'ultimate-member' ), + 'checkbox_label' => __( 'Display password change account tab', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Password account tab in account page.', 'ultimate-member' ), + ), + ), + ), + 'privacy_tab' => array( + 'title' => __( 'Privacy tab', 'ultimate-member' ), + 'description' => __( 'Allows you to enable/disable the privacy tab from the account page. You should disable this tab if you do not want users from being able to alter their privacy settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'account_tab_privacy', + 'type' => 'checkbox', + 'label' => __( 'Privacy Account Tab', 'ultimate-member' ), + 'checkbox_label' => __( 'Display privacy account tab', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Privacy account tab in account page', 'ultimate-member' ), + ), + array( + 'id' => 'account_hide_in_directory', + 'type' => 'checkbox', + 'label' => __( 'Allow users to hide their profiles from directory', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable users ability to alter their profile visibility in member directories', 'ultimate-member' ), + 'description' => __( 'Whether to allow users changing their profile visibility from member directory in account page.', 'ultimate-member' ), + 'conditional' => array( 'account_tab_privacy', '=', '1' ), + ), + array( + 'id' => 'account_hide_in_directory_default', + 'type' => 'select', + 'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ), + 'description' => __( 'Set default value for the "Hide my profile from directory" option', 'ultimate-member' ), + 'options' => array( + 'No' => __( 'No', 'ultimate-member' ), + 'Yes' => __( 'Yes', 'ultimate-member' ), + ), + 'size' => 'small', + 'conditional' => array( 'account_hide_in_directory', '=', '1' ), + ), + ), + ), + 'notifications_tab' => array( + 'title' => __( 'Notifications tab', 'ultimate-member' ), + 'description' => __( 'Allows you to enable/disable the Notifications account tab on the account page.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'account_tab_notifications', + 'type' => 'checkbox', + 'label' => __( 'Notifications Account Tab', 'ultimate-member' ), + 'checkbox_label' => __( 'Display notifications account tab', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Notifications account tab in account page', 'ultimate-member' ), + ), + ), + ), + 'delete_tab' => array( + 'title' => __( 'Delete tab', 'ultimate-member' ), + 'description' => __( 'Allows you to enable/disable the delete account tab from the account page. You should disable this tab if you do not want users from being able to alter their delete their own accounts.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'account_tab_delete', + 'type' => 'checkbox', + 'label' => __( 'Delete Account Tab', 'ultimate-member' ), + 'checkbox_label' => __( 'Display delete account tab', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Delete account tab in account page', 'ultimate-member' ), + ), + array( + 'id' => 'delete_account_text', + 'type' => 'textarea', // bug with wp 4.4? should be editor + 'label' => __( 'Account Deletion Text', 'ultimate-member' ), + 'description' => __( 'This is the custom text that will be displayed to users before they delete their account from your website when their password is required to confirm account deletion.', 'ultimate-member' ), + 'args' => array( + 'textarea_rows' => 6, + ), + 'conditional' => array( 'account_tab_delete', '=', '1' ), + ), + array( + 'id' => 'delete_account_no_pass_required_text', + 'type' => 'textarea', + 'label' => __( 'Account Deletion Text', 'ultimate-member' ), + 'description' => __( 'This is the custom text that will be displayed to users before they delete their account from your website when no password is required to confirm account deletion.', 'ultimate-member' ), + 'args' => array( + 'textarea_rows' => 6, + ), + 'conditional' => array( 'account_tab_delete', '=', '0' ), + ), + ), + ), + ), ), 'uploads' => array( - 'title' => __( 'Uploads', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'profile_photo_max_size', - 'type' => 'text', - 'size' => 'small', - 'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ), - 'tooltip' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ), + 'title' => __( 'Uploads', 'ultimate-member' ), + 'form_sections' => array( + 'uploads' => array( + 'title' => __( 'Uploads', 'ultimate-member' ), + 'description' => __( 'Allows you to control options related to user uploads. This allows you to optimize the photos for your site.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'image_orientation_by_exif', + 'type' => 'checkbox', + 'label' => __( 'Change image orientation', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable getting image orientation from EXIF data', 'ultimate-member' ), + 'description' => __( 'Rotate image to and use orientation by the camera EXIF data.', 'ultimate-member' ), + ), + array( + 'id' => 'image_compression', + 'type' => 'text', + 'size' => 'small', + 'label' => __( 'Image Quality', 'ultimate-member' ), + 'description' => __( 'Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimate-member' ), + ), + array( + 'id' => 'image_max_width', + 'type' => 'text', + 'size' => 'small', + 'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ), + 'description' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ), + ), + ), ), - array( - 'id' => 'cover_photo_max_size', - 'type' => 'text', - 'size' => 'small', - 'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ), - 'tooltip' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ), + 'profile_photo' => array( + 'title' => __( 'Profile photo', 'ultimate-member' ), + 'description' => __( 'Allows you to control the profile photos sizes, thumbnails, etc.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'profile_photo_max_size', + 'type' => 'text', + 'size' => 'small', + 'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ), + 'description' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ), + ), + array( + 'id' => 'photo_thumb_sizes', + 'type' => 'multi_text', + 'size' => 'small', + 'label' => __( 'Profile Photo Thumbnail Sizes (px)', 'ultimate-member' ), + 'description' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.', 'ultimate-member' ), + 'validate' => 'numeric', + 'add_text' => __( 'Add New Size', 'ultimate-member' ), + 'show_default_number' => 1, + ), + ), ), - array( - 'id' => 'photo_thumb_sizes', - 'type' => 'multi_text', - 'size' => 'small', - 'label' => __( 'Profile Photo Thumbnail Sizes (px)', 'ultimate-member' ), - 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.', 'ultimate-member' ), - 'validate' => 'numeric', - 'add_text' => __( 'Add New Size', 'ultimate-member' ), - 'show_default_number' => 1, - ), - array( - 'id' => 'cover_thumb_sizes', - 'type' => 'multi_text', - 'size' => 'small', - 'label' => __( 'Cover Photo Thumbnail Sizes (px)', 'ultimate-member' ), - 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.', 'ultimate-member' ), - 'validate' => 'numeric', - 'add_text' => __( 'Add New Size', 'ultimate-member' ), - 'show_default_number' => 1, - ), - array( - 'id' => 'image_orientation_by_exif', - 'type' => 'checkbox', - 'label' => __( 'Change image orientation', 'ultimate-member' ), - 'tooltip' => __( 'Rotate image to and use orientation by the camera EXIF data.', 'ultimate-member' ), - ), - array( - 'id' => 'image_compression', - 'type' => 'text', - 'size' => 'small', - 'label' => __( 'Image Quality', 'ultimate-member' ), - 'tooltip' => __( 'Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimate-member' ), - ), - - array( - 'id' => 'image_max_width', - 'type' => 'text', - 'size' => 'small', - 'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ), - 'tooltip' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ), - ), - - array( - 'id' => 'cover_min_width', - 'type' => 'text', - 'size' => 'small', - 'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ), - 'tooltip' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ), + 'cover_photo' => array( + 'title' => __( 'Cover photo', 'ultimate-member' ), + 'description' => __( 'Allows you to control the cover photos sizes, thumbnails, etc.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'cover_photo_max_size', + 'type' => 'text', + 'size' => 'small', + 'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ), + 'description' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ), + ), + array( + 'id' => 'cover_min_width', + 'type' => 'text', + 'size' => 'small', + 'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ), + 'description' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ), + ), + array( + 'id' => 'cover_thumb_sizes', + 'type' => 'multi_text', + 'size' => 'small', + 'label' => __( 'Cover Photo Thumbnail Sizes (px)', 'ultimate-member' ), + 'description' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.', 'ultimate-member' ), + 'validate' => 'numeric', + 'add_text' => __( 'Add New Size', 'ultimate-member' ), + 'show_default_number' => 1, + ), + ), ), ), ), @@ -1449,55 +1510,84 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'Access', 'ultimate-member' ), 'sections' => array( '' => array( - 'title' => __( 'Restriction Content', 'ultimate-member' ), - 'fields' => $access_fields, + 'title' => __( 'Restriction Content', 'ultimate-member' ), + 'description' => __( 'Provides settings for controlling access to your site.', 'ultimate-member' ), + 'fields' => $access_fields, ), 'other' => array( - 'title' => __( 'Other', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'enable_reset_password_limit', - 'type' => 'checkbox', - 'label' => __( 'Enable the Reset Password Limit?', 'ultimate-member' ), + 'title' => __( 'Other', 'ultimate-member' ), + 'form_sections' => array( + 'rp' => array( + 'title' => __( 'Reset Password', 'ultimate-member' ), + 'description' => __( 'Allows to manage reset password settings', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'enable_reset_password_limit', + 'type' => 'checkbox', + 'label' => __( 'Password reset limit', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable the Reset Password Limit?', 'ultimate-member' ), + 'description' => __( 'If enabled, this sets a limit on the number of password resets a user can do.', 'ultimate-member' ), + ), + array( + 'id' => 'reset_password_limit_number', + 'type' => 'text', + 'label' => __( 'Enter password reset limit', 'ultimate-member' ), + 'description' => __( 'Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.', 'ultimate-member' ), + 'validate' => 'numeric', + 'conditional' => array( 'enable_reset_password_limit', '=', 1 ), + 'size' => 'small', + ), + array( + 'id' => 'change_password_request_limit', + 'type' => 'checkbox', + 'label' => __( 'Change Password request limit', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable limit for changing password', 'ultimate-member' ), + 'description' => __( 'This option adds rate limit when submitting the change password form in the Account page. Users are only allowed to submit 1 request per 30 minutes to prevent from any brute-force attacks or password guessing with the form.', 'ultimate-member' ), + ), + ), ), - array( - 'id' => 'reset_password_limit_number', - 'type' => 'text', - 'label' => __( 'Reset Password Limit', 'ultimate-member' ), - 'tooltip' => __( 'Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.', 'ultimate-member' ), - 'validate' => 'numeric', - 'conditional' => array( 'enable_reset_password_limit', '=', 1 ), - 'size' => 'small', + 'blocked' => array( + 'title' => __( 'Blocked data when sign up', 'ultimate-member' ), + 'description' => __( 'Allows to manage blocked data of signed up user.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'blocked_emails', + 'type' => 'textarea', + 'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ), + 'description' => __( '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 (Enter one word per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ), + ), + ), ), - array( - 'id' => 'change_password_request_limit', - 'type' => 'checkbox', - 'label' => __( 'Change Password request limit', 'ultimate-member' ), - 'tooltip' => __( 'This option adds rate limit when submitting the change password form in the Account page. Users are only allowed to submit 1 request per 30 minutes to prevent from any brute-force attacks or password guessing with the form.', 'ultimate-member' ), + 'fields' => array( + 'title' => __( 'Fields', 'ultimate-member' ), + 'description' => __( 'Allows to manage fields settings', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allowed_choice_callbacks', + 'type' => 'textarea', + 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), + ), + ), ), - array( - 'id' => 'blocked_emails', - 'type' => 'textarea', - '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 (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' ), - ), - array( - 'id' => 'allowed_choice_callbacks', - 'type' => 'textarea', - 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), - 'tooltip' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), - ), - array( - 'id' => 'allow_url_redirect_confirm', - 'type' => 'checkbox', - 'label' => __( 'Allow external link redirect confirm', 'ultimate-member' ), - 'tooltip' => __( 'Using JS.confirm alert when you go to an external link.', 'ultimate-member' ), + 'redirect' => array( + 'title' => __( 'Redirect', 'ultimate-member' ), + 'description' => __( 'Allows to manage redirect settings', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allow_url_redirect_confirm', + 'type' => 'checkbox', + 'label' => __( 'Allow external link redirect confirm', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable JS.confirm for external links', 'ultimate-member' ), + 'description' => __( 'Using JS.confirm alert when you go to an external link.', 'ultimate-member' ), + ), + ), ), ), ), @@ -1753,11 +1843,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'profile_menu' => array( - 'title' => __( 'Profile Menu', 'ultimate-member' ), - 'fields' => $appearances_profile_menu_fields, + 'title' => __( 'Profile Menu', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user profiles menus on your site.', 'ultimate-member' ), + 'fields' => $appearances_profile_menu_fields, ), 'registration_form' => array( 'title' => __( 'Registration Form', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user profiles menus on your site.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'register_template', @@ -1848,12 +1940,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), 'login_form' => array( 'title' => __( 'Login Form', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize Ultimate Member login form on your site.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'login_template', 'type' => 'select', 'label' => __( 'Login Default Template', 'ultimate-member' ), - 'tooltip' => __( 'This will be the default template to output login', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output login', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_template' ), 'options' => UM()->shortcodes()->get_templates( 'login' ), 'size' => 'small', @@ -1863,14 +1956,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Login Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_max_width' ), - 'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), 'size' => 'small', ), array( 'id' => 'login_align', 'type' => 'select', 'label' => __( 'Login Shortcode Alignment', 'ultimate-member' ), - 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), + 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_align' ), 'options' => array( 'center' => __( 'Centered', 'ultimate-member' ), @@ -1883,7 +1976,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'login_icons', 'type' => 'select', 'label' => __( 'Login Field Icons', 'ultimate-member' ), - 'tooltip' => __( 'This controls the display of field icons in the login form', 'ultimate-member' ), + 'description' => __( 'This controls the display of field icons in the login form', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_icons' ), 'options' => array( 'field' => __( 'Show inside text field', 'ultimate-member' ), @@ -1897,7 +1990,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Login Primary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_primary_btn_word' ), - 'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), 'size' => 'medium', ), array( @@ -1905,14 +1998,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Login Secondary Button', 'ultimate-member' ), 'default' => 1, - 'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), ), array( 'id' => 'login_secondary_btn_word', 'type' => 'text', 'label' => __( 'Login Secondary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_secondary_btn_word' ), - 'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), 'conditional' => array( 'login_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1921,7 +2014,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Login Secondary Button URL', 'ultimate-member' ), 'default' => um_get_metadefault( 'login_secondary_btn_url' ), - 'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), + 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), 'conditional' => array( 'login_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1930,14 +2023,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Login Forgot Password Link', 'ultimate-member' ), 'default' => 1, - 'tooltip' => __( 'Switch on/off the forgot password link in login form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the forgot password link in login form', 'ultimate-member' ), ), array( 'id' => 'login_show_rememberme', 'type' => 'checkbox', 'label' => __( 'Show "Remember Me"', 'ultimate-member' ), 'default' => 1, - 'tooltip' => __( 'Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimate-member' ), + 'description' => __( 'Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimate-member' ), ), ), ), @@ -2077,6 +2170,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ) ); + if ( false === UM()->account()->is_notifications_tab_visible() ) { + unset( $this->settings_structure['']['sections']['account']['form_sections']['notifications_tab'] ); + } + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE ) { } else { diff --git a/readme.txt b/readme.txt index 5a8c5a93..dfbe5c6c 100644 --- a/readme.txt +++ b/readme.txt @@ -170,7 +170,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI * Enhancements: - - Tweak: Ultimate Member > Settings redesign + - Tweak: Ultimate Member > Settings redesign. More details about setting up. Tooltips changed to descriptions. * Bugfixes: From 59fc5e70cdc62c5205259f2ae654ee3d8a324c10 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 14:26:14 +0200 Subject: [PATCH 42/76] - updated settings texts; --- includes/admin/core/class-admin-settings.php | 64 ++++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index c2a5bcad..450b010a 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1645,7 +1645,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_template', 'type' => 'select', 'label' => __( 'Profile Default Template', 'ultimate-member' ), - 'tooltip' => __( 'This will be the default template to output profile', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output profile', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_template' ), 'options' => UM()->shortcodes()->get_templates( 'profile' ), 'size' => 'small', @@ -1655,7 +1655,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_max_width' ), - 'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), 'size' => 'small', ), array( @@ -1663,14 +1663,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_area_max_width' ), - 'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ), + 'description' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ), 'size' => 'small', ), array( 'id' => 'profile_icons', 'type' => 'select', 'label' => __( 'Profile Field Icons', 'ultimate-member' ), - 'tooltip' => __( 'This is applicable for edit mode only', 'ultimate-member' ), + 'description' => __( 'This is applicable for edit mode only', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_icons' ), 'options' => array( 'field' => __( 'Show inside text field', 'ultimate-member' ), @@ -1684,7 +1684,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Primary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_primary_btn_word' ), - 'tooltip' => __( 'The text that is used for updating profile button', 'ultimate-member' ), + 'description' => __( 'The text that is used for updating profile button', 'ultimate-member' ), 'size' => 'medium', ), array( @@ -1692,14 +1692,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Profile Secondary Button', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_secondary_btn' ), - 'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), ), array( 'id' => 'profile_secondary_btn_word', 'type' => 'text', 'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_secondary_btn_word' ), - 'tooltip' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ), + 'description' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ), 'conditional' => array( 'profile_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1707,7 +1707,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'default_avatar', 'type' => 'media', 'label' => __( 'Default Profile Photo', 'ultimate-member' ), - 'tooltip' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ), + 'description' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ), 'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ), 'default' => array( 'url' => UM_URL . 'assets/img/default_avatar.jpg', @@ -1719,14 +1719,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'url' => true, 'preview' => false, 'label' => __( 'Default Cover Photo', 'ultimate-member' ), - 'tooltip' => __( 'You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member' ), + 'description' => __( 'You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member' ), 'upload_frame_title' => __( 'Select Default Cover Photo', 'ultimate-member' ), ), array( 'id' => 'disable_profile_photo_upload', 'type' => 'checkbox', 'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), - 'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), + 'description' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), 'default' => um_get_metadefault( 'disable_profile_photo_upload' ), ), array( @@ -1735,7 +1735,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Photo Size', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_photosize' ), 'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ), - 'tooltip' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'description' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ), 'size' => 'small', ), array( @@ -1743,7 +1743,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Profile Cover Photos', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_cover_enabled' ), - 'tooltip' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ), + 'description' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ), ), array( 'id' => 'profile_coversize', @@ -1751,7 +1751,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Cover Size', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_coversize' ), 'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ), - 'tooltip' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'description' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ), 'conditional' => array( 'profile_cover_enabled', '=', 1 ), 'size' => 'small', ), @@ -1759,7 +1759,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_cover_ratio', 'type' => 'select', 'label' => __( 'Profile Cover Ratio', 'ultimate-member' ), - 'tooltip' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ), + 'description' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_cover_ratio' ), 'options' => array( '1.6:1' => '1.6:1', @@ -1775,41 +1775,41 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ), 'default' => 0, - 'tooltip' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ), + 'description' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ), ), array( 'id' => 'profile_show_name', 'type' => 'checkbox', 'label' => __( 'Show display name in profile header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_name' ), - 'tooltip' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ), ), array( 'id' => 'profile_show_social_links', 'type' => 'checkbox', 'label' => __( 'Show social links in profile header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_social_links' ), - 'tooltip' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ), ), array( 'id' => 'profile_show_bio', 'type' => 'checkbox', 'label' => __( 'Show user description in header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_bio' ), - 'tooltip' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ), ), array( 'id' => 'profile_show_html_bio', 'type' => 'checkbox', 'label' => __( 'Enable HTML support for user description', 'ultimate-member' ), - 'tooltip' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ), + 'description' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ), ), array( 'id' => 'profile_bio_maxchars', 'type' => 'text', 'label' => __( 'User description maximum chars', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_bio_maxchars' ), - 'tooltip' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ), + 'description' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ), 'conditional' => array( 'profile_show_bio', '=', 1 ), 'size' => 'small', ), @@ -1818,7 +1818,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'select', 'label' => __( 'Profile Header Menu Position', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_header_menu' ), - 'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ), + 'description' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ), 'options' => array( 'bc' => __( 'Bottom of Icon', 'ultimate-member' ), 'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ), @@ -1830,14 +1830,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_empty_text' ), - 'tooltip' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ), + 'description' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ), ), array( 'id' => 'profile_empty_text_emo', 'type' => 'checkbox', 'label' => __( 'Show the emoticon', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_empty_text_emo' ), - 'tooltip' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ), + 'description' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ), 'conditional' => array( 'profile_empty_text', '=', 1 ), ), ), @@ -1855,7 +1855,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_template', 'type' => 'select', 'label' => __( 'Registration Default Template', 'ultimate-member' ), - 'tooltip' => __( 'This will be the default template to output registration', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output registration', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_template' ), 'options' => UM()->shortcodes()->get_templates( 'register' ), 'size' => 'small', @@ -1865,14 +1865,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_max_width' ), - 'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), 'size' => 'small', ), array( 'id' => 'register_align', 'type' => 'select', 'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ), - 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), + 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_align' ), 'options' => array( 'center' => __( 'Centered', 'ultimate-member' ), @@ -1885,7 +1885,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_icons', 'type' => 'select', 'label' => __( 'Registration Field Icons', 'ultimate-member' ), - 'tooltip' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ), + 'description' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_icons' ), 'options' => array( 'field' => __( 'Show inside text field', 'ultimate-member' ), @@ -1899,7 +1899,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Primary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_primary_btn_word' ), - 'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), 'size' => 'medium', ), array( @@ -1907,14 +1907,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Registration Secondary Button', 'ultimate-member' ), 'default' => 1, - 'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), ), array( 'id' => 'register_secondary_btn_word', 'type' => 'text', 'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_secondary_btn_word' ), - 'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), 'conditional' => array( 'register_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1923,7 +1923,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_secondary_btn_url' ), - 'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), + 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), 'conditional' => array( 'register_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1931,7 +1931,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_role', 'type' => 'select', 'label' => __( 'Registration Default Role', 'ultimate-member' ), - 'tooltip' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ), + 'description' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_role' ), 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), 'size' => 'small', From fce290fe74c6ea2d82c8a547f4b2d772d38c8ff2 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 14:51:01 +0200 Subject: [PATCH 43/76] - updated settings texts; --- includes/admin/core/class-admin-settings.php | 427 ++++++++++--------- 1 file changed, 234 insertions(+), 193 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 450b010a..ca210924 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1639,206 +1639,247 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'Appearance', 'ultimate-member' ), 'sections' => array( '' => array( - 'title' => __( 'Profile', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'profile_template', - 'type' => 'select', - 'label' => __( 'Profile Default Template', 'ultimate-member' ), - 'description' => __( 'This will be the default template to output profile', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_template' ), - 'options' => UM()->shortcodes()->get_templates( 'profile' ), - 'size' => 'small', - ), - array( - 'id' => 'profile_max_width', - 'type' => 'text', - 'label' => __( 'Profile Maximum Width', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_max_width' ), - 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'profile_area_max_width', - 'type' => 'text', - 'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_area_max_width' ), - 'description' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'profile_icons', - 'type' => 'select', - 'label' => __( 'Profile Field Icons', 'ultimate-member' ), - 'description' => __( 'This is applicable for edit mode only', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_icons' ), - 'options' => array( - 'field' => __( 'Show inside text field', 'ultimate-member' ), - 'label' => __( 'Show with label', 'ultimate-member' ), - 'off' => __( 'Turn off', 'ultimate-member' ), - ), - 'size' => 'small', - ), - array( - 'id' => 'profile_primary_btn_word', - 'type' => 'text', - 'label' => __( 'Profile Primary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_primary_btn_word' ), - 'description' => __( 'The text that is used for updating profile button', 'ultimate-member' ), - 'size' => 'medium', - ), - array( - 'id' => 'profile_secondary_btn', - 'type' => 'checkbox', - 'label' => __( 'Profile Secondary Button', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_secondary_btn' ), - 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), - ), - array( - 'id' => 'profile_secondary_btn_word', - 'type' => 'text', - 'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_secondary_btn_word' ), - 'description' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ), - 'conditional' => array( 'profile_secondary_btn', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'default_avatar', - 'type' => 'media', - 'label' => __( 'Default Profile Photo', 'ultimate-member' ), - 'description' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ), - 'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ), - 'default' => array( - 'url' => UM_URL . 'assets/img/default_avatar.jpg', + 'title' => __( 'Profile', 'ultimate-member' ), + 'form_sections' => array( + 'template' => array( + 'title' => __( 'Template', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user profile template and size.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'profile_template', + 'type' => 'select', + 'label' => __( 'Profile Default Template', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output profile', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_template' ), + 'options' => UM()->shortcodes()->get_templates( 'profile' ), + 'size' => 'small', + ), + array( + 'id' => 'profile_max_width', + 'type' => 'text', + 'label' => __( 'Profile Maximum Width', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_max_width' ), + 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'size' => 'small', + ), + array( + 'id' => 'profile_area_max_width', + 'type' => 'text', + 'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_area_max_width' ), + 'description' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ), + 'size' => 'small', + ), ), ), - array( - 'id' => 'default_cover', - 'type' => 'media', - 'url' => true, - 'preview' => false, - 'label' => __( 'Default Cover Photo', 'ultimate-member' ), - 'description' => __( 'You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member' ), - 'upload_frame_title' => __( 'Select Default Cover Photo', 'ultimate-member' ), - ), - array( - 'id' => 'disable_profile_photo_upload', - 'type' => 'checkbox', - 'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), - 'description' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), - 'default' => um_get_metadefault( 'disable_profile_photo_upload' ), - ), - array( - 'id' => 'profile_photosize', - 'type' => 'select', - 'label' => __( 'Profile Photo Size', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_photosize' ), - 'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ), - 'description' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'profile_cover_enabled', - 'type' => 'checkbox', - 'label' => __( 'Profile Cover Photos', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_cover_enabled' ), - 'description' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ), - ), - array( - 'id' => 'profile_coversize', - 'type' => 'select', - 'label' => __( 'Profile Cover Size', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_coversize' ), - 'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ), - 'description' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ), - 'conditional' => array( 'profile_cover_enabled', '=', 1 ), - 'size' => 'small', - ), - array( - 'id' => 'profile_cover_ratio', - 'type' => 'select', - 'label' => __( 'Profile Cover Ratio', 'ultimate-member' ), - 'description' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_cover_ratio' ), - 'options' => array( - '1.6:1' => '1.6:1', - '2.7:1' => '2.7:1', - '2.2:1' => '2.2:1', - '3.2:1' => '3.2:1', + 'profile_photo' => array( + 'title' => __( 'Profile photo', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the profile photo component on the user profile.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'default_avatar', + 'type' => 'media', + 'label' => __( 'Default Profile Photo', 'ultimate-member' ), + 'description' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ), + 'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ), + 'default' => array( + 'url' => UM_URL . 'assets/img/default_avatar.jpg', + ), + ), + array( + 'id' => 'disable_profile_photo_upload', + 'type' => 'checkbox', + 'label' => __( 'Profile Photo Upload', 'ultimate-member' ), + 'checkbox_label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), + 'description' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), + 'default' => um_get_metadefault( 'disable_profile_photo_upload' ), + ), + array( + 'id' => 'profile_photosize', + 'type' => 'select', + 'label' => __( 'Profile Photo Size', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_photosize' ), + 'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ), + 'description' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'size' => 'small', + ), ), - 'conditional' => array( 'profile_cover_enabled', '=', 1 ), - 'size' => 'small', ), - array( - 'id' => 'profile_show_metaicon', - 'type' => 'checkbox', - 'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ), - 'default' => 0, - 'description' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ), - ), - array( - 'id' => 'profile_show_name', - 'type' => 'checkbox', - 'label' => __( 'Show display name in profile header', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_show_name' ), - 'description' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ), - ), - array( - 'id' => 'profile_show_social_links', - 'type' => 'checkbox', - 'label' => __( 'Show social links in profile header', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_show_social_links' ), - 'description' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ), - ), - array( - 'id' => 'profile_show_bio', - 'type' => 'checkbox', - 'label' => __( 'Show user description in header', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_show_bio' ), - 'description' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ), - ), - array( - 'id' => 'profile_show_html_bio', - 'type' => 'checkbox', - 'label' => __( 'Enable HTML support for user description', 'ultimate-member' ), - 'description' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ), - ), - array( - 'id' => 'profile_bio_maxchars', - 'type' => 'text', - 'label' => __( 'User description maximum chars', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_bio_maxchars' ), - 'description' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ), - 'conditional' => array( 'profile_show_bio', '=', 1 ), - 'size' => 'small', - ), - array( - 'id' => 'profile_header_menu', - 'type' => 'select', - 'label' => __( 'Profile Header Menu Position', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_header_menu' ), - 'description' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ), - 'options' => array( - 'bc' => __( 'Bottom of Icon', 'ultimate-member' ), - 'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ), + 'cover_photo' => array( + 'title' => __( 'Cover photo', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the profile photo component on the user profile.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'default_cover', + 'type' => 'media', + 'url' => true, + 'preview' => false, + 'label' => __( 'Default Cover Photo', 'ultimate-member' ), + 'description' => __( 'You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member' ), + 'upload_frame_title' => __( 'Select Default Cover Photo', 'ultimate-member' ), + ), + + array( + 'id' => 'profile_cover_enabled', + 'type' => 'checkbox', + 'label' => __( 'Profile Cover Photos', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable Cover Photos', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_cover_enabled' ), + 'description' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ), + ), + array( + 'id' => 'profile_coversize', + 'type' => 'select', + 'label' => __( 'Profile Cover Size', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_coversize' ), + 'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ), + 'description' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'conditional' => array( 'profile_cover_enabled', '=', 1 ), + 'size' => 'small', + ), + array( + 'id' => 'profile_cover_ratio', + 'type' => 'select', + 'label' => __( 'Profile Cover Ratio', 'ultimate-member' ), + 'description' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_cover_ratio' ), + 'options' => array( + '1.6:1' => '1.6:1', + '2.7:1' => '2.7:1', + '2.2:1' => '2.2:1', + '3.2:1' => '3.2:1', + ), + 'conditional' => array( 'profile_cover_enabled', '=', 1 ), + 'size' => 'small', + ), ), - 'size' => 'small', ), - array( - 'id' => 'profile_empty_text', - 'type' => 'checkbox', - 'label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_empty_text' ), - 'description' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ), + 'header' => array( + 'title' => __( 'Header', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user profile header component.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'profile_show_metaicon', + 'type' => 'checkbox', + 'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ), + 'checkbox_label' => __( 'Show icons in Profile Header Meta', 'ultimate-member' ), + 'default' => 0, + 'description' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ), + ), + array( + 'id' => 'profile_show_name', + 'type' => 'checkbox', + 'label' => __( 'Display name in profile header', 'ultimate-member' ), + 'checkbox_label' => __( 'Show display name in profile header', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_show_name' ), + 'description' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ), + ), + array( + 'id' => 'profile_show_social_links', + 'type' => 'checkbox', + 'label' => __( 'Social links in profile header', 'ultimate-member' ), + 'checkbox_label' => __( 'Show social links in profile header', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_show_social_links' ), + 'description' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ), + ), + array( + 'id' => 'profile_show_bio', + 'type' => 'checkbox', + 'label' => __( 'User description in profile header', 'ultimate-member' ), + 'checkbox_label' => __( 'Show user description in profile header', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_show_bio' ), + 'description' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ), + ), + array( + 'id' => 'profile_bio_maxchars', + 'type' => 'text', + 'label' => __( 'User description maximum chars', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_bio_maxchars' ), + 'description' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ), + 'conditional' => array( 'profile_show_bio', '=', 1 ), + 'size' => 'small', + ), + array( + 'id' => 'profile_show_html_bio', + 'type' => 'checkbox', + 'label' => __( 'HTML support for user description', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable HTML support for user description', 'ultimate-member' ), + 'description' => __( 'Switch on/off to enable/disable support for HTML tags on user description.', 'ultimate-member' ), + ), + array( + 'id' => 'profile_header_menu', + 'type' => 'select', + 'label' => __( 'Profile Header Menu Position', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_header_menu' ), + 'description' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ), + 'options' => array( + 'bc' => __( 'Bottom of Icon', 'ultimate-member' ), + 'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ), + ), + 'size' => 'small', + ), + ), ), - array( - 'id' => 'profile_empty_text_emo', - 'type' => 'checkbox', - 'label' => __( 'Show the emoticon', 'ultimate-member' ), - 'default' => um_get_metadefault( 'profile_empty_text_emo' ), - 'description' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ), - 'conditional' => array( 'profile_empty_text', '=', 1 ), + 'fields' => array( + 'title' => __( 'Buttons & Fields', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user profile buttons and fields layout.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'profile_primary_btn_word', + 'type' => 'text', + 'label' => __( 'Profile Primary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_primary_btn_word' ), + 'description' => __( 'The text that is used for updating profile button', 'ultimate-member' ), + 'size' => 'medium', + ), + array( + 'id' => 'profile_secondary_btn', + 'type' => 'checkbox', + 'label' => __( 'Profile Secondary Button', 'ultimate-member' ), + 'checkbox_label' => __( 'Show Profile Secondary Button', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_secondary_btn' ), + 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + ), + array( + 'id' => 'profile_secondary_btn_word', + 'type' => 'text', + 'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_secondary_btn_word' ), + 'description' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ), + 'conditional' => array( 'profile_secondary_btn', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'profile_icons', + 'type' => 'select', + 'label' => __( 'Profile Field Icons', 'ultimate-member' ), + 'description' => __( 'This is applicable for edit mode only', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_icons' ), + 'options' => array( + 'field' => __( 'Show inside text field', 'ultimate-member' ), + 'label' => __( 'Show with label', 'ultimate-member' ), + 'off' => __( 'Turn off', 'ultimate-member' ), + ), + 'size' => 'small', + ), + array( + 'id' => 'profile_empty_text', + 'type' => 'checkbox', + 'label' => __( 'Custom message on empty profile', 'ultimate-member' ), + 'checkbox_label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_empty_text' ), + 'description' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ), + ), + array( + 'id' => 'profile_empty_text_emo', + 'type' => 'checkbox', + 'label' => __( 'Custom message emoticon', 'ultimate-member' ), + 'checkbox_label' => __( 'Show the emoticon', 'ultimate-member' ), + 'default' => um_get_metadefault( 'profile_empty_text_emo' ), + 'description' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ), + 'conditional' => array( 'profile_empty_text', '=', 1 ), + ), + ), ), ), ), From c1a5459b1f340c5d15e9a973ea36f50863e154cb Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 15:01:52 +0200 Subject: [PATCH 44/76] - updated settings texts; --- includes/admin/core/class-admin-settings.php | 185 ++++++++++--------- 1 file changed, 102 insertions(+), 83 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index ca210924..1d94f2d1 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1889,99 +1889,118 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'fields' => $appearances_profile_menu_fields, ), 'registration_form' => array( - 'title' => __( 'Registration Form', 'ultimate-member' ), - 'description' => __( 'This section allows you to customize the user profiles menus on your site.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'register_template', - 'type' => 'select', - 'label' => __( 'Registration Default Template', 'ultimate-member' ), - 'description' => __( 'This will be the default template to output registration', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_template' ), - 'options' => UM()->shortcodes()->get_templates( 'register' ), - 'size' => 'small', - ), - array( - 'id' => 'register_max_width', - 'type' => 'text', - 'label' => __( 'Registration Maximum Width', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_max_width' ), - 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'register_align', - 'type' => 'select', - 'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ), - 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_align' ), - 'options' => array( - 'center' => __( 'Centered', 'ultimate-member' ), - 'left' => __( 'Left aligned', 'ultimate-member' ), - 'right' => __( 'Right aligned', 'ultimate-member' ), + 'title' => __( 'Registration Form', 'ultimate-member' ), + 'form_sections' => array( + 'user_role' => array( + 'title' => __( 'User Role', 'ultimate-member' ), + 'description' => __( 'This section allows you to set default user role assigned after registration.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'register_role', + 'type' => 'select', + 'label' => __( 'Registration Default Role', 'ultimate-member' ), + 'description' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_role' ), + 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), + 'size' => 'small', + ), ), - 'size' => 'small', ), - array( - 'id' => 'register_icons', - 'type' => 'select', - 'label' => __( 'Registration Field Icons', 'ultimate-member' ), - 'description' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_icons' ), - 'options' => array( - 'field' => __( 'Show inside text field', 'ultimate-member' ), - 'label' => __( 'Show with label', 'ultimate-member' ), - 'off' => __( 'Turn off', 'ultimate-member' ), + 'template' => array( + 'title' => __( 'Template', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user registration template and size.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'register_template', + 'type' => 'select', + 'label' => __( 'Registration Default Template', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output registration', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_template' ), + 'options' => UM()->shortcodes()->get_templates( 'register' ), + 'size' => 'small', + ), + array( + 'id' => 'register_max_width', + 'type' => 'text', + 'label' => __( 'Registration Maximum Width', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_max_width' ), + 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'size' => 'small', + ), + array( + 'id' => 'register_align', + 'type' => 'select', + 'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ), + 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_align' ), + 'options' => array( + 'center' => __( 'Centered', 'ultimate-member' ), + 'left' => __( 'Left aligned', 'ultimate-member' ), + 'right' => __( 'Right aligned', 'ultimate-member' ), + ), + 'size' => 'small', + ), ), - 'size' => 'small', ), - array( - 'id' => 'register_primary_btn_word', - 'type' => 'text', - 'label' => __( 'Registration Primary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_primary_btn_word' ), - 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), - 'size' => 'medium', - ), - array( - 'id' => 'register_secondary_btn', - 'type' => 'checkbox', - 'label' => __( 'Registration Secondary Button', 'ultimate-member' ), - 'default' => 1, - 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), - ), - array( - 'id' => 'register_secondary_btn_word', - 'type' => 'text', - 'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_secondary_btn_word' ), - 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), - 'conditional' => array( 'register_secondary_btn', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'register_secondary_btn_url', - 'type' => 'text', - 'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_secondary_btn_url' ), - 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), - 'conditional' => array( 'register_secondary_btn', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'register_role', - 'type' => 'select', - 'label' => __( 'Registration Default Role', 'ultimate-member' ), - 'description' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_role' ), - 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), - 'size' => 'small', + 'fields' => array( + 'title' => __( 'Buttons & Fields', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user registration buttons and fields layout.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'register_primary_btn_word', + 'type' => 'text', + 'label' => __( 'Registration Primary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_primary_btn_word' ), + 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), + 'size' => 'medium', + ), + array( + 'id' => 'register_secondary_btn', + 'type' => 'checkbox', + 'label' => __( 'Registration Secondary Button', 'ultimate-member' ), + 'checkbox_label' => __( 'Show Registration Secondary Button', 'ultimate-member' ), + 'default' => 1, + 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + ), + array( + 'id' => 'register_secondary_btn_word', + 'type' => 'text', + 'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_secondary_btn_word' ), + 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), + 'conditional' => array( 'register_secondary_btn', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'register_secondary_btn_url', + 'type' => 'text', + 'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_secondary_btn_url' ), + 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), + 'conditional' => array( 'register_secondary_btn', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'register_icons', + 'type' => 'select', + 'label' => __( 'Registration Field Icons', 'ultimate-member' ), + 'description' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_icons' ), + 'options' => array( + 'field' => __( 'Show inside text field', 'ultimate-member' ), + 'label' => __( 'Show with label', 'ultimate-member' ), + 'off' => __( 'Turn off', 'ultimate-member' ), + ), + 'size' => 'small', + ), + ), ), ), ), 'login_form' => array( 'title' => __( 'Login Form', 'ultimate-member' ), 'description' => __( 'This section allows you to customize Ultimate Member login form on your site.', 'ultimate-member' ), +// 'form_sections' => array(), 'fields' => array( array( 'id' => 'login_template', From 8918b61295cdc884a55ebcdb77252c18881002db Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 15:20:28 +0200 Subject: [PATCH 45/76] - updated settings texts; --- includes/admin/core/class-admin-settings.php | 307 ++++++++++--------- 1 file changed, 160 insertions(+), 147 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 1d94f2d1..dd143a0c 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -486,7 +486,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_menu_default_tab', 'type' => 'select', 'label' => __( 'Profile menu default tab', 'ultimate-member' ), - 'description' => __( 'This will be the default tab on user profile page', 'ultimate-member' ), + 'description' => __( 'This will be the default tab on user profile page.', 'ultimate-member' ), 'options' => $tabs_options, 'conditional' => array( implode( '|', $tabs_condition ), '~', 1 ), 'size' => 'small', @@ -504,7 +504,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Menu icons in desktop view', 'ultimate-member' ), 'checkbox_label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ), - 'description' => __( '"Desktop view" means the profile block\'s width lower than 800px', 'ultimate-member' ), + 'description' => __( '"Desktop view" means the profile block\'s width lower than 800px.', 'ultimate-member' ), 'conditional' => array( 'profile_menu', '=', 1 ), ), ) @@ -581,14 +581,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'a$access_fieldsccess_redirect', 'type' => 'text', 'label' => __( 'Custom Redirect URL', 'ultimate-member' ), - 'description' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimate-member' ), + 'description' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site.', 'ultimate-member' ), 'conditional' => array( 'accessible', '=', 2 ), ), array( 'id' => 'access_exclude_uris', 'type' => 'multi_text', 'label' => __( 'Exclude the following URLs', 'ultimate-member' ), - 'description' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ), + 'description' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone.', 'ultimate-member' ), 'add_text' => __( 'Add New URL', 'ultimate-member' ), 'conditional' => array( 'accessible', '=', 2 ), 'show_default_number' => 0, @@ -612,7 +612,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Restricted Post Title', 'ultimate-member' ), 'checkbox_label' => __( 'Replace the restricted Post Title', 'ultimate-member' ), - 'description' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content', 'ultimate-member' ), + 'description' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content.', 'ultimate-member' ), ), array( 'id' => 'restricted_access_post_title', @@ -625,7 +625,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'restricted_access_message', 'type' => 'wp_editor', 'label' => __( 'Restricted Access Message', 'ultimate-member' ), - 'description' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ), + 'description' => __( 'This is the message shown to users that do not have permission to view the content.', 'ultimate-member' ), ), ); @@ -669,13 +669,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Restricted Gutenberg Blocks', 'ultimate-member' ), 'checkbox_label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ), - 'description' => __( 'If enabled then allows to set the blocks restriction settings in wp-admin', 'ultimate-member' ), + 'description' => __( 'If enabled then allows to set the blocks restriction settings in wp-admin.', 'ultimate-member' ), ), array( 'id' => 'restricted_block_message', 'type' => 'textarea', 'label' => __( 'Restricted Access Block Message', 'ultimate-member' ), - 'description' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ), + 'description' => __( 'This is the message shown to users that do not have permission to view the block\'s content.', 'ultimate-member' ), 'conditional' => array( 'restricted_blocks', '=', 1 ), ), ) @@ -706,7 +706,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'restricted_access_post_metabox', 'type' => 'multi_checkbox', 'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ), - 'description' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), + 'description' => __( 'Check post types for which you plan to use the "Content Restriction" settings.', 'ultimate-member' ), 'options' => $post_types_options, 'columns' => 3, 'value' => $restricted_access_post_metabox_value, @@ -716,7 +716,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'restricted_access_taxonomy_metabox', 'type' => 'multi_checkbox', 'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ), - 'description' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ), + 'description' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings.', 'ultimate-member' ), 'options' => $taxonomies_options, 'columns' => 3, 'value' => $restricted_access_taxonomy_metabox_value, @@ -1150,14 +1150,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Hide author pages', 'ultimate-member' ), 'checkbox_label' => __( 'Enable automatically redirect author page to their profile', 'ultimate-member' ), - 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ), + 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page.', 'ultimate-member' ), ), array( 'id' => 'members_page', 'type' => 'checkbox', 'label' => __( 'Members Directory', 'ultimate-member' ), 'checkbox_label' => __( 'Enable Members Directory', 'ultimate-member' ), - 'description' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ), + 'description' => __( 'Control whether to enable or disable member directories on this site.', 'ultimate-member' ), ), array( 'id' => 'use_gravatars', @@ -1170,7 +1170,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'use_um_gravatar_default_builtin_image', 'type' => 'select', 'label' => __( 'Use Gravatar builtin image', 'ultimate-member' ), - 'description' => __( 'Gravatar has a number of built in options which you can also use as defaults', 'ultimate-member' ), + 'description' => __( 'Gravatar has a number of built in options which you can also use as defaults.', 'ultimate-member' ), 'options' => array( 'default' => __( 'Default', 'ultimate-member' ), '404' => __( '404 ( File Not Found response )', 'ultimate-member' ), @@ -1189,7 +1189,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Replace Gravatar\'s Default avatar', 'ultimate-member' ), 'checkbox_label' => __( 'Set Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ), - 'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo/avatar)', 'ultimate-member' ), + 'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo/avatar).', 'ultimate-member' ), 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ), ), array( @@ -1347,7 +1347,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Privacy Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display privacy account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Privacy account tab in account page', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Privacy account tab in account page.', 'ultimate-member' ), ), array( 'id' => 'account_hide_in_directory', @@ -1361,7 +1361,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'account_hide_in_directory_default', 'type' => 'select', 'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ), - 'description' => __( 'Set default value for the "Hide my profile from directory" option', 'ultimate-member' ), + 'description' => __( 'Set default value for the "Hide my profile from directory" option.', 'ultimate-member' ), 'options' => array( 'No' => __( 'No', 'ultimate-member' ), 'Yes' => __( 'Yes', 'ultimate-member' ), @@ -1380,7 +1380,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Notifications Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display notifications account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Notifications account tab in account page', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Notifications account tab in account page.', 'ultimate-member' ), ), ), ), @@ -1393,7 +1393,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Delete Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display delete account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Delete account tab in account page', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Delete account tab in account page.', 'ultimate-member' ), ), array( 'id' => 'delete_account_text', @@ -1458,7 +1458,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'size' => 'small', 'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ), - 'description' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ), + 'description' => __( 'Sets a maximum size for the uploaded photo.', 'ultimate-member' ), ), array( 'id' => 'photo_thumb_sizes', @@ -1481,14 +1481,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'size' => 'small', 'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ), - 'description' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ), + 'description' => __( 'Sets a maximum size for the uploaded cover.', 'ultimate-member' ), ), array( 'id' => 'cover_min_width', 'type' => 'text', 'size' => 'small', 'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ), - 'description' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ), + 'description' => __( 'This will be the minimum width for cover photo uploads.', 'ultimate-member' ), ), array( 'id' => 'cover_thumb_sizes', @@ -1519,7 +1519,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'form_sections' => array( 'rp' => array( 'title' => __( 'Reset Password', 'ultimate-member' ), - 'description' => __( 'Allows to manage reset password settings', 'ultimate-member' ), + 'description' => __( 'Allows to manage reset password settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'enable_reset_password_limit', @@ -1554,19 +1554,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'blocked_emails', 'type' => 'textarea', 'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ), - 'description' => __( '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' ), + 'description' => __( '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 (Enter one word per line)', 'ultimate-member' ), - 'description' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ), + 'description' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username.', 'ultimate-member' ), ), ), ), 'fields' => array( 'title' => __( 'Fields', 'ultimate-member' ), - 'description' => __( 'Allows to manage fields settings', 'ultimate-member' ), + 'description' => __( 'Allows to manage fields settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'allowed_choice_callbacks', @@ -1578,7 +1578,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), 'redirect' => array( 'title' => __( 'Redirect', 'ultimate-member' ), - 'description' => __( 'Allows to manage redirect settings', 'ultimate-member' ), + 'description' => __( 'Allows to manage redirect settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'allow_url_redirect_confirm', @@ -1604,19 +1604,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'admin_email', 'type' => 'text', 'label' => __( 'Admin E-mail Address', 'ultimate-member' ), - 'description' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), + 'description' => __( 'e.g. admin@companyname.com.', 'ultimate-member' ), ), array( 'id' => 'mail_from', 'type' => 'text', 'label' => __( 'Mail appears from', 'ultimate-member' ), - 'description' => __( 'e.g. Site Name', 'ultimate-member' ), + 'description' => __( 'e.g. Site Name.', 'ultimate-member' ), ), array( 'id' => 'mail_from_addr', 'type' => 'text', 'label' => __( 'Mail appears from address', 'ultimate-member' ), - 'description' => __( 'e.g. admin@companyname.com', 'ultimate-member' ), + 'description' => __( 'e.g. admin@companyname.com.', 'ultimate-member' ), ), ), ), @@ -1649,7 +1649,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_template', 'type' => 'select', 'label' => __( 'Profile Default Template', 'ultimate-member' ), - 'description' => __( 'This will be the default template to output profile', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output profile.', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_template' ), 'options' => UM()->shortcodes()->get_templates( 'profile' ), 'size' => 'small', @@ -1659,7 +1659,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_max_width' ), - 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'description' => __( 'The maximum width this shortcode can take from the page width.', 'ultimate-member' ), 'size' => 'small', ), array( @@ -1667,7 +1667,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_area_max_width' ), - 'description' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ), + 'description' => __( 'The maximum width of the profile area inside profile (below profile header).', 'ultimate-member' ), 'size' => 'small', ), ), @@ -1691,7 +1691,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Profile Photo Upload', 'ultimate-member' ), 'checkbox_label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), - 'description' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), + 'description' => __( 'Switch on/off the profile photo uploader.', 'ultimate-member' ), 'default' => um_get_metadefault( 'disable_profile_photo_upload' ), ), array( @@ -1700,7 +1700,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Photo Size', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_photosize' ), 'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ), - 'description' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'description' => __( 'The global default of profile photo size. This can be overridden by individual form settings.', 'ultimate-member' ), 'size' => 'small', ), ), @@ -1725,7 +1725,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Cover Photos', 'ultimate-member' ), 'checkbox_label' => __( 'Enable Cover Photos', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_cover_enabled' ), - 'description' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ), + 'description' => __( 'Switch on/off the profile cover photos.', 'ultimate-member' ), ), array( 'id' => 'profile_coversize', @@ -1733,7 +1733,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Cover Size', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_coversize' ), 'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ), - 'description' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ), + 'description' => __( 'The global default width of cover photo size. This can be overridden by individual form settings.', 'ultimate-member' ), 'conditional' => array( 'profile_cover_enabled', '=', 1 ), 'size' => 'small', ), @@ -1741,7 +1741,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_cover_ratio', 'type' => 'select', 'label' => __( 'Profile Cover Ratio', 'ultimate-member' ), - 'description' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ), + 'description' => __( 'Choose global ratio for cover photos of profiles.', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_cover_ratio' ), 'options' => array( '1.6:1' => '1.6:1', @@ -1764,7 +1764,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ), 'checkbox_label' => __( 'Show icons in Profile Header Meta', 'ultimate-member' ), 'default' => 0, - 'description' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ), + 'description' => __( 'Display field icons for related user meta fields in header or not.', 'ultimate-member' ), ), array( 'id' => 'profile_show_name', @@ -1772,7 +1772,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Display name in profile header', 'ultimate-member' ), 'checkbox_label' => __( 'Show display name in profile header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_name' ), - 'description' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the user name on profile header.', 'ultimate-member' ), ), array( 'id' => 'profile_show_social_links', @@ -1780,7 +1780,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Social links in profile header', 'ultimate-member' ), 'checkbox_label' => __( 'Show social links in profile header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_social_links' ), - 'description' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the social links on profile header.', 'ultimate-member' ), ), array( 'id' => 'profile_show_bio', @@ -1788,7 +1788,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'User description in profile header', 'ultimate-member' ), 'checkbox_label' => __( 'Show user description in profile header', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_show_bio' ), - 'description' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ), + 'description' => __( 'Switch on/off the user description on profile header.', 'ultimate-member' ), ), array( 'id' => 'profile_bio_maxchars', @@ -1829,7 +1829,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Profile Primary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_primary_btn_word' ), - 'description' => __( 'The text that is used for updating profile button', 'ultimate-member' ), + 'description' => __( 'The text that is used for updating profile button.', 'ultimate-member' ), 'size' => 'medium', ), array( @@ -1838,14 +1838,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Profile Secondary Button', 'ultimate-member' ), 'checkbox_label' => __( 'Show Profile Secondary Button', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_secondary_btn' ), - 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the secondary button display in the form.', 'ultimate-member' ), ), array( 'id' => 'profile_secondary_btn_word', 'type' => 'text', 'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_secondary_btn_word' ), - 'description' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ), + 'description' => __( 'The text that is used for cancelling update profile button.', 'ultimate-member' ), 'conditional' => array( 'profile_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1853,7 +1853,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_icons', 'type' => 'select', 'label' => __( 'Profile Field Icons', 'ultimate-member' ), - 'description' => __( 'This is applicable for edit mode only', 'ultimate-member' ), + 'description' => __( 'This is applicable for edit mode only.', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_icons' ), 'options' => array( 'field' => __( 'Show inside text field', 'ultimate-member' ), @@ -1868,7 +1868,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Custom message on empty profile', 'ultimate-member' ), 'checkbox_label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_empty_text' ), - 'description' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ), + 'description' => __( 'Switch on/off the custom message that appears when the profile is empty.', 'ultimate-member' ), ), array( 'id' => 'profile_empty_text_emo', @@ -1876,7 +1876,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Custom message emoticon', 'ultimate-member' ), 'checkbox_label' => __( 'Show the emoticon', 'ultimate-member' ), 'default' => um_get_metadefault( 'profile_empty_text_emo' ), - 'description' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ), + 'description' => __( 'Switch on/off the emoticon (sad face) that appears above the message.', 'ultimate-member' ), 'conditional' => array( 'profile_empty_text', '=', 1 ), ), ), @@ -1899,7 +1899,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_role', 'type' => 'select', 'label' => __( 'Registration Default Role', 'ultimate-member' ), - 'description' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ), + 'description' => __( 'This will be the default role assigned to users registering thru registration form.', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_role' ), 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), 'size' => 'small', @@ -1914,7 +1914,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_template', 'type' => 'select', 'label' => __( 'Registration Default Template', 'ultimate-member' ), - 'description' => __( 'This will be the default template to output registration', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output registration.', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_template' ), 'options' => UM()->shortcodes()->get_templates( 'register' ), 'size' => 'small', @@ -1924,14 +1924,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Maximum Width', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_max_width' ), - 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), + 'description' => __( 'The maximum width this shortcode can take from the page width.', 'ultimate-member' ), 'size' => 'small', ), array( 'id' => 'register_align', 'type' => 'select', 'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ), - 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), + 'description' => __( 'The shortcode is centered by default unless you specify otherwise here.', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_align' ), 'options' => array( 'center' => __( 'Centered', 'ultimate-member' ), @@ -1951,7 +1951,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Primary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_primary_btn_word' ), - 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for primary button text.', 'ultimate-member' ), 'size' => 'medium', ), array( @@ -1960,14 +1960,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'label' => __( 'Registration Secondary Button', 'ultimate-member' ), 'checkbox_label' => __( 'Show Registration Secondary Button', 'ultimate-member' ), 'default' => 1, - 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), + 'description' => __( 'Switch on/off the secondary button display in the form.', 'ultimate-member' ), ), array( 'id' => 'register_secondary_btn_word', 'type' => 'text', 'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_secondary_btn_word' ), - 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), + 'description' => __( 'The text that is used for the secondary button text.', 'ultimate-member' ), 'conditional' => array( 'register_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1976,7 +1976,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'text', 'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_secondary_btn_url' ), - 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), + 'description' => __( 'You can replace default link for this button by entering custom URL.', 'ultimate-member' ), 'conditional' => array( 'register_secondary_btn', '=', 1 ), 'size' => 'medium', ), @@ -1984,7 +1984,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'register_icons', 'type' => 'select', 'label' => __( 'Registration Field Icons', 'ultimate-member' ), - 'description' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ), + 'description' => __( 'This controls the display of field icons in the registration form.', 'ultimate-member' ), 'default' => um_get_metadefault( 'register_icons' ), 'options' => array( 'field' => __( 'Show inside text field', 'ultimate-member' ), @@ -1998,99 +1998,112 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'login_form' => array( - 'title' => __( 'Login Form', 'ultimate-member' ), - 'description' => __( 'This section allows you to customize Ultimate Member login form on your site.', 'ultimate-member' ), -// 'form_sections' => array(), - 'fields' => array( - array( - 'id' => 'login_template', - 'type' => 'select', - 'label' => __( 'Login Default Template', 'ultimate-member' ), - 'description' => __( 'This will be the default template to output login', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_template' ), - 'options' => UM()->shortcodes()->get_templates( 'login' ), - 'size' => 'small', - ), - array( - 'id' => 'login_max_width', - 'type' => 'text', - 'label' => __( 'Login Maximum Width', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_max_width' ), - 'description' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ), - 'size' => 'small', - ), - array( - 'id' => 'login_align', - 'type' => 'select', - 'label' => __( 'Login Shortcode Alignment', 'ultimate-member' ), - 'description' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_align' ), - 'options' => array( - 'center' => __( 'Centered', 'ultimate-member' ), - 'left' => __( 'Left aligned', 'ultimate-member' ), - 'right' => __( 'Right aligned', 'ultimate-member' ), + 'title' => __( 'Login Form', 'ultimate-member' ), + 'form_sections' => array( + 'template' => array( + 'title' => __( 'Template', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user login template and size.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'login_template', + 'type' => 'select', + 'label' => __( 'Login Default Template', 'ultimate-member' ), + 'description' => __( 'This will be the default template to output login.', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_template' ), + 'options' => UM()->shortcodes()->get_templates( 'login' ), + 'size' => 'small', + ), + array( + 'id' => 'login_max_width', + 'type' => 'text', + 'label' => __( 'Login Maximum Width', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_max_width' ), + 'description' => __( 'The maximum width this shortcode can take from the page width.', 'ultimate-member' ), + 'size' => 'small', + ), + array( + 'id' => 'login_align', + 'type' => 'select', + 'label' => __( 'Login Shortcode Alignment', 'ultimate-member' ), + 'description' => __( 'The shortcode is centered by default unless you specify otherwise here.', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_align' ), + 'options' => array( + 'center' => __( 'Centered', 'ultimate-member' ), + 'left' => __( 'Left aligned', 'ultimate-member' ), + 'right' => __( 'Right aligned', 'ultimate-member' ), + ), + 'size' => 'small', + ), ), - 'size' => 'small', ), - array( - 'id' => 'login_icons', - 'type' => 'select', - 'label' => __( 'Login Field Icons', 'ultimate-member' ), - 'description' => __( 'This controls the display of field icons in the login form', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_icons' ), - 'options' => array( - 'field' => __( 'Show inside text field', 'ultimate-member' ), - 'label' => __( 'Show with label', 'ultimate-member' ), - 'off' => __( 'Turn off', 'ultimate-member' ), + 'fields' => array( + 'title' => __( 'Buttons & Fields', 'ultimate-member' ), + 'description' => __( 'This section allows you to customize the user login buttons and fields layout.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'login_primary_btn_word', + 'type' => 'text', + 'label' => __( 'Login Primary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_primary_btn_word' ), + 'description' => __( 'The text that is used for primary button text.', 'ultimate-member' ), + 'size' => 'medium', + ), + array( + 'id' => 'login_secondary_btn', + 'type' => 'checkbox', + 'label' => __( 'Login Secondary Button', 'ultimate-member' ), + 'checkbox_label' => __( 'Show Login Secondary Button', 'ultimate-member' ), + 'default' => 1, + 'description' => __( 'Switch on/off the secondary button display in the form.', 'ultimate-member' ), + ), + array( + 'id' => 'login_secondary_btn_word', + 'type' => 'text', + 'label' => __( 'Login Secondary Button Text', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_secondary_btn_word' ), + 'description' => __( 'The text that is used for the secondary button text.', 'ultimate-member' ), + 'conditional' => array( 'login_secondary_btn', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'login_secondary_btn_url', + 'type' => 'text', + 'label' => __( 'Login Secondary Button URL', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_secondary_btn_url' ), + 'description' => __( 'You can replace default link for this button by entering custom URL.', 'ultimate-member' ), + 'conditional' => array( 'login_secondary_btn', '=', 1 ), + 'size' => 'medium', + ), + array( + 'id' => 'login_forgot_pass_link', + 'type' => 'checkbox', + 'label' => __( 'Login Forgot Password Link', 'ultimate-member' ), + 'checkbox_label' => __( 'Show Login Forgot Password Link', 'ultimate-member' ), + 'default' => 1, + 'description' => __( 'Switch on/off the forgot password link in login form.', 'ultimate-member' ), + ), + array( + 'id' => 'login_show_rememberme', + 'type' => 'checkbox', + 'label' => __( '"Remember Me" checkbox', 'ultimate-member' ), + 'checkbox_label' => __( 'Show "Remember Me" checkbox', 'ultimate-member' ), + 'default' => 1, + 'description' => __( 'Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimate-member' ), + ), + array( + 'id' => 'login_icons', + 'type' => 'select', + 'label' => __( 'Login Field Icons', 'ultimate-member' ), + 'description' => __( 'This controls the display of field icons in the login form.', 'ultimate-member' ), + 'default' => um_get_metadefault( 'login_icons' ), + 'options' => array( + 'field' => __( 'Show inside text field', 'ultimate-member' ), + 'label' => __( 'Show with label', 'ultimate-member' ), + 'off' => __( 'Turn off', 'ultimate-member' ), + ), + 'size' => 'small', + ), ), - 'size' => 'small', - ), - array( - 'id' => 'login_primary_btn_word', - 'type' => 'text', - 'label' => __( 'Login Primary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_primary_btn_word' ), - 'description' => __( 'The text that is used for primary button text', 'ultimate-member' ), - 'size' => 'medium', - ), - array( - 'id' => 'login_secondary_btn', - 'type' => 'checkbox', - 'label' => __( 'Login Secondary Button', 'ultimate-member' ), - 'default' => 1, - 'description' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ), - ), - array( - 'id' => 'login_secondary_btn_word', - 'type' => 'text', - 'label' => __( 'Login Secondary Button Text', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_secondary_btn_word' ), - 'description' => __( 'The text that is used for the secondary button text', 'ultimate-member' ), - 'conditional' => array( 'login_secondary_btn', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'login_secondary_btn_url', - 'type' => 'text', - 'label' => __( 'Login Secondary Button URL', 'ultimate-member' ), - 'default' => um_get_metadefault( 'login_secondary_btn_url' ), - 'description' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ), - 'conditional' => array( 'login_secondary_btn', '=', 1 ), - 'size' => 'medium', - ), - array( - 'id' => 'login_forgot_pass_link', - 'type' => 'checkbox', - 'label' => __( 'Login Forgot Password Link', 'ultimate-member' ), - 'default' => 1, - 'description' => __( 'Switch on/off the forgot password link in login form', 'ultimate-member' ), - ), - array( - 'id' => 'login_show_rememberme', - 'type' => 'checkbox', - 'label' => __( 'Show "Remember Me"', 'ultimate-member' ), - 'default' => 1, - 'description' => __( 'Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimate-member' ), ), ), ), @@ -2125,7 +2138,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'rest_api_version', 'type' => 'select', 'label' => __( 'REST API version', 'ultimate-member' ), - 'description' => __( 'This controls the REST API version, we recommend to use the last version', 'ultimate-member' ), + 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), 'options' => array( '1.0' => __( '1.0 version', 'ultimate-member' ), '2.0' => __( '2.0 version', 'ultimate-member' ), From 5da4994a2a236ce4369af81715a998553658da13 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 7 Feb 2024 17:38:36 +0200 Subject: [PATCH 46/76] - fixed install predefined page script; --- includes/admin/class-admin.php | 120 ++++++++++++++++++---- includes/admin/core/class-admin-forms.php | 2 +- includes/class-config.php | 2 +- includes/core/class-setup.php | 88 ++++++++++++---- 4 files changed, 168 insertions(+), 44 deletions(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 0ca641eb..0abab767 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -1,6 +1,8 @@ setup()->install_default_pages(); - //check empty pages in settings - $empty_pages = array(); - - $pages = UM()->config()->permalinks; - if ( $pages && is_array( $pages ) ) { - foreach ( $pages as $slug => $page_id ) { - $page = get_post( $page_id ); - - if ( ! isset( $page->ID ) && array_key_exists( $slug, UM()->config()->core_pages ) ) { - $empty_pages[] = $slug; - } - } - } - - //if there aren't empty pages - then hide pages notice - if ( empty( $empty_pages ) ) { - $hidden_notices = get_option( 'um_hidden_admin_notices', array() ); - $hidden_notices[] = 'wrong_pages'; - - update_option( 'um_hidden_admin_notices', $hidden_notices ); - } + // Auto dismiss 'wrong_pages' notice if it's visible + $this->dismiss_wrong_pages(); $url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ); wp_safe_redirect( $url ); exit; } + /** + * Install predefined page based on $_REQUEST['um_page_slug'] argument. + */ + public function install_predefined_page() { + if ( ! current_user_can( 'manage_options' ) ) { + $url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ); + wp_safe_redirect( $url ); + exit; + } + + $predefined_pages = array_keys( UM()->config()->get( 'predefined_pages' ) ); + + // phpcs:ignore WordPress.Security.NonceVerification -- early nonce verification based on `um_adm_action` + $page_slug = array_key_exists( 'um_page_slug', $_REQUEST ) ? sanitize_key( $_REQUEST['um_page_slug'] ) : ''; + + if ( empty( $page_slug ) || ! in_array( $page_slug, $predefined_pages, true ) ) { + $url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ); + wp_safe_redirect( $url ); + exit; + } + + $post_ids = new WP_Query( + array( + 'post_type' => 'page', + 'meta_query' => array( + array( + 'key' => '_um_core', + 'value' => $page_slug, + ), + ), + 'posts_per_page' => -1, + 'fields' => 'ids', + ) + ); + + $post_ids = $post_ids->get_posts(); + + if ( ! empty( $post_ids ) ) { + foreach ( $post_ids as $post_id ) { + delete_post_meta( $post_id, '_um_core' ); + } + } + + UM()->setup()->predefined_page( $page_slug ); + + // Auto dismiss 'wrong_pages' notice if it's visible + $this->dismiss_wrong_pages(); + + $url = add_query_arg( + array( + 'page' => 'um_options', + 'update' => 'um_settings_updated', + ), + admin_url( 'admin.php' ) + ); + wp_safe_redirect( $url ); + exit; + } + + /** + * Dismiss 'wrong_pages' notice if it's visible. + */ + public function dismiss_wrong_pages() { + // Check empty pages in settings. + $empty_pages = array(); + + $predefined_pages = array_keys( UM()->config()->get( 'predefined_pages' ) ); + foreach ( $predefined_pages as $slug ) { + $page_id = um_get_predefined_page_id( $slug ); + if ( ! $page_id ) { + $empty_pages[] = $slug; + continue; + } + + $page = get_post( $page_id ); + if ( ! $page ) { + $empty_pages[] = $slug; + continue; + } + } + + // If there aren't empty pages - then hide pages notice + if ( empty( $empty_pages ) ) { + $hidden_notices = get_option( 'um_hidden_admin_notices', array() ); + if ( ! is_array( $hidden_notices ) ) { + $hidden_notices = array(); + } + + $hidden_notices[] = 'wrong_pages'; + + update_option( 'um_hidden_admin_notices', $hidden_notices ); + } + } + /** * Clear all users cache. */ diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 10def99d..70528b08 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -1159,7 +1159,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { $button = ''; $slug = str_replace( 'core_', '', $field_data['id'] ); if ( ! um_get_predefined_page_id( $slug ) || 'publish' !== get_post_status( um_get_predefined_page_id( $slug ) ) ) { - $button = ' 
    ' . esc_html__( 'Create Default', 'ultimate-member' ) . ''; + $button = ' ' . esc_html__( 'Create Default', 'ultimate-member' ) . ''; } $html = "$hidden$button"; diff --git a/includes/class-config.php b/includes/class-config.php index 1a4c7a1e..e58b06ef 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -921,7 +921,7 @@ if ( ! class_exists( 'um\Config' ) ) { * @example
    * function my_predefined_pages( $pages ) { * // your code here - * $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) ); + * $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ), 'content' => 'my-page-predefined-content' ); * return $pages; * } * add_filter( 'um_predefined_pages', 'my_predefined_pages' ); diff --git a/includes/core/class-setup.php b/includes/core/class-setup.php index 209c8ae4..305397b1 100644 --- a/includes/core/class-setup.php +++ b/includes/core/class-setup.php @@ -191,27 +191,7 @@ KEY meta_value_indx (um_value(191)) $content = '[ultimatemember form_id="' . $setup_shortcodes[ $slug ] . '"]'; } - /** - * Filters Ultimate Member predefined pages content when set up the predefined page. - * - * @param {string} $content Predefined page content. - * @param {string} $slug Predefined page slug (key). - * - * @return {string} Predefined page content. - * - * @since 2.1.0 - * @hook um_setup_predefined_page_content - * - * @example - * function my_um_setup_predefined_page_content( $content, $slug ) { - * // your code here - * if ( 'my_page_key' === $slug ) { - * $content = __( 'My Page content', 'my-translate-key' ); - * } - * return $pages; - * } - * add_filter( 'um_setup_predefined_page_content', 'my_um_setup_predefined_page_content' ); - */ + /** This filter is documented in includes/core/class-setup.php */ $content = apply_filters( 'um_setup_predefined_page_content', $content, $slug ); $user_page = array( @@ -243,6 +223,72 @@ KEY meta_value_indx (um_value(191)) UM()->rewrite()->reset_rules(); } + public function predefined_page( $slug, $with_rewrite = true ) { + $page_exists = UM()->query()->find_post_id( 'page', '_um_core', $slug ); + if ( $page_exists ) { + return; + } + + $predefined_pages = UM()->config()->get( 'predefined_pages' ); + if ( empty( $predefined_pages ) || ! array_key_exists( $slug, $predefined_pages ) ) { + return; + } + + $data = $predefined_pages[ $slug ]; + + if ( empty( $data['title'] ) ) { + return; + } + + $content = ! empty( $data['content'] ) ? $data['content'] : ''; + /** + * Filters Ultimate Member predefined pages content when set up the predefined page. + * + * @param {string} $content Predefined page content. + * @param {string} $slug Predefined page slug (key). + * + * @return {string} Predefined page content. + * + * @since 2.1.0 + * @hook um_setup_predefined_page_content + * + * @example + * function my_um_setup_predefined_page_content( $content, $slug ) { + * // your code here + * if ( 'my_page_key' === $slug ) { + * $content = __( 'My Page content', 'my-translate-key' ); + * } + * return $pages; + * } + * add_filter( 'um_setup_predefined_page_content', 'my_um_setup_predefined_page_content' ); + */ + $content = apply_filters( 'um_setup_predefined_page_content', $content, $slug ); + + $user_page = array( + 'post_title' => $data['title'], + 'post_content' => $content, + 'post_name' => $slug, + 'post_type' => 'page', + 'post_status' => 'publish', + 'post_author' => get_current_user_id(), + 'comment_status' => 'closed', + ); + + $post_id = wp_insert_post( $user_page ); + if ( empty( $post_id ) || is_wp_error( $post_id ) ) { + return; + } + + update_post_meta( $post_id, '_um_core', $slug ); + + UM()->options()->update( UM()->options()->get_predefined_page_option_key( $slug ), $post_id ); + + if ( $with_rewrite ) { + // Reset rewrite rules after page creation and option upgrade. + UM()->rewrite()->reset_rules(); + } + } + /** * Set default UM settings. */ From 095c9f7e8b69764d56e256f7d63afdcb249853f4 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 8 Feb 2024 01:50:39 +0200 Subject: [PATCH 47/76] - Fixed: Ignore username slug when custom meta slug exists when parse user from query --- includes/core/class-rewrite.php | 7 +++++++ readme.txt | 1 + 2 files changed, 8 insertions(+) diff --git a/includes/core/class-rewrite.php b/includes/core/class-rewrite.php index a8d66482..ccad3bb4 100644 --- a/includes/core/class-rewrite.php +++ b/includes/core/class-rewrite.php @@ -162,6 +162,13 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) { if ( empty( $custom_meta ) ) { // Set default permalink base if custom meta is empty. $permalink_base = 'user_login'; + } else { + // Ignore username slug if custom meta slug exists. + $user_id = username_exists( um_queried_user() ); + $custom_permalink = get_user_meta( $user_id, 'um_user_profile_url_slug_' . $permalink_base, true ); + if ( ! empty( $custom_permalink ) && um_queried_user() !== $custom_permalink ) { + return false; + } } } diff --git a/readme.txt b/readme.txt index dfbe5c6c..f095ce3d 100644 --- a/readme.txt +++ b/readme.txt @@ -184,6 +184,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI - Fixed: PHP notice while login form submission - Fixed: Email notifications HTML layout - Fixed: Default email notification body color + - Fixed: Ignore username slug when custom meta slug exists when parse user from query * Templates required update: From 822cbf5f563d71c499e3127db1dd3beb6c9f1e35 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 8 Feb 2024 13:09:16 +0200 Subject: [PATCH 48/76] - updated readme.txt --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index f095ce3d..385c4fc5 100644 --- a/readme.txt +++ b/readme.txt @@ -174,6 +174,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI * Bugfixes: + - Fixed: Member directory queries to custom usermeta table properly escaped and validated - Fixed: aria-invalid attribute for the user description field - Fixed: wp_kses protocols for email notifications content - Fixed: PHP notice while registration form validation From 48f0ef187daeeb86d41d07cff317c3c5d82fbe36 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 8 Feb 2024 13:47:15 +0200 Subject: [PATCH 49/76] - fixed member directory custom sorting when WP_Users_Query is active; - wpcs; --- includes/core/class-member-directory.php | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 81e79a6d..26a06e6e 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -1314,24 +1314,24 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $this->query_args['paged'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; } - /** * Add sorting attributes for \WP_Users_Query * * @param array $directory_data Member Directory options */ - function sorting_query( $directory_data ) { + public function sorting_query( $directory_data ) { // sort members by $this->query_args['order'] = 'ASC'; + $sortby = ! empty( $_POST['sorting'] ) ? sanitize_text_field( $_POST['sorting'] ) : $directory_data['sortby']; - $sortby = ( $sortby == 'other' ) ? $directory_data['sortby_custom'] : $sortby; + $sortby = ( 'other' === $sortby ) ? $directory_data['sortby_custom'] : $sortby; $custom_sort = array(); if ( ! empty( $directory_data['sorting_fields'] ) ) { $sorting_fields = maybe_unserialize( $directory_data['sorting_fields'] ); foreach ( $sorting_fields as $field ) { if ( is_array( $field ) ) { - $field_keys = array_keys( $field ); + $field_keys = array_keys( $field ); $custom_sort[] = $field_keys[0]; } } @@ -1384,7 +1384,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $this->query_args['order'] = 'ASC'; } - } elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ) ) ) { + } elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ), true ) ) { $this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $sortby . '_c' => array( 'key' => $sortby, @@ -1426,7 +1426,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $this->query_args['orderby'] = array( 'last_name_c' => 'ASC', 'first_name_c' => 'ASC' ); unset( $this->query_args['order'] ); - } elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys ) ) { + } elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys, true ) ) { $order = 'DESC'; if ( strstr( $sortby, '_desc' ) ) { @@ -1458,18 +1458,23 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { ) ); - $this->query_args['orderby'] = array( $sortby . '_ns' => $order, 'user_registered' => 'DESC' ); + $this->query_args['orderby'] = array( + $sortby . '_ns' => $order, + 'user_registered' => 'DESC', + ); unset( $this->query_args['order'] ); - } elseif ( ( ! empty( $directory_data['sortby_custom'] ) && $sortby == $directory_data['sortby_custom'] ) || in_array( $sortby, $custom_sort ) ) { + } elseif ( ( ! empty( $directory_data['sortby_custom'] ) && $sortby === $directory_data['sortby_custom'] ) || in_array( $sortby, $custom_sort, true ) ) { $custom_sort_order = ! empty( $directory_data['sortby_custom_order'] ) ? $directory_data['sortby_custom_order'] : 'ASC'; $meta_query = new \WP_Meta_Query(); $custom_sort_type = ! empty( $directory_data['sortby_custom_type'] ) ? $meta_query->get_cast_for_type( $directory_data['sortby_custom_type'] ) : 'CHAR'; + if ( ! empty( $directory_data['sorting_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- already verified here $sorting = sanitize_text_field( $_POST['sorting'] ); - $sorting_fields = maybe_serialize( $directory_data['sorting_fields'] ); + $sorting_fields = maybe_unserialize( $directory_data['sorting_fields'] ); + if ( ! empty( $sorting_fields ) && is_array( $sorting_fields ) ) { foreach ( $sorting_fields as $field ) { if ( isset( $field[ $sorting ] ) ) { @@ -2629,14 +2634,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { // Prepare default user query values $this->query_args = array( - 'fields' => 'ids', - 'number' => 0, - 'meta_query' => array( - 'relation' => 'AND' + 'fields' => 'ids', + 'number' => 0, + 'meta_query' => array( + 'relation' => 'AND', ), ); - // handle different restrictions $this->restriction_options(); @@ -2770,7 +2774,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $this->cover_size = apply_filters( 'um_member_directory_cover_image_size', $this->cover_size, $directory_data ); - $avatar_size = UM()->options()->get( 'profile_photosize' ); + $avatar_size = UM()->options()->get( 'profile_photosize' ); $this->avatar_size = str_replace( 'px', '', $avatar_size ); $this->avatar_size = apply_filters( 'um_member_directory_avatar_image_size', $this->avatar_size, $directory_data ); From 3928954decfc3332dca53c1f331cf810e2a70096 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 8 Feb 2024 13:48:02 +0200 Subject: [PATCH 50/76] - updated readme.txt --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 385c4fc5..0676b7d6 100644 --- a/readme.txt +++ b/readme.txt @@ -175,6 +175,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI * Bugfixes: - Fixed: Member directory queries to custom usermeta table properly escaped and validated + - Fixed: Member directory custom sorting when wp_usermeta table is used - Fixed: aria-invalid attribute for the user description field - Fixed: wp_kses protocols for email notifications content - Fixed: PHP notice while registration form validation From 3d13907c2b8bb9e8cc66faf1057b0e91b5d2150e Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 13 Feb 2024 17:16:45 +0200 Subject: [PATCH 51/76] - fixed Member Directory predefined page option; --- includes/admin/core/class-admin-settings.php | 5 +++++ includes/class-config.php | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index dd143a0c..3965f7fe 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -360,6 +360,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $page_setting_description = __( 'Warning: User page must contain a profile form shortcode. You can get existing shortcode or create a new one here.', 'ultimate-member' ); } break; + case 'members': + if ( ! has_shortcode( $content, 'ultimatemember' ) ) { + $page_setting_description = __( 'Warning: Members page must contain a profile form shortcode. You can get existing shortcode or create a new one here.', 'ultimate-member' ); + } + break; default: $page_setting_description = apply_filters( 'um_pages_settings_description', $page_setting_description, $content, $slug ); break; diff --git a/includes/class-config.php b/includes/class-config.php index e58b06ef..6bbdf72b 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -872,13 +872,15 @@ if ( ! class_exists( 'um\Config' ) ) { */ public function init_predefined_pages() { $core_forms = get_option( 'um_core_forms', array() ); + $core_directories = get_option( 'um_core_directories', array() ); $setup_shortcodes = array_merge( array( 'profile' => '', 'login' => '', 'register' => '', + 'members' => '', ), - $core_forms + array_merge( $core_forms, $core_directories ) ); $this->predefined_pages = array( @@ -894,6 +896,10 @@ if ( ! class_exists( 'um\Config' ) ) { 'title' => __( 'Register', 'ultimate-member' ), 'content' => ! empty( $setup_shortcodes['register'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['register'] . '"]' : '', ), + 'members' => array( + 'title' => __( 'Members', 'ultimate-member' ), + 'content' => ! empty( $setup_shortcodes['members'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['members'] . '"]' : '', + ), 'logout' => array( 'title' => __( 'Logout', 'ultimate-member' ), 'content' => '', From 5673f1c4509f7f8335846d36d0aa2faf17eb8a64 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 14:35:16 +0200 Subject: [PATCH 52/76] - fixed displaying outdated templates admin notice between theme switching; --- includes/admin/class-admin.php | 14 +----------- includes/common/class-init.php | 13 +++++++++++ includes/common/class-screen.php | 2 +- includes/common/class-theme.php | 38 ++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 includes/common/class-theme.php diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 0abab767..6512115c 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -1904,19 +1904,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { * Manual check templates versions. */ public function check_templates_version() { - $templates = UM()->admin_settings()->get_override_templates( true ); - $out_date = false; - - foreach ( $templates as $template ) { - if ( 0 === $template['status_code'] ) { - $out_date = true; - break; - } - } - - if ( false === $out_date ) { - delete_option( 'um_override_templates_outdated' ); - } + UM()->common()->theme()->check_outdated_templates(); $url = add_query_arg( array( diff --git a/includes/common/class-init.php b/includes/common/class-init.php index aa777765..1e9e74cd 100644 --- a/includes/common/class-init.php +++ b/includes/common/class-init.php @@ -24,6 +24,7 @@ if ( ! class_exists( 'um\common\Init' ) ) { $this->screen(); $this->secure()->hooks(); $this->site_health(); + $this->theme()->hooks(); } /** @@ -73,5 +74,17 @@ if ( ! class_exists( 'um\common\Init' ) ) { } return UM()->classes['um\common\site_health']; } + + /** + * @since 2.8.3 + * + * @return Theme + */ + public function theme() { + if ( empty( UM()->classes['um\common\theme'] ) ) { + UM()->classes['um\common\theme'] = new Theme(); + } + return UM()->classes['um\common\theme']; + } } } diff --git a/includes/common/class-screen.php b/includes/common/class-screen.php index 494cdae8..e9328e74 100644 --- a/includes/common/class-screen.php +++ b/includes/common/class-screen.php @@ -18,7 +18,7 @@ if ( ! class_exists( 'um\common\Screen' ) ) { * Screen constructor. */ public function __construct() { - add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000, 1 ); + add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000 ); } /** diff --git a/includes/common/class-theme.php b/includes/common/class-theme.php new file mode 100644 index 00000000..c667646a --- /dev/null +++ b/includes/common/class-theme.php @@ -0,0 +1,38 @@ +admin_settings()->get_override_templates( true ); + $out_date = false; + + foreach ( $templates as $template ) { + if ( 0 === $template['status_code'] ) { + $out_date = true; + break; + } + } + + if ( false === $out_date ) { + delete_option( 'um_override_templates_outdated' ); + } + } +} From e44d2a16adea08b354c084281bb0ff6eab6a4b11 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 14:47:19 +0200 Subject: [PATCH 53/76] - fixed spelling; --- includes/admin/core/class-admin-settings.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 3965f7fe..8d4810a6 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1105,7 +1105,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'sections' => array( '' => array( 'title' => __( 'Pages', 'ultimate-member' ), - 'description' => __( 'This section allows you to assign a page to one of the core elements required for the plugin to function properly. The plugin automatically creates and configures required pages on installation.
    You only need to use this tab, if you accidentally deleted pages that were automatically created when the plugin was activated for the first time.', 'ultimate-member' ), + 'description' => __( 'This section enables you to assign a page to one of the core elements necessary for the plugin\'s proper function. The plugin automatically creates and configures the required pages upon installation.
    You only need to use this tab if you accidentally deleted pages that were automatically created during the initial plugin activation.', 'ultimate-member' ), 'fields' => $general_pages_fields, ), 'users' => array( @@ -1154,7 +1154,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'author_redirect', 'type' => 'checkbox', 'label' => __( 'Hide author pages', 'ultimate-member' ), - 'checkbox_label' => __( 'Enable automatically redirect author page to their profile', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable author page redirect to user profile', 'ultimate-member' ), 'description' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page.', 'ultimate-member' ), ), array( @@ -1202,7 +1202,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'type' => 'checkbox', 'label' => __( 'Delete user comments', 'ultimate-member' ), 'checkbox_label' => __( 'Enable deleting user comments after deleting a user', 'ultimate-member' ), - 'description' => __( 'Do you want to delete a user\'s comments when that user deletes themself or is removed from the admin dashboard from the site?', 'ultimate-member' ), + 'description' => __( 'Do you want to automatically delete a user\'s comments when they delete their account or are removed from the admin dashboard?', 'ultimate-member' ), ), ), ), @@ -1214,8 +1214,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'toggle_password', 'type' => 'checkbox', 'label' => __( 'Toggle Password Visibility', 'ultimate-member' ), - 'checkbox_label' => __( 'Enable password show/hide button', 'ultimate-member' ), - 'description' => __( 'Enable visibility for show/hide password button for the password field-type.', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable password show/hide icon on password field', 'ultimate-member' ), + 'description' => __( 'Enable users to view their inputted password before submitting the form.', 'ultimate-member' ), ), array( 'id' => 'require_strongpass', @@ -1244,14 +1244,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'activation_link_expiry_time', 'type' => 'number', 'label' => __( 'Email activation link expiration (days)', 'ultimate-member' ), - 'description' => __( 'For user registrations that require an email link to be clicked to confirm account. How long would you like the activation link to be active for before it expires? If this field is left blank the activation link will not expire.', 'ultimate-member' ), + 'description' => __( 'For user registrations requiring email confirmation via a link, how long should the activation link remain active before expiring? If this field is left blank, the activation link will not expire.', 'ultimate-member' ), 'size' => 'small', ), ), ), 'seo' => array( 'title' => __( 'SEO', 'ultimate-member' ), - 'description' => __( 'SEO settings for the User Profiles.', 'ultimate-member' ), + 'description' => __( 'SEO settings for the user profiles.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'profile_noindex', From c326ee9bce7c3938584df241f5becc06afcecb14 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 15:01:38 +0200 Subject: [PATCH 54/76] - fixed spelling; --- includes/admin/core/class-admin-settings.php | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 8d4810a6..a09b135e 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1302,23 +1302,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'account_name_disable', 'type' => 'checkbox', 'label' => __( 'Disable First & Last name field editing', 'ultimate-member' ), - 'checkbox_label' => __( 'Disabled First & Last name', 'ultimate-member' ), - 'description' => __( 'If enabled, this will prevent users from changing their First & Last name fields on the account page.', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable to prevent First & Last name editing by users', 'ultimate-member' ), + 'description' => __( 'If enabled, this feature will prevent users from changing their first and last names on the account page.', 'ultimate-member' ), 'conditional' => array( 'account_name', '=', '1' ), ), array( 'id' => 'account_name_require', 'type' => 'checkbox', 'label' => __( 'Require First & Last Name', 'ultimate-member' ), - 'checkbox_label' => __( 'Required First & Last Name', 'ultimate-member' ), - 'description' => __( 'If enabled, users will not be allowed to remove their first or last names when updating their account page.', 'ultimate-member' ), + 'checkbox_label' => __( 'First and last name fields are required', 'ultimate-member' ), + 'description' => __( 'If enabled, users will not be allowed to remove their first or last names when updating their account information.', 'ultimate-member' ), 'conditional' => array( 'account_name', '=', '1' ), ), array( 'id' => 'account_email', 'type' => 'checkbox', 'label' => __( 'Allow users to change email', 'ultimate-member' ), - 'checkbox_label' => __( 'Enable changing email via Account', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable changing email via the account page', 'ultimate-member' ), 'description' => __( 'If disabled, users will not be allowed to change their email address on the account page.', 'ultimate-member' ), ), array( @@ -1332,41 +1332,41 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), 'password_tab' => array( 'title' => __( 'Change password tab', 'ultimate-member' ), - 'description' => __( 'Allows you to enable/disable the password tab from the account page.', 'ultimate-member' ), + 'description' => __( 'Enables you to toggle the change password tab on the account page.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'account_tab_password', 'type' => 'checkbox', 'label' => __( 'Password Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display password change account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Password account tab in account page.', 'ultimate-member' ), + 'description' => __( 'Enable or disable the "Password" tab on the account page.', 'ultimate-member' ), ), ), ), 'privacy_tab' => array( 'title' => __( 'Privacy tab', 'ultimate-member' ), - 'description' => __( 'Allows you to enable/disable the privacy tab from the account page. You should disable this tab if you do not want users from being able to alter their privacy settings.', 'ultimate-member' ), + 'description' => __( 'Enables you to toggle the privacy tab on the account page. Disable this tab to prevent users from altering their privacy settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'account_tab_privacy', 'type' => 'checkbox', 'label' => __( 'Privacy Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display privacy account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Privacy account tab in account page.', 'ultimate-member' ), + 'description' => __( 'Enable or disable the "Privacy" tab on the account page.', 'ultimate-member' ), ), array( 'id' => 'account_hide_in_directory', 'type' => 'checkbox', 'label' => __( 'Allow users to hide their profiles from directory', 'ultimate-member' ), 'checkbox_label' => __( 'Enable users ability to alter their profile visibility in member directories', 'ultimate-member' ), - 'description' => __( 'Whether to allow users changing their profile visibility from member directory in account page.', 'ultimate-member' ), + 'description' => __( 'If enabled, this will allow users to change their profile visibility in the member directory from the account page.', 'ultimate-member' ), 'conditional' => array( 'account_tab_privacy', '=', '1' ), ), array( 'id' => 'account_hide_in_directory_default', 'type' => 'select', 'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ), - 'description' => __( 'Set default value for the "Hide my profile from directory" option.', 'ultimate-member' ), + 'description' => __( 'Set the default value for the "Hide my profile from directory" option.', 'ultimate-member' ), 'options' => array( 'No' => __( 'No', 'ultimate-member' ), 'Yes' => __( 'Yes', 'ultimate-member' ), @@ -1378,27 +1378,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), 'notifications_tab' => array( 'title' => __( 'Notifications tab', 'ultimate-member' ), - 'description' => __( 'Allows you to enable/disable the Notifications account tab on the account page.', 'ultimate-member' ), + 'description' => __( 'Enables you to toggle the notifications tab on the account page. Disable this tab to prevent users from altering their notifications settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'account_tab_notifications', 'type' => 'checkbox', 'label' => __( 'Notifications Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display notifications account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Notifications account tab in account page.', 'ultimate-member' ), + 'description' => __( 'Enable or disable the "Notifications" tab on the account page.', 'ultimate-member' ), ), ), ), 'delete_tab' => array( 'title' => __( 'Delete tab', 'ultimate-member' ), - 'description' => __( 'Allows you to enable/disable the delete account tab from the account page. You should disable this tab if you do not want users from being able to alter their delete their own accounts.', 'ultimate-member' ), + 'description' => __( 'Enables you to enable or disable the "Delete Account" tab on the account page. Disable this tab if you wish to prevent users from being able to delete their own accounts.', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'account_tab_delete', - 'type' => 'checkbox', - 'label' => __( 'Delete Account Tab', 'ultimate-member' ), + 'id' => 'account_tab_delete', + 'type' => 'checkbox', + 'label' => __( 'Delete Account Tab', 'ultimate-member' ), 'checkbox_label' => __( 'Display delete account tab', 'ultimate-member' ), - 'description' => __( 'Enable/disable the Delete account tab in account page.', 'ultimate-member' ), + 'description' => __( 'Enable/disable the Delete account tab in account page.', 'ultimate-member' ), ), array( 'id' => 'delete_account_text', From 53bde16d12e01900ede88f140ce5efa865d21168 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 15:09:04 +0200 Subject: [PATCH 55/76] - fixed the place for User Role setting; --- includes/admin/core/class-admin-settings.php | 26 ++++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index a09b135e..1a387bf4 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1115,6 +1115,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'Users', 'ultimate-member' ), 'description' => __( 'General users settings.', 'ultimate-member' ), 'fields' => array( + array( + 'id' => 'register_role', + 'type' => 'select', + 'label' => __( 'Registration Default Role', 'ultimate-member' ), + 'description' => __( 'This will be the role assigned to users registering through Ultimate Member registration forms. By default, this setting will follow the core WordPress setting "New User Default Role" unless you specify a different role.', 'ultimate-member' ), + 'default' => um_get_metadefault( 'register_role' ), + 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), + 'size' => 'small', + ), array( 'id' => 'permalink_base', 'type' => 'select', @@ -1429,7 +1438,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'form_sections' => array( 'uploads' => array( 'title' => __( 'Uploads', 'ultimate-member' ), - 'description' => __( 'Allows you to control options related to user uploads. This allows you to optimize the photos for your site.', 'ultimate-member' ), + 'description' => __( 'This page allows you to manage user upload options, enabling you to optimize photos for your site.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'image_orientation_by_exif', @@ -1896,21 +1905,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'registration_form' => array( 'title' => __( 'Registration Form', 'ultimate-member' ), 'form_sections' => array( - 'user_role' => array( - 'title' => __( 'User Role', 'ultimate-member' ), - 'description' => __( 'This section allows you to set default user role assigned after registration.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'register_role', - 'type' => 'select', - 'label' => __( 'Registration Default Role', 'ultimate-member' ), - 'description' => __( 'This will be the default role assigned to users registering thru registration form.', 'ultimate-member' ), - 'default' => um_get_metadefault( 'register_role' ), - 'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ), - 'size' => 'small', - ), - ), - ), 'template' => array( 'title' => __( 'Template', 'ultimate-member' ), 'description' => __( 'This section allows you to customize the user registration template and size.', 'ultimate-member' ), From 457c66791b8f37ff8cefd3a537f3edbfc7c239f1 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 15:23:03 +0200 Subject: [PATCH 56/76] - removed Secure admin notice; - changed Secure to Security; --- assets/js/admin/{secure.js => security.js} | 0 .../admin/{secure.min.js => security.min.js} | 0 includes/admin/class-enqueue.php | 4 +- includes/admin/class-secure.php | 9 +--- includes/admin/core/class-admin-notices.php | 42 ++----------------- includes/ajax/class-secure.php | 2 +- includes/class-config.php | 2 +- 7 files changed, 9 insertions(+), 50 deletions(-) rename assets/js/admin/{secure.js => security.js} (100%) rename assets/js/admin/{secure.min.js => security.min.js} (100%) diff --git a/assets/js/admin/secure.js b/assets/js/admin/security.js similarity index 100% rename from assets/js/admin/secure.js rename to assets/js/admin/security.js diff --git a/assets/js/admin/secure.min.js b/assets/js/admin/security.min.js similarity index 100% rename from assets/js/admin/secure.min.js rename to assets/js/admin/security.min.js diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index 01118a53..c92dda07 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -584,8 +584,8 @@ final class Enqueue extends \um\common\Enqueue { wp_enqueue_style( 'um_admin_roles' ); } elseif ( 'ultimate-member_page_um_options' === $hook ) { // phpcs:ignore WordPress.Security.NonceVerification - if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'secure' === $_GET['section'] ) { - wp_register_script( 'um_admin_secure', $js_url . 'admin/secure' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true ); + if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'security' === $_GET['section'] ) { + wp_register_script( 'um_admin_secure', $js_url . 'admin/security' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true ); wp_set_script_translations( 'um_admin_secure', 'ultimate-member' ); wp_enqueue_script( 'um_admin_secure' ); } diff --git a/includes/admin/class-secure.php b/includes/admin/class-secure.php index 2830bd85..6395a98a 100644 --- a/includes/admin/class-secure.php +++ b/includes/admin/class-secure.php @@ -90,11 +90,6 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { */ public function admin_init() { global $wpdb; - // Dismiss admin notice after the first visit to Secure settings page. - if ( isset( $_REQUEST['page'], $_REQUEST['tab'], $_REQUEST['section'] ) && 'um_options' === sanitize_key( $_REQUEST['page'] ) && 'advanced' === sanitize_key( $_REQUEST['tab'] ) && 'secure' === sanitize_key( $_REQUEST['section'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification - UM()->admin()->notices()->dismiss( 'secure_settings' ); - } - if ( isset( $_REQUEST['um_secure_expire_all_sessions'] ) && ! wp_doing_ajax() ) { if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'um-secure-expire-session-nonce' ) || ! current_user_can( 'manage_options' ) ) { // This nonce is not valid or current logged-in user has no administrative rights. @@ -300,8 +295,8 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { ) ); - $settings['advanced']['sections']['secure'] = array( - 'title' => __( 'Secure', 'ultimate-member' ), + $settings['advanced']['sections']['security'] = array( + 'title' => __( 'Security', 'ultimate-member' ), 'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ), 'fields' => $secure_fields, ); diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 9a251f81..86e51a7b 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -31,8 +31,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) ); add_action( 'admin_init', array( &$this, 'force_dismiss_notice' ) ); - - add_action( 'current_screen', array( &$this, 'create_list_for_screen' ) ); } /** @@ -82,13 +80,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { do_action( 'um_admin_create_notices' ); } - public function create_list_for_screen() { - if ( UM()->admin()->screen()->is_own_screen() ) { - $this->secure_settings(); - } - } - - /** * @return array */ @@ -838,39 +829,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } } - /** - * First time installed Secure settings. - */ - public function secure_settings() { - ob_start(); - ?> -

    -
    - -

    -

    - - -

    - add_notice( - 'secure_settings', - array( - 'class' => 'warning', - 'message' => $message, - 'dismissible' => true, - ), - 1 - ); - } - public function common_secure() { if ( UM()->options()->get( 'lock_register_forms' ) ) { ob_start(); ?>

    - Settings > Secure > Lock All Register Forms.', 'ultimate-member' ); ?> + Settings > Advanced > Security > Lock All Register Forms.', 'ultimate-member' ); ?>

    - Settings > Secure > Display Login form notice to reset passwords.', 'ultimate-member' ); ?> + Settings > Advanced > Security > Display Login form notice to reset passwords.', 'ultimate-member' ); ?>

    - Settings > Secure > Enable ban for administrative capabilities.', 'ultimate-member' ); ?> + Settings > Advanced > Security > Enable ban for administrative capabilities.', 'ultimate-member' ); ?>

    ' . esc_html__( 'Click here to lock them now.', 'ultimate-member' ) . ''; - $content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Secure > uncheck the option "Lock All Register Forms".', 'ultimate-member' ); + $content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Advanced > Security and uncheck the option "Lock All Register Forms".', 'ultimate-member' ); $content .= $br . $br; $suspicious_accounts_url = admin_url( 'users.php?um_status=inactive' ); diff --git a/includes/class-config.php b/includes/class-config.php index 6bbdf72b..aa8e1bf6 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -507,7 +507,7 @@ if ( ! class_exists( 'um\Config' ) ) { ), 'suspicious-activity' => array( 'key' => 'suspicious-activity', - 'title' => __( 'Secure: Suspicious Account Activity', 'ultimate-member' ), + 'title' => __( 'Security: Suspicious Account Activity', 'ultimate-member' ), 'subject' => __( '[{site_name}] Suspicious Account Activity', 'ultimate-member' ), 'body' => 'This is to inform you that there are suspicious activities with the following accounts: {user_profile_link}', 'description' => __( 'Whether to receive notification when suspicious account activity is detected.', 'ultimate-member' ), From f814faf239c7ce2e8523b9a89f715115038d2398 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 15:25:33 +0200 Subject: [PATCH 57/76] - fixed tooltip; --- includes/admin/templates/role/admin-permissions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/templates/role/admin-permissions.php b/includes/admin/templates/role/admin-permissions.php index 93113d19..524ca8b5 100644 --- a/includes/admin/templates/role/admin-permissions.php +++ b/includes/admin/templates/role/admin-permissions.php @@ -43,7 +43,7 @@ 'id' => '_um_can_delete_everyone', 'type' => 'checkbox', 'label' => __( 'Can delete other member accounts?', 'ultimate-member' ), - 'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ), + 'tooltip' => __( 'Allow this role to delete other user accounts.', 'ultimate-member' ), 'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0, ), array( @@ -58,4 +58,4 @@ ) ) ) )->render_form(); ?> - \ No newline at end of file + From 02e8f32a83be1bbfccf4e29900d06d07cc3043ee Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 15:26:49 +0200 Subject: [PATCH 58/76] - fixed field type label; --- includes/core/class-builtin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php index 32158e0c..d1391022 100644 --- a/includes/core/class-builtin.php +++ b/includes/core/class-builtin.php @@ -273,7 +273,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { ), 'tel' => array( - 'name' => __( 'Telephone Box', 'ultimate-member' ), + 'name' => __( 'Telephone', 'ultimate-member' ), 'col1' => array('_title','_metakey','_help','_default','_min_chars','_visibility'), 'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'), 'col3' => array('_required','_editable','_icon'), From ff0b90f29e259c527c43bcfc9d58d3777ff104cc Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 16:17:20 +0200 Subject: [PATCH 59/76] - fixed Install Info section; --- includes/admin/core/class-admin-settings.php | 65 +++++--------------- 1 file changed, 17 insertions(+), 48 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 1a387bf4..c5aa7005 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -51,9 +51,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //custom content for licenses tab add_filter( 'um_settings_section_licenses__custom_content', array( $this, 'settings_licenses_tab' ), 10, 3 ); - // @todo remove since 2.9.0 - add_filter( 'um_settings_section_install_info__custom_content', array( $this, 'settings_install_info' ) ); - //custom content for override templates tab add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); @@ -2232,13 +2229,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'install_info' => array( - 'title' => __( 'Install Info', 'ultimate-member' ), - 'fields' => array( - array( - 'type' => 'install_info', - ), - ), - ), // @todo remove since 2.9.0 + 'title' => __( 'System info', 'ultimate-member' ), + 'link' => add_query_arg( array( 'tab' => 'debug' ), admin_url( 'site-health.php' ) ), + ), ) ); @@ -2370,7 +2363,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { do_action( "um_settings_page_before_{$current_tab}_{$current_subtab}_content" ); $form_wrapper = true; - if ( in_array( $current_tab, array( 'licenses', 'install_info' ), true ) ) { + if ( 'licenses' === $current_tab ) { $form_wrapper = false; } if ( 'advanced' === $current_tab && 'override_templates' === $current_subtab ) { @@ -2441,19 +2434,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) || ! empty( $tab['form_sections'] ) ) { $menu_tabs[ $slug ] = $tab['title']; + } elseif ( ! empty( $tab['link'] ) ) { + $menu_tabs[ $slug ] = $tab['title']; } } $current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] ); foreach ( $menu_tabs as $name => $label ) { - $active = $current_tab === $name ? 'nav-tab-active' : ''; - - $args = array( 'page' => 'um_options' ); - if ( ! empty( $name ) ) { - $args['tab'] = $name; + if ( ! empty( $this->settings_structure[ $name ]['link'] ) ) { + $active = ''; + $tab_url = $this->settings_structure[ $name ]['link']; + } else { + $active = $current_tab === $name ? 'nav-tab-active' : ''; + $args = array( 'page' => 'um_options' ); + if ( ! empty( $name ) ) { + $args['tab'] = $name; + } + $tab_url = add_query_arg( $args, admin_url( 'admin.php' ) ); } - $tab_url = add_query_arg( $args, admin_url( 'admin.php' ) ); - $tabs .= '' . esc_html( $label ) . ''; + $tabs .= '' . esc_html( $label ) . ''; } break; @@ -3404,36 +3403,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $content; } - /** - * HTML for Settings > Install Info tab. - * - * @todo remove since 2.9.0 - * - * @return string - */ - public function settings_install_info() { - ob_start(); - ?> -

    -

    - Info. - echo wp_kses( sprintf( __( 'This settings tab is deprecated. And it will be fully removed since 2.9.0 version. Please get the installation info from there.', 'ultimate-member' ), add_query_arg( 'tab', 'debug', admin_url( 'site-health.php' ) ) ), UM()->get_allowed_html( 'admin_notice' ) ); - ?> -

    -

    - here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1879-ultimate-member-site-health' ), UM()->get_allowed_html( 'admin_notice' ) ); - ?> -

    - - Date: Wed, 14 Feb 2024 16:41:41 +0200 Subject: [PATCH 60/76] - added Advanced > Developers section in Settings; --- includes/admin/class-secure.php | 14 ++-- includes/admin/core/class-admin-settings.php | 67 ++++++++++++-------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/includes/admin/class-secure.php b/includes/admin/class-secure.php index 6395a98a..be3980c1 100644 --- a/includes/admin/class-secure.php +++ b/includes/admin/class-secure.php @@ -295,10 +295,16 @@ if ( ! class_exists( 'um\admin\Secure' ) ) { ) ); - $settings['advanced']['sections']['security'] = array( - 'title' => __( 'Security', 'ultimate-member' ), - 'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ), - 'fields' => $secure_fields, + $settings['advanced']['sections'] = UM()->array_insert_before( + $settings['advanced']['sections'], + 'developers', + array( + 'security' => array( + 'title' => __( 'Security', 'ultimate-member' ), + 'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ), + 'fields' => $secure_fields, + ), + ) ); return $settings; diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index c5aa7005..d1c17966 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1562,28 +1562,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'Allows to manage blocked data of signed up user.', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'blocked_emails', - 'type' => 'textarea', - 'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ), + 'id' => 'blocked_emails', + 'type' => 'textarea', + 'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ), 'description' => __( '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 (Enter one word per line)', 'ultimate-member' ), - 'description' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username.', 'ultimate-member' ), - ), - ), - ), - 'fields' => array( - 'title' => __( 'Fields', 'ultimate-member' ), - 'description' => __( 'Allows to manage fields settings.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'allowed_choice_callbacks', + 'id' => 'blocked_words', 'type' => 'textarea', - 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), - 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), + 'label' => __( 'Blacklist Words (Enter one word per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username.', 'ultimate-member' ), ), ), ), @@ -2130,16 +2118,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'checkbox_label' => __( 'Disable user data cache', 'ultimate-member' ), 'description' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ), ), - array( - 'id' => 'rest_api_version', - 'type' => 'select', - 'label' => __( 'REST API version', 'ultimate-member' ), - 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), - 'options' => array( - '1.0' => __( '1.0 version', 'ultimate-member' ), - '2.0' => __( '2.0 version', 'ultimate-member' ), - ), - ), array( 'id' => 'uninstall_on_delete', 'type' => 'checkbox', @@ -2226,6 +2204,39 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), + 'developers' => array( + 'title' => __( 'Developers', 'ultimate-member' ), + 'form_sections' => array( + 'fields' => array( + 'title' => __( 'Fields', 'ultimate-member' ), + 'description' => __( 'Allows to manage fields settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allowed_choice_callbacks', + 'type' => 'textarea', + 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), + ), + ), + ), + 'rest_api' => array( + 'title' => __( 'REST API', 'ultimate-member' ), + 'description' => '', + 'fields' => array( + array( + 'id' => 'rest_api_version', + 'type' => 'select', + 'label' => __( 'Version', 'ultimate-member' ), + 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), + 'options' => array( + '1.0' => __( '1.0 version', 'ultimate-member' ), + '2.0' => __( '2.0 version', 'ultimate-member' ), + ), + ), + ), + ), + ), + ), ), ), 'install_info' => array( From cb9818e41cb0b7cc9ae0966bcdda9912acb6033e Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 17:12:35 +0200 Subject: [PATCH 61/76] - fixed sorting by user registered date when custom meta table is enabled; --- includes/core/class-member-directory-meta.php | 2 +- includes/core/class-member-directory.php | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/includes/core/class-member-directory-meta.php b/includes/core/class-member-directory-meta.php index af7ec747..7cbccb40 100644 --- a/includes/core/class-member-directory-meta.php +++ b/includes/core/class-member-directory-meta.php @@ -900,7 +900,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { $order = esc_sql( $order ); $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; $this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} "; - } elseif ( in_array( $sortby, $this->core_search_fields, true ) ) { + } elseif ( in_array( $sortby, $this->core_users_fields, true ) ) { $sortby = esc_sql( $sortby ); $order = esc_sql( $order ); $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC'; diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 26a06e6e..8deccf7f 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -58,7 +58,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { var $filter_types = array(); - + /** + * Fields used for searching from wp_users table. + * + * @var string[] + */ var $core_search_fields = array( 'user_login', 'user_url', @@ -67,6 +71,19 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { 'user_nicename', ); + /** + * Fields used for sorting from wp_users table. + * + * @var string[] + */ + var $core_users_fields = array( + 'user_login', + 'user_url', + 'display_name', + 'user_email', + 'user_nicename', + 'user_registered', + ); /** * @var From db7605239c2c278111642a9649094ff03c573df6 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 17:26:25 +0200 Subject: [PATCH 62/76] - updated changelog; --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 0676b7d6..60d0c948 100644 --- a/readme.txt +++ b/readme.txt @@ -166,7 +166,7 @@ No specific extensions are needed. But we highly recommended keep active these P IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION -= 2.8.3: February 12, 2024 = += 2.8.3: February 21, 2024 = * Enhancements: From 7f4d000ed2a2134e664587ac69486ce48c6fa14a Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 15 Feb 2024 12:48:09 +0200 Subject: [PATCH 63/76] - fixed spelling; --- includes/admin/core/class-admin-settings.php | 43 ++++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index d1c17966..258ec072 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2205,34 +2205,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), 'developers' => array( - 'title' => __( 'Developers', 'ultimate-member' ), - 'form_sections' => array( - 'fields' => array( - 'title' => __( 'Fields', 'ultimate-member' ), - 'description' => __( 'Allows to manage fields settings.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'allowed_choice_callbacks', - 'type' => 'textarea', - 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), - 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), - ), - ), + 'title' => __( 'Developers', 'ultimate-member' ), + 'description' => __( 'This section allows you to manage settings that will be more developer-friendly. If you are not a developer, edit these settings at your own risk.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allowed_choice_callbacks', + 'type' => 'textarea', + 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), ), - 'rest_api' => array( - 'title' => __( 'REST API', 'ultimate-member' ), - 'description' => '', - 'fields' => array( - array( - 'id' => 'rest_api_version', - 'type' => 'select', - 'label' => __( 'Version', 'ultimate-member' ), - 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), - 'options' => array( - '1.0' => __( '1.0 version', 'ultimate-member' ), - '2.0' => __( '2.0 version', 'ultimate-member' ), - ), - ), + array( + 'id' => 'rest_api_version', + 'type' => 'select', + 'label' => __( 'Version', 'ultimate-member' ), + 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), + 'options' => array( + '1.0' => __( '1.0 version', 'ultimate-member' ), + '2.0' => __( '2.0 version', 'ultimate-member' ), ), ), ), From 87428f97386ae44f3b8a8dbb59b22ef7e2f6a76f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 15 Feb 2024 12:52:47 +0200 Subject: [PATCH 64/76] - changed settings; --- includes/admin/core/class-admin-settings.php | 61 +++++++++++--------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 258ec072..f2cd32aa 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1575,19 +1575,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), - 'redirect' => array( - 'title' => __( 'Redirect', 'ultimate-member' ), - 'description' => __( 'Allows to manage redirect settings.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'allow_url_redirect_confirm', - 'type' => 'checkbox', - 'label' => __( 'Allow external link redirect confirm', 'ultimate-member' ), - 'checkbox_label' => __( 'Enable JS.confirm for external links', 'ultimate-member' ), - 'description' => __( 'Using JS.confirm alert when you go to an external link.', 'ultimate-member' ), - ), - ), - ), ), ), ), @@ -2206,22 +2193,40 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), 'developers' => array( 'title' => __( 'Developers', 'ultimate-member' ), - 'description' => __( 'This section allows you to manage settings that will be more developer-friendly. If you are not a developer, edit these settings at your own risk.', 'ultimate-member' ), - 'fields' => array( - array( - 'id' => 'allowed_choice_callbacks', - 'type' => 'textarea', - 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), - 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), + 'form_sections' => array( + 'developers' => array( + 'title' => __( 'Developers', 'ultimate-member' ), + 'description' => __( 'This section allows you to manage settings that will be more developer-friendly. If you are not a developer, edit these settings at your own risk.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allowed_choice_callbacks', + 'type' => 'textarea', + 'label' => __( 'Allowed Choice Callbacks (Enter one PHP function per line)', 'ultimate-member' ), + 'description' => __( 'This option lets you specify the choice callback functions to prevent anyone from using 3rd-party functions that may put your site at risk.', 'ultimate-member' ), + ), + array( + 'id' => 'rest_api_version', + 'type' => 'select', + 'label' => __( 'Version', 'ultimate-member' ), + 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), + 'options' => array( + '1.0' => __( '1.0 version', 'ultimate-member' ), + '2.0' => __( '2.0 version', 'ultimate-member' ), + ), + ), + ), ), - array( - 'id' => 'rest_api_version', - 'type' => 'select', - 'label' => __( 'Version', 'ultimate-member' ), - 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), - 'options' => array( - '1.0' => __( '1.0 version', 'ultimate-member' ), - '2.0' => __( '2.0 version', 'ultimate-member' ), + 'redirect' => array( + 'title' => __( 'Redirect', 'ultimate-member' ), + 'description' => __( 'Allows to manage redirect settings.', 'ultimate-member' ), + 'fields' => array( + array( + 'id' => 'allow_url_redirect_confirm', + 'type' => 'checkbox', + 'label' => __( 'Allow external link redirect confirm', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable JS.confirm for external links', 'ultimate-member' ), + 'description' => __( 'Using JS.confirm alert when you go to an external link.', 'ultimate-member' ), + ), ), ), ), From 6f8c6eb1afff054f694479fb0efb8908d9be1e7c Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 15 Feb 2024 13:30:45 +0200 Subject: [PATCH 65/76] - added site health test; --- includes/admin/class-site-health.php | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/includes/admin/class-site-health.php b/includes/admin/class-site-health.php index 58d9dd9f..c8caf3dc 100644 --- a/includes/admin/class-site-health.php +++ b/includes/admin/class-site-health.php @@ -12,11 +12,67 @@ if ( ! defined( 'ABSPATH' ) ) { */ class Site_Health { + /** + * String of a badge color. + * Options: blue, green, red, orange, purple and gray. + * + * @see https://make.wordpress.org/core/2019/04/25/site-health-check-in-5-2/ + * + * @since 2.8.3 + */ + const BADGE_COLOR = 'blue'; + /** * Site_Health constructor. */ public function __construct() { add_filter( 'debug_information', array( $this, 'debug_information' ), 20 ); + add_filter( 'site_status_tests', array( $this, 'register_site_status_tests' ) ); + } + + public function register_site_status_tests( $tests ) { + $tests['direct']['um_override_templates'] = array( + 'label' => esc_html__( 'Are the Ultimate Member templates out of date?', 'ultimate-member' ), + 'test' => array( $this, 'override_templates_test' ), + ); + + return $tests; + } + + public function override_templates_test() { + $result = array( + 'label' => __( 'You have the most recent version of custom Ultimate Member templates', 'ultimate-member' ), + 'status' => 'good', + 'badge' => array( + 'label' => UM_PLUGIN_NAME, + 'color' => self::BADGE_COLOR, + ), + 'description' => sprintf( + '

    %s

    ', + __( 'Your custom Ultimate Member templates that are situated in the theme have the most recent version and are ready to use.', 'ultimate-member' ) + ), + 'actions' => '', + 'test' => 'um_override_templates', + ); + + UM()->common()->theme()->check_outdated_templates(); + + if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) { + $result['label'] = __( 'Your custom templates are out of date', 'ultimate-member' ); + $result['status'] = 'critical'; + $result['badge']['color'] = 'red'; + $result['description'] = sprintf( + '

    %s

    ', + __( 'Your custom Ultimate Member templates that are situated in the theme are out of date and may break the website\'s functionality.', 'ultimate-member' ) + ); + $result['actions'] = sprintf( + '

    %s

    ', + admin_url( 'admin.php?page=um_options&tab=advanced§ion=override_templates' ), + esc_html__( 'Check status and update', 'ultimate-member' ) + ); + } + + return $result; } private function get_roles() { From 555c56211fcb5389f75e28560f2c481d85808027 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 00:34:16 +0200 Subject: [PATCH 66/76] - override templates changed transients and logic for using together with Site Health tests; --- includes/admin/class-admin.php | 2 +- includes/admin/class-site-health.php | 16 +- includes/admin/core/class-admin-notices.php | 32 --- includes/admin/core/class-admin-settings.php | 212 ++--------------- .../version-template-list-table.php | 3 +- includes/common/class-theme.php | 222 +++++++++++++++++- 6 files changed, 239 insertions(+), 248 deletions(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 6512115c..88ebb2a1 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -1904,7 +1904,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { * Manual check templates versions. */ public function check_templates_version() { - UM()->common()->theme()->check_outdated_templates(); + UM()->common()->theme()->flush_transient_templates_data(); $url = add_query_arg( array( diff --git a/includes/admin/class-site-health.php b/includes/admin/class-site-health.php index c8caf3dc..77501694 100644 --- a/includes/admin/class-site-health.php +++ b/includes/admin/class-site-health.php @@ -31,10 +31,14 @@ class Site_Health { } public function register_site_status_tests( $tests ) { - $tests['direct']['um_override_templates'] = array( - 'label' => esc_html__( 'Are the Ultimate Member templates out of date?', 'ultimate-member' ), - 'test' => array( $this, 'override_templates_test' ), - ); + $custom_templates = UM()->common()->theme()->get_custom_templates_list(); + + if ( ! empty( $custom_templates ) ) { + $tests['direct']['um_override_templates'] = array( + 'label' => esc_html__( 'Are the Ultimate Member templates out of date?', 'ultimate-member' ), + 'test' => array( $this, 'override_templates_test' ), + ); + } return $tests; } @@ -55,9 +59,7 @@ class Site_Health { 'test' => 'um_override_templates', ); - UM()->common()->theme()->check_outdated_templates(); - - if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) { + if ( UM()->common()->theme()->is_outdated_template_exist() ) { $result['label'] = __( 'Your custom templates are out of date', 'ultimate-member' ); $result['status'] = 'critical'; $result['badge']['color'] = 'red'; diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 86e51a7b..e1c0a483 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -49,8 +49,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $this->extensions_page(); - $this->template_version(); - $this->child_theme_required(); // Removed for now to avoid the bad reviews. @@ -766,36 +764,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { ), 2 ); } - /** - * Check Templates Versions notice - */ - public function template_version() { - if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) { - $link = admin_url( 'admin.php?page=um_options&tab=advanced§ion=override_templates' ); - ob_start(); - ?> - -

    - override templates status page and update templates.', 'ultimate-member' ), $link ), UM()->get_allowed_html( 'admin_notice' ) ); - ?> -

    - - admin()->notices()->add_notice( - 'um_override_templates_notice', - array( - 'class' => 'error', - 'message' => $message, - 'dismissible' => false, - ), - 10 - ); - } - } - /** * Check if there isn't installed child-theme. Child theme is required for safely saved customizations. */ diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index f2cd32aa..6d6c555d 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -51,9 +51,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { //custom content for licenses tab add_filter( 'um_settings_section_licenses__custom_content', array( $this, 'settings_licenses_tab' ), 10, 3 ); - //custom content for override templates tab - add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); - add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 ); //save handlers @@ -2244,6 +2241,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { unset( $this->settings_structure['']['sections']['account']['form_sections']['notifications_tab'] ); } + // Hide sub tab if there aren't custom templates in theme. + $custom_templates = UM()->common()->theme()->get_custom_templates_list(); + if ( empty( $custom_templates ) ) { + unset( $this->settings_structure['advanced']['sections']['override_templates'] ); + } + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE ) { } else { @@ -3355,27 +3358,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return ob_get_clean(); } - /** - * Periodically checking the versions of templates. - * - * @since 2.6.1 - * - * @return void - */ - public function um_check_template_version() { - $um_check_version = get_transient( 'um_check_template_versions' ); - if ( false === $um_check_version ) { - $this->get_override_templates(); - } - } - /** * HTML for Settings > Advanced > Override Templates tab. * * @return string */ - public function settings_override_templates_tab( $content ) { - $um_check_version = get_transient( 'um_check_template_versions' ); + public function settings_override_templates_tab() { + $um_check_version = time(); + $custom_templates = get_transient( 'um_custom_templates_list' ); + if ( false !== $custom_templates && array_key_exists( 'time', $custom_templates ) ) { + $um_check_version = $custom_templates['time']; + } $check_url = add_query_arg( array( @@ -3383,148 +3376,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { '_wpnonce' => wp_create_nonce( 'check_templates_version' ), ) ); + ob_start(); ?> -

    - $files ) { - foreach ( $files as $file ) { - if ( false === strpos( $file, 'email/' ) ) { - $located = array(); - /** - * Filters an array of the template files for scanning versions based on $key. - * - * Note: $key - means um or extension key. - * - * @since 2.6.1 - * @hook um_override_templates_get_template_path__{$key} - * - * @param {array} $located Template file paths for scanning versions. - * @param {string} $file Template file name. - * - * @return {array} Template file paths for scanning versions. - */ - $located = apply_filters( "um_override_templates_get_template_path__{$key}", $located, $file ); - - $exceptions = array( - 'members-grid.php', - 'members-header.php', - 'members-list.php', - 'members-pagination.php', - 'searchform.php', - 'login-to-view.php', - 'profile/comments.php', - 'profile/comments-single.php', - 'profile/posts.php', - 'profile/posts-single.php', - 'modal/um_upload_single.php', - 'modal/um_view_photo.php', - ); - - if ( ! empty( $located ) ) { - $theme_file = $located['theme']; - } elseif ( in_array( $file, $exceptions, true ) && file_exists( get_stylesheet_directory() . '/ultimate-member/' . $file ) ) { - $theme_file = get_stylesheet_directory() . '/ultimate-member/' . $file; - } elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { - $theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file; - } else { - $theme_file = false; - } - - if ( ! empty( $theme_file ) ) { - $core_file = $file; - - if ( ! empty( $located ) ) { - $core_path = $located['core']; - $core_file_path = stristr( $core_path, 'wp-content' ); - } else { - $core_path = UM_PATH . '/templates/' . $core_file; - $core_file_path = stristr( UM_PATH . 'templates/' . $core_file, 'wp-content' ); - } - $core_version = self::get_file_version( $core_path ); - $theme_version = self::get_file_version( $theme_file ); - - $status = esc_html__( 'Theme version up to date', 'ultimate-member' ); - $status_code = 1; - if ( version_compare( $theme_version, $core_version, '<' ) ) { - $status = esc_html__( 'Theme version is out of date', 'ultimate-member' ); - $status_code = 0; - } - if ( '' === $theme_version ) { - $status = esc_html__( 'Theme version is empty', 'ultimate-member' ); - $status_code = 0; - } - if ( 0 === $status_code ) { - $out_date = true; - update_option( 'um_override_templates_outdated', true ); - } - $outdated_files[] = array( - 'core_version' => $core_version, - 'theme_version' => $theme_version, - 'core_file' => $core_file_path, - 'theme_file' => stristr( $theme_file, 'wp-content' ), - 'status' => $status, - 'status_code' => $status_code, - ); - } - } - } - } - - if ( false === $out_date ) { - delete_option( 'um_override_templates_outdated' ); - } - update_option( 'um_template_statuses', $outdated_files ); - if ( true === $get_list ) { - return $outdated_files; - } - } - - /** * Scan the template files. * @@ -3532,58 +3401,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { * @return array */ public static function scan_template_files( $template_path ) { - $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. - $result = array(); - - if ( ! empty( $files ) ) { - - foreach ( $files as $value ) { - - if ( ! in_array( $value, array( '.', '..' ), true ) ) { - - if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { - $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); - foreach ( $sub_files as $sub_file ) { - $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; - } - } else { - $result[] = $value; - } - } - } - } - return $result; - } - - /** - * @param $file string - * - * @return string - */ - public static function get_file_version( $file ) { - // Avoid notices if file does not exist. - if ( ! file_exists( $file ) ) { - return ''; - } - - // We don't need to write to the file, so just open for reading. - $fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine. - - // Pull only the first 8kiB of the file in. - $file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine. - - // PHP will close a file handle, but we are good citizens. - fclose( $fp ); // @codingStandardsIgnoreLine. - - // Make sure we catch CR-only line endings. - $file_data = str_replace( "\r", "\n", $file_data ); - $version = ''; - - if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { - $version = _cleanup_header_comment( $match[1] ); - } - - return $version; + return UM()->common()->theme()::scan_template_files( $template_path ); } /** diff --git a/includes/admin/core/list-tables/version-template-list-table.php b/includes/admin/core/list-tables/version-template-list-table.php index bf1360fe..f116b0c8 100644 --- a/includes/admin/core/list-tables/version-template-list-table.php +++ b/includes/admin/core/list-tables/version-template-list-table.php @@ -58,8 +58,7 @@ class UM_Versions_List_Table extends WP_List_Table { $sortable = $this->get_sortable_columns(); $this->_column_headers = array( $columns, array(), $sortable ); - $templates = get_option( 'um_template_statuses', array() ); - $templates = is_array( $templates ) ? $templates : array(); + $templates = UM()->common()->theme()->build_templates_data(); @uasort( $templates, diff --git a/includes/common/class-theme.php b/includes/common/class-theme.php index c667646a..896627ef 100644 --- a/includes/common/class-theme.php +++ b/includes/common/class-theme.php @@ -13,26 +13,230 @@ if ( ! defined( 'ABSPATH' ) ) { class Theme { public function hooks() { - add_action( 'after_switch_theme', array( &$this, 'check_outdated_templates' ) ); + add_action( 'after_switch_theme', array( &$this, 'flush_transient_templates_data' ) ); } /** * Find outdated UM templates and notify Administrator. * */ - public function check_outdated_templates() { - $templates = UM()->admin_settings()->get_override_templates( true ); - $out_date = false; + public function flush_transient_templates_data() { + // Flush transient with the custom templates list. + delete_transient( 'um_custom_templates_list' ); + } - foreach ( $templates as $template ) { - if ( 0 === $template['status_code'] ) { - $out_date = true; + /** + * Scan the template files. + * + * @param string $template_path Path to the template directory. + * @return array + */ + public static function scan_template_files( $template_path ) { + $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. + $result = array(); + + if ( ! empty( $files ) ) { + + foreach ( $files as $value ) { + + if ( ! in_array( $value, array( '.', '..' ), true ) ) { + + if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { + $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); + foreach ( $sub_files as $sub_file ) { + $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; + } + } else { + $result[] = $value; + } + } + } + } + return $result; + } + + public static function get_all_templates() { + $scan_files['um'] = self::scan_template_files( UM_PATH . '/templates/' ); + /** + * Filters an array of the template files for scanning versions. + * + * @since 2.6.1 + * @hook um_override_templates_scan_files + * + * @param {array} $scan_files Template files for scanning versions. + * + * @return {array} Template files for scanning versions. + */ + return apply_filters( 'um_override_templates_scan_files', $scan_files ); + } + + /** + * @param $file string + * + * @return string + */ + public static function get_file_version( $file ) { + // Avoid notices if file does not exist. + if ( ! file_exists( $file ) ) { + return ''; + } + + // We don't need to write to the file, so just open for reading. + $fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine. + + // Pull only the first 8kiB of the file in. + $file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine. + + // PHP will close a file handle, but we are good citizens. + fclose( $fp ); // @codingStandardsIgnoreLine. + + // Make sure we catch CR-only line endings. + $file_data = str_replace( "\r", "\n", $file_data ); + $version = ''; + + if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { + $version = _cleanup_header_comment( $match[1] ); + } + + return $version; + } + + public function get_custom_templates_list() { + $files_in_theme = array(); + $scan_files = self::get_all_templates(); + foreach ( $scan_files as $key => $files ) { + foreach ( $files as $file ) { + if ( false === strpos( $file, 'email/' ) ) { + /** + * Filters an array of the template files for scanning versions based on $key. + * + * Note: $key - means um or extension key. + * + * @since 2.6.1 + * @hook um_override_templates_get_template_path__{$key} + * + * @param {array} $located Template file paths for scanning versions. + * @param {string} $file Template file name. + * + * @return {array} Template file paths for scanning versions. + */ + $located = apply_filters( "um_override_templates_get_template_path__{$key}", array(), $file ); + + $exceptions = array( + 'members-grid.php', + 'members-header.php', + 'members-list.php', + 'members-pagination.php', + 'searchform.php', + 'login-to-view.php', + 'profile/comments.php', + 'profile/comments-single.php', + 'profile/posts.php', + 'profile/posts-single.php', + 'modal/um_upload_single.php', + 'modal/um_view_photo.php', + ); + + $theme_file = false; + if ( ! empty( $located ) ) { + $theme_file = $located['theme']; + } elseif ( in_array( $file, $exceptions, true ) && file_exists( get_stylesheet_directory() . '/ultimate-member/' . $file ) ) { + $theme_file = get_stylesheet_directory() . '/ultimate-member/' . $file; + } elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { + $theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file; + } + + if ( ! empty( $theme_file ) ) { + if ( ! empty( $located ) ) { + $core_path = $located['core']; + } else { + $core_path = UM_PATH . 'templates/' . $file; + } + + $files_in_theme[] = array( + 'core' => $core_path, + 'theme' => $theme_file, + ); + } + } + } + } + + return $files_in_theme; + } + + public function is_outdated_template_exist() { + $outdated_exists = false; + $templates = $this->get_custom_templates_list(); + foreach ( $templates as $files ) { + if ( ! array_key_exists( 'core', $files ) || ! array_key_exists( 'theme', $files ) ) { + continue; + } + + $core_path = $files['core']; + $theme_file = $files['theme']; + + $core_version = self::get_file_version( $core_path ); + $theme_version = self::get_file_version( $theme_file ); + + if ( '' === $theme_version || version_compare( $theme_version, $core_version, '<' ) ) { + $outdated_exists = true; break; } } - if ( false === $out_date ) { - delete_option( 'um_override_templates_outdated' ); + return $outdated_exists; + } + + public function build_templates_data() { + $templates_data = array(); + + // Get from cache if isn't empty and request isn't force. + $transient = get_transient( 'um_custom_templates_list' ); + if ( false !== $transient && array_key_exists( 'data', $transient ) ) { + return $transient['data']; } + + $templates = $this->get_custom_templates_list(); + foreach ( $templates as $files ) { + if ( ! array_key_exists( 'core', $files ) || ! array_key_exists( 'theme', $files ) ) { + continue; + } + + $core_path = $files['core']; + $theme_file = $files['theme']; + + $core_version = self::get_file_version( $core_path ); + $theme_version = self::get_file_version( $theme_file ); + + $status = esc_html__( 'Theme version up to date', 'ultimate-member' ); + $status_code = 1; + + if ( '' === $theme_version ) { + $status = esc_html__( 'Theme version is empty', 'ultimate-member' ); + $status_code = 0; + } elseif ( version_compare( $theme_version, $core_version, '<' ) ) { + $status = esc_html__( 'Theme version is out of date', 'ultimate-member' ); + $status_code = 0; + } + + $templates_data[] = array( + 'core_version' => $core_version, + 'theme_version' => $theme_version, + 'core_file' => stristr( $core_path, 'wp-content' ), + 'theme_file' => stristr( $theme_file, 'wp-content' ), + 'status' => $status, + 'status_code' => $status_code, + ); + } + + // Cache results via transient setting. + $transient = array( + 'data' => $templates_data, + 'time' => time(), + ); + set_transient( 'um_custom_templates_list', $transient, 5 * MINUTE_IN_SECONDS ); + + return $templates_data; } } From e1f550afb549fcea6500075e832cf254ccbfd18c Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 15:12:21 +0200 Subject: [PATCH 67/76] - changed "e-mail" to "email"; - changed texts for admin notices; - added a few links to docs; --- assets/css/admin/forms.css | 7 +++++++ assets/css/admin/forms.min.css | 2 +- assets/css/admin/forms.sass | 8 ++++++++ assets/css/admin/roles.css | 5 +++++ assets/css/admin/roles.min.css | 2 +- assets/css/admin/roles.sass | 7 +++++++ includes/admin/class-site-health.php | 10 +++++----- includes/admin/core/class-admin-forms.php | 19 +++++++++++++++++++ includes/admin/core/class-admin-notices.php | 2 +- includes/admin/core/class-admin-settings.php | 12 ++++++------ includes/admin/core/class-admin-users.php | 4 ++-- includes/admin/templates/dashboard/users.php | 2 +- includes/admin/templates/role/publish.php | 18 ++++++++++++++---- includes/admin/templates/role/register.php | 4 ++-- includes/class-config.php | 10 +++++----- includes/core/class-builtin.php | 20 ++++++++++---------- includes/core/class-member-directory.php | 2 +- includes/core/class-permalinks.php | 2 +- includes/core/class-user.php | 10 +++++----- includes/core/um-actions-account.php | 6 +++--- includes/core/um-actions-misc.php | 2 +- includes/core/um-filters-login.php | 2 +- includes/core/um-filters-user.php | 2 +- includes/um-short-functions.php | 4 ++-- templates/email/approved_email.php | 2 +- templates/email/checkmail_email.php | 2 +- 26 files changed, 111 insertions(+), 55 deletions(-) diff --git a/assets/css/admin/forms.css b/assets/css/admin/forms.css index 8ffe133b..f56b0922 100644 --- a/assets/css/admin/forms.css +++ b/assets/css/admin/forms.css @@ -65,6 +65,13 @@ display: block; margin: 0 0 5px 0; } +.um-external-link-icon { + width: 1em; + height: 1em; + margin: 0; + vertical-align: middle; + fill: currentcolor; } + .um_admin_fonticon_wrapper { display: flex; flex-direction: row; diff --git a/assets/css/admin/forms.min.css b/assets/css/admin/forms.min.css index 4bde8a55..38a45e6c 100644 --- a/assets/css/admin/forms.min.css +++ b/assets/css/admin/forms.min.css @@ -1 +1 @@ -.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2>select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file +.um-form-table .um-forms-line[data-conditional]{display:none}.um-form-table .um-forms-line label .um-req{color:#a00;margin:0 0 0 3px;font-weight:400}.um-form-table .um-forms-line .um-text-delete{color:#a00;float:left}.um-form-table .um-forms-line .um-text-delete:hover{color:red}.um-form-table .um-forms-line .um-multi-text-add-option{margin-bottom:14px}.um-form-table .um-forms-line .icon_preview{display:none;max-width:200px;max-height:200px;padding:5px;cursor:pointer;border:1px solid #e3e3e3;background:#f7f7f7;border-radius:3px;height:auto;width:auto!important}.um-form-table .um-forms-line td .um-same-page-update-wrapper{display:none;margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update{margin:7px 0 0 0}.um-form-table .um-forms-line td .um-same-page-update-wrapper .upgrade_log{margin:7px 0 0 0;width:100%;height:150px;overflow:auto;border:1px solid #a1a1a1}.um-form-table .um-forms-line[data-field_type=same_page_update]{vertical-align:baseline}.um-form-table .um-forms-line[data-field_type=same_page_update] td,.um-form-table .um-forms-line[data-field_type=same_page_update] th{vertical-align:baseline}.um-form-table.um-third-column .um-forms-line th{width:33%}.um-form-table.um-half-column .um-forms-line th{width:50%}.um-form-table.um-two-thirds-column .um-forms-line th{width:83%}.um-form-table.um-top-label .um-forms-line td{padding:0 0 15px 0}.um-form-table.um-top-label .um-forms-line td label{margin:0 0 5px 0;display:inline-block}.um-form-table.um-top-label .um-forms-line[data-field_type=icon] td label{width:100%;display:block;margin:0 0 5px 0}.um-external-link-icon{width:1em;height:1em;margin:0;vertical-align:middle;fill:currentcolor}.um_admin_fonticon_wrapper{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um_admin_fonticon_wrapper .um-admin-icon-value{line-height:1}.um_admin_fonticon_wrapper .um-admin-icon-value i{top:0}input[type=date].um-forms-field,input[type=number].um-forms-field,input[type=password].um-forms-field,input[type=text].um-forms-field,input[type=time].um-forms-field,input[type=url].um-forms-field,select.um-forms-field,textarea.um-forms-field{box-sizing:border-box}input[type=date].um-forms-field.um-long-field,input[type=number].um-forms-field.um-long-field,input[type=password].um-forms-field.um-long-field,input[type=text].um-forms-field.um-long-field,input[type=time].um-forms-field.um-long-field,input[type=url].um-forms-field.um-long-field,select.um-forms-field.um-long-field,textarea.um-forms-field.um-long-field{width:100%!important}input[type=date].um-forms-field.um-medium-field,input[type=number].um-forms-field.um-medium-field,input[type=password].um-forms-field.um-medium-field,input[type=text].um-forms-field.um-medium-field,input[type=time].um-forms-field.um-medium-field,input[type=url].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:50%!important}input[type=date].um-forms-field.um-small-field,input[type=number].um-forms-field.um-small-field,input[type=password].um-forms-field.um-small-field,input[type=text].um-forms-field.um-small-field,input[type=time].um-forms-field.um-small-field,input[type=url].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:25%!important}input[type=number].um-forms-field{padding-right:0}.um-md-default-filters-list,.um-multi-selects-list,.um-multi-text-list{float:left;width:100%;margin:0 0 10px 0}.um-hidden-md-default-filters,.um-hidden-multi-selects,.um-hidden-multi-text{display:none!important}.um-md-default-filters-option-line{float:left;width:100%;clear:both;border-bottom:1px solid #eee;padding:0 0 5px 0;margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-md-default-filters-option-line .um-field-wrapper2.um{margin:5px 0 0 0}.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header{background:#44b0ec;border:1px solid #44b0ec!important;margin-top:-1px}.um-md-default-filters-option-line .um-field-wrapper2>select{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input{width:100%;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter{width:calc(50% - 7px)!important;float:left}.um-md-default-filters-option-line .um-field-wrapper2>input.um-datepicker-filter:first-child,.um-md-default-filters-option-line .um-field-wrapper2>input.um-timepicker-filter:first-child{margin-right:11px}.um-md-default-filters-option-line .um-field-wrapper2 .um-slider{margin:5px 9px 0 9px;width:calc(100% - 18px);box-sizing:border-box;display:block}.um-md-default-filters-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-selects-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-selects-option-line.um-admin-drag-fld{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap;background:0 0;border:none}.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper{width:calc(100% - 90px)}.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon{float:left;width:20px;text-align:left;line-height:30px}.um-multi-selects-option-line .um-field-wrapper{float:left;width:calc(100% - 60px);line-height:30px;box-sizing:border-box}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields{margin:5px 0 0 0}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label{float:left;width:100%;line-height:30px;box-sizing:border-box;margin:0!important;padding:0!important;font-weight:700;display:flex;flex-direction:row;justify-content:space-beetween;align-items:baseline;flex-wrap:nowrap}.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type=text],.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{width:auto;display:inline;font-weight:400;max-width:70%;flex:.9}.um-multi-selects-option-line .um-field-wrapper input,.um-multi-selects-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-selects-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-multi-text-option-line{float:left;width:100%;padding:0;clear:both;margin:0 0 5px 0}.um-multi-text-option-line .um-field-wrapper{float:left;width:calc(100% - 90px);line-height:30px;box-sizing:border-box}.um-multi-text-option-line .um-field-wrapper input,.um-multi-text-option-line .um-field-wrapper select{float:left;width:100%;margin:0}.um-multi-text-option-line .um-field-control{float:left;width:60px;line-height:30px;padding:0 10px;box-sizing:border-box}.um-form-fields-section{float:left;clear:none;margin:0;padding:0 10px 0 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-form-fields-section label{float:left;width:100%;margin:0;padding:0}.um-form-fields-section label input{float:left;margin-top:0}.um-form-fields-section label span{float:left;width:calc(100% - 20px)}@media screen and (max-width:782px){input[type=text].um-forms-field.um-medium-field,select.um-forms-field.um-medium-field,textarea.um-forms-field.um-medium-field{width:100%!important}input[type=text].um-forms-field.um-small-field,select.um-forms-field.um-small-field,textarea.um-forms-field.um-small-field{width:50%!important}.um-form-fields-section{width:100%!important}.um-admin-metabox .um-form-fields-section label{line-height:22px!important;margin:0 0 12px 0!important}.um-admin-metabox .um-form-fields-section label span{width:calc(100% - 30px)}.um-multi-selects-option-line,.um-multi-text-option-line{margin:0 0 6px 0}.um-forms-line label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line th,.um-form-table.um-third-column .um-forms-line th,.um-form-table.um-two-thirds-column .um-forms-line th{float:left;width:100%;margin-bottom:5px}.um-form-table.um-half-column .um-forms-line th label,.um-form-table.um-third-column .um-forms-line th label,.um-form-table.um-two-thirds-column .um-forms-line th label{float:left;width:100%}.um-form-table.um-half-column .um-forms-line td,.um-form-table.um-third-column .um-forms-line td,.um-form-table.um-two-thirds-column .um-forms-line td{float:left;width:100%}}.um-sortable-items-field .um-sortable-item{cursor:move!important;padding:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border:1px solid #7e8993;border-radius:4px;-moz-border-radius:4px;background:#fff;height:42px;line-height:28px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:nowrap}.um-sortable-items-field .um-sortable-item.um-hidden-item{display:none}.um-sortable-items-field .um-sortable-item .um-field-icon{width:20px;text-align:left;margin:0 10px 0 0}.wp-picker-container input.wp-color-picker[type=text]{width:68px!important;float:left!important;padding:2px 4px!important;border-width:1px!important}span.um-admin-icon-value{margin:0 10px;font-size:13px}span.um-admin-icon-value i{font-size:28px;color:#0085ba;position:relative;top:5px}span.um-admin-icon-clear{display:none;cursor:pointer;position:relative;color:#ccc}span.um-admin-icon-clear.show{display:inline-block}span.um-admin-icon-clear:hover{color:#777}span.um-admin-icon-clear i{font-size:20px;vertical-align:middle} \ No newline at end of file diff --git a/assets/css/admin/forms.sass b/assets/css/admin/forms.sass index 2b7d5c60..b74f1ef5 100644 --- a/assets/css/admin/forms.sass +++ b/assets/css/admin/forms.sass @@ -84,6 +84,7 @@ label margin: 0 0 5px 0 display: inline-block + //font-weight: bold &[data-field_type="icon"] td @@ -95,6 +96,13 @@ // font-style: italic // clear: both +.um-external-link-icon + width: 1em + height: 1em + margin: 0 + vertical-align: middle + fill: currentcolor + .um_admin_fonticon_wrapper +flex( row, flex-start, center, nowrap ) .#{$prefix}admin-icon-value diff --git a/assets/css/admin/roles.css b/assets/css/admin/roles.css index a6bc71a9..039088db 100644 --- a/assets/css/admin/roles.css +++ b/assets/css/admin/roles.css @@ -32,3 +32,8 @@ float: left; display: block; line-height: 37px; } + +#um-admin-form-publish #major-publishing-actions { + padding-top: 0; + padding-left: 0; + padding-right: 0; } diff --git a/assets/css/admin/roles.min.css b/assets/css/admin/roles.min.css index 8343788a..9d13aba0 100644 --- a/assets/css/admin/roles.min.css +++ b/assets/css/admin/roles.min.css @@ -1 +1 @@ -#um-roles .row-actions .reset a{color:#a00}#um-roles .row-actions .reset a:hover{color:red}.wp-list-table.roles .column-core,.wp-list-table.roles .column-users{width:15%;text-align:center!important}.wp-list-table.roles .column-admin_access,.wp-list-table.roles .column-priority{width:10%;text-align:center!important}@media screen and (max-width:782px){.wp-list-table.roles .column-admin_access,.wp-list-table.roles .column-core,.wp-list-table.roles .column-priority,.wp-list-table.roles .column-users{text-align:left!important}}#um-admin-form-wp-capabilities .um-metadata-line th{width:auto}#um-admin-form-wp-capabilities .um-metadata-line td{width:20px}#um_edit_role #titlewrap>span{width:40px;font-size:24px;float:left;display:block;line-height:37px} \ No newline at end of file +#um-roles .row-actions .reset a{color:#a00}#um-roles .row-actions .reset a:hover{color:red}.wp-list-table.roles .column-core,.wp-list-table.roles .column-users{width:15%;text-align:center!important}.wp-list-table.roles .column-admin_access,.wp-list-table.roles .column-priority{width:10%;text-align:center!important}@media screen and (max-width:782px){.wp-list-table.roles .column-admin_access,.wp-list-table.roles .column-core,.wp-list-table.roles .column-priority,.wp-list-table.roles .column-users{text-align:left!important}}#um-admin-form-wp-capabilities .um-metadata-line th{width:auto}#um-admin-form-wp-capabilities .um-metadata-line td{width:20px}#um_edit_role #titlewrap>span{width:40px;font-size:24px;float:left;display:block;line-height:37px}#um-admin-form-publish #major-publishing-actions{padding-top:0;padding-left:0;padding-right:0} \ No newline at end of file diff --git a/assets/css/admin/roles.sass b/assets/css/admin/roles.sass index 08869811..fb78b1ca 100644 --- a/assets/css/admin/roles.sass +++ b/assets/css/admin/roles.sass @@ -42,3 +42,10 @@ float: left display: block line-height: 37px + +#um-admin-form-publish + #major-publishing-actions + padding-top: 0 + padding-left: 0 + padding-right: 0 + diff --git a/includes/admin/class-site-health.php b/includes/admin/class-site-health.php index 77501694..69e59ab2 100644 --- a/includes/admin/class-site-health.php +++ b/includes/admin/class-site-health.php @@ -348,7 +348,7 @@ class Site_Health { } $account_settings['um-account_email'] = array( - 'label' => __( 'Allow users to change e-mail', 'ultimate-member' ), + 'label' => __( 'Allow users to change email', 'ultimate-member' ), 'value' => UM()->options()->get( 'account_email' ) ? $labels['yes'] : $labels['no'], ); @@ -543,7 +543,7 @@ class Site_Health { // Email settings $email_settings = array( 'um-admin_email' => array( - 'label' => __( 'Admin E-mail Address', 'ultimate-member' ), + 'label' => __( 'Admin Email Address', 'ultimate-member' ), 'value' => UM()->options()->get( 'admin_email' ), ), 'um-mail_from' => array( @@ -555,7 +555,7 @@ class Site_Health { 'value' => UM()->options()->get( 'mail_from_addr' ), ), 'um-email_html' => array( - 'label' => __( 'Use HTML for E-mails?', 'ultimate-member' ), + 'label' => __( 'Use HTML for Emails?', 'ultimate-member' ), 'value' => UM()->options()->get( 'email_html' ) ? $labels['yes'] : $labels['no'], ), ); @@ -1420,7 +1420,7 @@ class Site_Health { $info[ 'ultimate-member-' . $key ]['fields'], array( 'um-url_email_activate' => array( - 'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ), + 'label' => __( 'URL redirect after email activation', 'ultimate-member' ), 'value' => $rolemeta['_um_url_email_activate'], ), ) @@ -1846,7 +1846,7 @@ class Site_Health { 'first_name' => __( 'First Name', 'ultimate-member' ), 'last_name' => __( 'Last Name', 'ultimate-member' ), 'nickname' => __( 'Nickname', 'ultimate-member' ), - 'secondary_user_email' => __( 'Secondary E-mail Address', 'ultimate-member' ), + 'secondary_user_email' => __( 'Secondary Email Address', 'ultimate-member' ), 'description' => __( 'Biography', 'ultimate-member' ), 'phone_number' => __( 'Phone Number', 'ultimate-member' ), 'mobile_number' => __( 'Mobile Number', 'ultimate-member' ), diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 70528b08..69a579d1 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -1852,5 +1852,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { return $value; } + + public function render_external_link( $data ) { + $defaults = array( + 'url' => '', + 'html' => '', + ); + $data = wp_parse_args( $data, $defaults ); + if ( empty( $data['url'] ) || empty( $data['html'] ) ) { + return ''; + } + ob_start(); + ?> + + + + + child-theme for Ultimate Member customization, which hasn\'t dependencies with the official themes repo, so your custom files cannot be rewritten after a theme upgrade.
    Otherwise, the customization files may be deleted after every theme upgrade.', 'ultimate-member' ), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), UM()->get_allowed_html( 'admin_notice' ) ); + echo wp_kses( sprintf( __( 'We recommend using a child-theme for Ultimate Member customization. Unlike official theme repositories, child themes don\'t have dependencies that could lead to your custom files being overwritten during a theme upgrade.
    Without a child theme, your customization files may be deleted after every theme update.', 'ultimate-member' ), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), UM()->get_allowed_html( 'admin_notice' ) ); ?>

    diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 6d6c555d..22bbed5e 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1099,7 +1099,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'sections' => array( '' => array( 'title' => __( 'Pages', 'ultimate-member' ), - 'description' => __( 'This section enables you to assign a page to one of the core elements necessary for the plugin\'s proper function. The plugin automatically creates and configures the required pages upon installation.
    You only need to use this tab if you accidentally deleted pages that were automatically created during the initial plugin activation.', 'ultimate-member' ), + 'description' => sprintf( __( 'This section enables you to assign a page to one of the core elements necessary for the plugin\'s proper function. The plugin automatically creates and configures the required pages upon installation.
    You only need to use this tab if you accidentally deleted pages that were automatically created during the initial plugin activation. Learn more about manually creating pages.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1903-creating-plugin-core-pages-manually' ), 'fields' => $general_pages_fields, ), 'users' => array( @@ -1562,7 +1562,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'blocked_emails', 'type' => 'textarea', 'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ), - 'description' => __( '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' ), + 'description' => __( 'This will block the specified email 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', @@ -1586,7 +1586,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'id' => 'admin_email', 'type' => 'text', - 'label' => __( 'Admin E-mail Address', 'ultimate-member' ), + 'label' => __( 'Admin Email Address', 'ultimate-member' ), 'description' => __( 'e.g. admin@companyname.com.', 'ultimate-member' ), ), array( @@ -1611,8 +1611,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'email_html', 'type' => 'checkbox', 'label' => __( 'Content type', 'ultimate-member' ), - 'checkbox_label' => __( 'Enable HTML for E-mails', 'ultimate-member' ), - 'description' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable HTML for Emails', 'ultimate-member' ), + 'description' => __( 'If you plan use emails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.', 'ultimate-member' ), ), ), ), @@ -2193,7 +2193,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'form_sections' => array( 'developers' => array( 'title' => __( 'Developers', 'ultimate-member' ), - 'description' => __( 'This section allows you to manage settings that will be more developer-friendly. If you are not a developer, edit these settings at your own risk.', 'ultimate-member' ), + 'description' => __( 'This section is designed to modify settings that are tailored for developers. If you are not a developer, please be cautious when changing these settings.', 'ultimate-member' ), 'fields' => array( array( 'id' => 'allowed_choice_callbacks', diff --git a/includes/admin/core/class-admin-users.php b/includes/admin/core/class-admin-users.php index bcb05c8c..0857740e 100644 --- a/includes/admin/core/class-admin-users.php +++ b/includes/admin/core/class-admin-users.php @@ -247,7 +247,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) { 'label' => __( 'Put as Pending Review', 'ultimate-member' ) ), 'um_resend_activation' => array( - 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) + 'label' => __( 'Resend Activation Email', 'ultimate-member' ) ), 'um_deactivate' => array( 'label' => __( 'Deactivate', 'ultimate-member' ) @@ -407,7 +407,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) { $status = array( 'approved' => __( 'Approved', 'ultimate-member' ), 'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ), - 'awaiting_email_confirmation' => __( 'Waiting e-mail confirmation', 'ultimate-member' ), + 'awaiting_email_confirmation' => __( 'Waiting email confirmation', 'ultimate-member' ), 'inactive' => __( 'Inactive', 'ultimate-member' ), 'rejected' => __( 'Rejected', 'ultimate-member' ), ); diff --git a/includes/admin/templates/dashboard/users.php b/includes/admin/templates/dashboard/users.php index e7718757..a018976a 100644 --- a/includes/admin/templates/dashboard/users.php +++ b/includes/admin/templates/dashboard/users.php @@ -70,7 +70,7 @@
    diff --git a/includes/admin/templates/role/publish.php b/includes/admin/templates/role/publish.php index bdbaf33c..9273d006 100644 --- a/includes/admin/templates/role/publish.php +++ b/includes/admin/templates/role/publish.php @@ -1,12 +1,14 @@ - +$role = $object['data']; +?>
    admin_forms( + $form = UM()->admin_forms( array( 'class' => 'um-role-publish um-top-label', 'prefix_id' => 'role', @@ -20,7 +22,8 @@ $role = $object['data']; ?> ), ), ) - )->render_form(); + ); + $form->render_form(); ?>
    @@ -31,3 +34,10 @@ $role = $object['data']; ?>
    +render_external_link( + array( + 'html' => __( 'Learn more about role priorities', 'ultimate-member' ), + 'url' => 'https://docs.ultimatemember.com/article/1494-how-to-set-role-priority-for-user-roles', + ) +); diff --git a/includes/admin/templates/role/register.php b/includes/admin/templates/role/register.php index 5b2ba4df..3952a31b 100644 --- a/includes/admin/templates/role/register.php +++ b/includes/admin/templates/role/register.php @@ -76,8 +76,8 @@ array( 'id' => '_um_url_email_activate', 'type' => 'text', - 'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ), - 'tooltip' => __( 'If you want users to go to a specific page other than login page after e-mail activation, enter the URL here.', 'ultimate-member' ), + 'label' => __( 'URL redirect after email activation', 'ultimate-member' ), + 'tooltip' => __( 'If you want users to go to a specific page other than login page after email activation, enter the URL here.', 'ultimate-member' ), 'value' => ! empty( $role['_um_url_email_activate'] ) ? __( $role['_um_url_email_activate'], 'ultimate-member' ) : '', 'conditional' => array( '_um_status', '=', 'checkmail' ), ), diff --git a/includes/class-config.php b/includes/class-config.php index aa8e1bf6..a7b64e2f 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -282,14 +282,14 @@ if ( ! class_exists( 'um\Config' ) ) { ) ); $this->core_form_meta['register'] = array( - '_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}', + '_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"Email Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}', '_um_mode' => 'register', '_um_core' => 'register', '_um_register_use_custom_settings' => 0, ); $this->core_form_meta['login'] = array( - '_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or E-mail";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}', + '_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or Email";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}', '_um_mode' => 'login', '_um_core' => 'login', '_um_login_use_custom_settings' => 0, @@ -343,7 +343,7 @@ if ( ! class_exists( 'um\Config' ) ) { 'Thank you for signing up with {site_name}! Your account is now active.

    ' . '{action_title}:

    ' . '{action_url}

    ' . - 'Your account e-mail: {email}
    ' . + 'Your account email: {email}
    ' . 'Your account username: {username}

    ' . 'If you have any problems, please contact us at {admin_email}

    ' . 'Thanks,
    ' . @@ -362,7 +362,7 @@ if ( ! class_exists( 'um\Config' ) ) { 'If you have any problems, please contact us at {admin_email}

    ' . 'Thanks,
    ' . '{site_name}', - 'description' => __('Whether to send the user an email when his account needs e-mail activation','ultimate-member'), + 'description' => __('Whether to send the user an email when his account needs email activation','ultimate-member'), 'recipient' => 'user' ), 'pending_email' => array( @@ -386,7 +386,7 @@ if ( ! class_exists( 'um\Config' ) ) { 'Thank you for signing up with {site_name}! Your account has been approved and is now active.

    ' . 'To login please visit the following url:

    ' . '{login_url}

    ' . - 'Your account e-mail: {email}
    ' . + 'Your account email: {email}
    ' . 'Your account username: {username}
    ' . 'Set your account password: {password_reset_link}

    ' . 'If you have any problems, please contact us at {admin_email}

    ' . diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php index d1391022..4939fbd2 100644 --- a/includes/core/class-builtin.php +++ b/includes/core/class-builtin.php @@ -782,10 +782,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { ), 'username' => array( - 'title' => __('Username or E-mail','ultimate-member'), + 'title' => __('Username or Email','ultimate-member'), 'metakey' => 'username', 'type' => 'text', - 'label' => __('Username or E-mail','ultimate-member'), + 'label' => __('Username or Email','ultimate-member'), 'required' => 1, 'public' => 1, 'editable' => false, @@ -871,10 +871,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { ), 'user_email' => array( - 'title' => __('E-mail Address','ultimate-member'), + 'title' => __('Email Address','ultimate-member'), 'metakey' => 'user_email', 'type' => 'text', - 'label' => __('E-mail Address','ultimate-member'), + 'label' => __('Email Address','ultimate-member'), 'required' => 0, 'public' => 1, 'validate' => 'unique_email', @@ -882,10 +882,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { ), 'secondary_user_email' => array( - 'title' => __('Secondary E-mail Address','ultimate-member'), + 'title' => __('Secondary Email Address','ultimate-member'), 'metakey' => 'secondary_user_email', 'type' => 'text', - 'label' => __('Secondary E-mail Address','ultimate-member'), + 'label' => __('Secondary Email Address','ultimate-member'), 'required' => 0, 'public' => 1, 'editable' => true, @@ -1271,7 +1271,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { ), 'username_b' => array( - 'title' => __('Username or E-mail','ultimate-member'), + 'title' => __('Username or Email','ultimate-member'), 'metakey' => 'username_b', 'type' => 'text', 'placeholder' => __('Enter your username or email','ultimate-member'), @@ -1558,11 +1558,11 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { $array['skype'] = __('Skype ID','ultimate-member'); $array['soundcloud'] = __( 'SoundCloud Profile', 'ultimate-member' ); $array['twitter_url'] = __( 'X (formerly Twitter) URL', 'ultimate-member' ); - $array['is_email'] = __('E-mail( Not Unique )','ultimate-member'); - $array['unique_email'] = __('Unique E-mail','ultimate-member'); + $array['is_email'] = __('Email( Not Unique )','ultimate-member'); + $array['unique_email'] = __('Unique Email','ultimate-member'); $array['unique_value'] = __('Unique Metakey value','ultimate-member'); $array['unique_username'] = __('Unique Username','ultimate-member'); - $array['unique_username_or_email'] = __('Unique Username/E-mail','ultimate-member'); + $array['unique_username_or_email'] = __('Unique Username/Email','ultimate-member'); $array['url'] = __('Website URL','ultimate-member'); $array['youtube_url'] = __('YouTube Profile','ultimate-member'); $array['youtube_video'] = __('YouTube Video','ultimate-member'); diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 8deccf7f..021bd54c 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -425,7 +425,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { 'first_name' => __( 'First Name', 'ultimate-member' ), 'last_name' => __( 'Last Name', 'ultimate-member' ), 'nickname' => __( 'Nickname', 'ultimate-member' ), - 'secondary_user_email' => __( 'Secondary E-mail Address', 'ultimate-member' ), + 'secondary_user_email' => __( 'Secondary Email Address', 'ultimate-member' ), 'description' => __( 'Biography', 'ultimate-member' ), 'phone_number' => __( 'Phone Number', 'ultimate-member' ), 'mobile_number' => __( 'Mobile Number', 'ultimate-member' ), diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php index 5d66a799..b2714d45 100644 --- a/includes/core/class-permalinks.php +++ b/includes/core/class-permalinks.php @@ -174,7 +174,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { do_action( 'um_after_email_confirmation', $user_id ); if ( empty( $set_password_required ) ) { - $redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after e-mail activation" + $redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after email activation" } $redirect = apply_filters( 'um_after_email_confirmation_redirect', $redirect, $user_id, $login ); diff --git a/includes/core/class-user.php b/includes/core/class-user.php index 9a96da1f..573924b1 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -1301,7 +1301,7 @@ if ( ! class_exists( 'um\core\User' ) ) { } if ( $this->usermeta['account_status'][0] == 'awaiting_email_confirmation' ) { - $this->usermeta['account_status_name'][0] = __( 'Awaiting E-mail Confirmation', 'ultimate-member' ); + $this->usermeta['account_status_name'][0] = __( 'Awaiting Email Confirmation', 'ultimate-member' ); } if ( $this->usermeta['account_status'][0] == 'awaiting_admin_review' ) { @@ -1676,7 +1676,7 @@ if ( ! class_exists( 'um\core\User' ) ) { /** - * This method approves a user membership and sends them an optional welcome/approval e-mail. + * This method approves a user membership and sends them an optional welcome/approval email. * * @usage user()->approve(); ?> * @@ -1758,7 +1758,7 @@ if ( ! class_exists( 'um\core\User' ) ) { /** - * This method puts a user under manual review by administrator and sends them an optional e-mail. + * This method puts a user under manual review by administrator and sends them an optional email. * * @usage user()->pending(); ?> * @@ -1784,7 +1784,7 @@ if ( ! class_exists( 'um\core\User' ) ) { /** - * This method rejects a user membership and sends them an optional e-mail. + * This method rejects a user membership and sends them an optional email. * * @usage user()->reject(); ?> * @@ -1811,7 +1811,7 @@ if ( ! class_exists( 'um\core\User' ) ) { /** - * This method deactivates a user membership and sends them an optional e-mail. + * This method deactivates a user membership and sends them an optional email. * * @usage user()->deactivate(); ?> * diff --git a/includes/core/um-actions-account.php b/includes/core/um-actions-account.php index 41e520dc..84544975 100644 --- a/includes/core/um-actions-account.php +++ b/includes/core/um-actions-account.php @@ -157,15 +157,15 @@ function um_submit_account_errors_hook( $args ) { if ( isset( $args['user_email'] ) ) { if ( strlen( trim( $args['user_email'] ) ) === 0 ) { - UM()->form()->add_error( 'user_email', __( 'You must provide your e-mail', 'ultimate-member' ) ); + UM()->form()->add_error( 'user_email', __( 'You must provide your email', 'ultimate-member' ) ); } if ( ! is_email( $args['user_email'] ) ) { - UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) ); + UM()->form()->add_error( 'user_email', __( 'Please provide a valid email', 'ultimate-member' ) ); } if ( email_exists( $args['user_email'] ) && email_exists( $args['user_email'] ) !== get_current_user_id() ) { - UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) ); + UM()->form()->add_error( 'user_email', __( 'Please provide a valid email', 'ultimate-member' ) ); } } diff --git a/includes/core/um-actions-misc.php b/includes/core/um-actions-misc.php index 1327d024..9525b5a1 100644 --- a/includes/core/um-actions-misc.php +++ b/includes/core/um-actions-misc.php @@ -168,7 +168,7 @@ function um_add_update_notice( $args ) { $err = __( 'Your account has not been approved yet.', 'ultimate-member' ); break; case 'awaiting_email_confirmation': - $err = __( 'Your account is awaiting e-mail verification.', 'ultimate-member' ); + $err = __( 'Your account is awaiting email verification.', 'ultimate-member' ); break; case 'rejected': $err = __( 'Your membership request has been rejected.', 'ultimate-member' ); diff --git a/includes/core/um-filters-login.php b/includes/core/um-filters-login.php index 2f697ea0..a5369469 100644 --- a/includes/core/um-filters-login.php +++ b/includes/core/um-filters-login.php @@ -78,7 +78,7 @@ function um_wp_form_errors_hook_logincheck( $user ) { $error = new WP_Error( $status, __( 'Your account has not been approved yet.', 'ultimate-member' ) ); break; case 'awaiting_email_confirmation': - $error = new WP_Error( $status, __( 'Your account is awaiting e-mail verification.', 'ultimate-member' ) ); + $error = new WP_Error( $status, __( 'Your account is awaiting email verification.', 'ultimate-member' ) ); break; case 'rejected': $error = new WP_Error( $status, __( 'Your membership request has been rejected.', 'ultimate-member' ) ); diff --git a/includes/core/um-filters-user.php b/includes/core/um-filters-user.php index 455651ca..2ff9e293 100644 --- a/includes/core/um-filters-user.php +++ b/includes/core/um-filters-user.php @@ -34,7 +34,7 @@ function um_admin_user_actions_hook( $actions, $user_id ) { } if ( 'awaiting_email_confirmation' === $account_status ) { - $actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) ); + $actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation Email', 'ultimate-member' ) ); } if ( 'inactive' !== $account_status ) { diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 2a63b100..0b8e7d98 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -1751,7 +1751,7 @@ function um_can_edit_my_profile() { /** - * Short for admin e-mail + * Short for admin email * * @return mixed|string|void */ @@ -1761,7 +1761,7 @@ function um_admin_email() { /** - * Get admin e-mails + * Get admin emails * * @return array */ diff --git a/templates/email/approved_email.php b/templates/email/approved_email.php index d5276526..c76c9bd6 100644 --- a/templates/email/approved_email.php +++ b/templates/email/approved_email.php @@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
    Account Information
    -
    Your account e-mail: {email}
    +
    Your account email: {email}
    Your account username: {username}
    Set your password: {password_reset_link}
    diff --git a/templates/email/checkmail_email.php b/templates/email/checkmail_email.php index 92cb56fc..2c86633d 100644 --- a/templates/email/checkmail_email.php +++ b/templates/email/checkmail_email.php @@ -1,7 +1,7 @@ Date: Fri, 16 Feb 2024 15:40:02 +0200 Subject: [PATCH 68/76] - changed texts; --- includes/admin/core/list-tables/emails-list-table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/core/list-tables/emails-list-table.php b/includes/admin/core/list-tables/emails-list-table.php index 0ebd6798..0321b934 100644 --- a/includes/admin/core/list-tables/emails-list-table.php +++ b/includes/admin/core/list-tables/emails-list-table.php @@ -336,8 +336,8 @@ $ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), '


    - - here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1335-email-templates' ), UM()->get_allowed_html( 'admin_notice' ) ); ?> + + doc for more information.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/116-not-receiving-user-emails-or-admin-notifications' ), UM()->get_allowed_html( 'admin_notice' ) ); ?>

    From 8f65e72e3ff6413815583c3fb73326bcdcf78d7e Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 16:06:28 +0200 Subject: [PATCH 69/76] - fixed search line layout; --- assets/css/um-styles.css | 14 +++++++++++++- assets/css/um-styles.min.css | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css index 108cdfa7..a9129ecf 100644 --- a/assets/css/um-styles.css +++ b/assets/css/um-styles.css @@ -899,14 +899,26 @@ small.um-max-filesize span{ .um-search-area .um-search-field { width: 100%; margin: 0; + padding-left: 25px; +} + +.rtl .um-search-area .um-search-field { + padding-right: 25px; + padding-left: initial; } .um-search-area .um-search-icon { position: absolute; height: 100%; - right: 10px; + left: 6px; top: 0; } + +.rtl .um-search-area .um-search-icon { + right: 6px; + left: initial; +} + .um-faicon-search:before { display: flex; align-items: center; diff --git a/assets/css/um-styles.min.css b/assets/css/um-styles.min.css index 2db1f52c..23f68472 100644 --- a/assets/css/um-styles.min.css +++ b/assets/css/um-styles.min.css @@ -1 +1 @@ -.um:not(.um-admin){width:100%;text-align:left;box-sizing:border-box;color:#666;font-size:15px;margin-bottom:30px!important;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important;opacity:0}.um-s1,.um-s2{display:none}.um:not(.um-admin) :after,.um:not(.um-admin) :before{box-sizing:content-box}.um-account-side li a,.um-cover a,.um-field-value a,.um-header a,.um-member-less a,.um-member-more a,.um-member-name a,.um-member-photo a,.um-members a,.um-members-pagi a,.um-members-pagi span{border-bottom:0!important}.um-modal a:focus,.um:not(.um-admin) a:focus{outline:0!important}.um:not(.um-admin) a .image-overlay,.um:not(.um-admin) a:hover .image-overlay,.um:not(.um-admin) a:hover .image-overlay *{display:none!important;width:0!important;height:0!important;position:static!important}.um.um-in-admin{padding-top:0}.um.um-in-admin .um-tip{display:none!important}.um:not(.um-admin):not(.um-directory) input,.um:not(.um-admin):not(.um-directory) select,.um:not(.um-admin):not(.um-directory) textarea{font-size:15px}.um:not(.um-admin) *{-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important}.um-left{float:left}.um-right{float:right}.um-clear{clear:both}.um-center{text-align:center}.um-center .um-button{display:inline-block!important;width:auto!important;min-width:250px!important}.um-half{width:48%}.um-field-half{width:48%;float:left}.um-field-half.right{float:right}.um-field-tri{width:30%;float:left;margin-right:3%}.um img{box-shadow:none!important}.um-col{padding-bottom:20px}.um-col-alt{margin:15px 0 5px 0}.um-col-alt-s{padding-top:10px}.um-col-alt-b{padding-top:20px}.um-col-121{float:left;width:48%}.um-col-122{float:right;width:48%}.um-col-131{float:left;width:30%}.um-col-132{float:left;width:30%;margin:0 5%}.um-col-133{float:left;width:30%}.um-raty i{font-size:26px}.um-field-half .um-raty i{font-size:21px}.um-field-tri .um-raty i{font-size:21px}.um-button i{font-size:22px;width:22px;height:12px!important;display:inline-block;line-height:12px!important;vertical-align:middle!important;position:relative;top:-6px;margin-right:8px}.um-row-heading{padding:5px 0;font-size:16px}.um-row-heading i{font-size:24px;height:24px;line-height:24px;margin:0 12px 0 0;display:inline-block;width:30px;text-align:center}.um-row-heading i:before{vertical-align:middle!important}p.um-notice{width:auto;color:#fff;box-sizing:border-box;font-size:15px;padding:12px!important;margin:12px 0 0 0!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative}p.um-notice a{color:#fff;text-decoration:underline}p.um-notice i{position:absolute;right:14px;font-size:36px;cursor:pointer;top:7px;display:block;height:30px;line-height:30px}p.um-notice.success{background:#7acf58}p.um-notice.err{background:#c74a4a}p.um-notice.warning{background:#f9f9d1;color:#666;border:1px solid #efe4a2;padding:8px 15px!important}p.um-notice.warning a{color:#666;text-decoration:underline}.um-field-error{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:12px 0 0 0}.um-field-error a{color:#fff!important;text-decoration:underline!important}.um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#c74a4a;font-size:28px;line-height:1em!important}.um-error-block{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-field-notice{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:5px 0 0 0}.um-field-notice a{color:#fff!important;text-decoration:underline!important}.um-field-notice .um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#497bc7!important;font-size:28px;line-height:1em!important}.um-notice-block{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-tip{margin:0 0 0 8px;cursor:pointer;display:inline-block;position:relative;top:3px}.um-tip i{font-size:22px;height:22px;line-height:22px;display:block;position:relative}.um-tip-text{display:block;font-size:13px;line-height:15px;color:#999}.um-form button::-moz-focus-inner,.um-form input::-moz-focus-inner{border:0!important;padding:0!important}.um-field{position:relative;padding:15px 0 0 0}.um-field-b,.um-field-c{padding-top:0!important}.um-field-label{display:block;margin:0 0 8px 0}.um-field-label .um-field-label-icon{float:left;margin:0 8px 0 0;height:22px;line-height:18px;display:inline-block;width:24px;text-align:center}.um-field-label .um-field-label-icon i{font-size:22px;position:relative;top:1px}.um-field-label label{font-size:15px!important;line-height:22px!important;font-weight:700;font-weight:600}.um-field-area{position:relative;word-wrap:break-word}.um-field-area-password{position:relative}.um-toggle-password{cursor:pointer;display:block;position:absolute;right:0;top:0;height:100%;width:40px;text-align:center;box-sizing:border-box;font-size:20px;line-height:2}.um-toggle-password i{transition:all .2s linear}.um-toggle-password:hover i{color:#44b0ec}.um-field-value p{margin:0 0 6px 0!important;padding:0}.um-field-block{color:#777;font-size:17px}.um-field-spacing{width:100%}.um-field-divider{width:100%;margin:0 0 12px 0;height:24px;position:relative}.um-field-divider-text{position:absolute;width:100%;text-align:center;bottom:-24px;left:0;font-size:16px;padding:10px 0}.um-field-divider-text span{background:#fff;color:#555;display:inline-block;padding:0 15px}.um-field-icon{position:absolute;cursor:default;text-align:center!important;top:2px;left:0;width:44px;font-size:22px;line-height:1.7em;z-index:1}.um-form input[type=number],.um-form input[type=password],.um-form input[type=search],.um-form input[type=tel],.um-form input[type=text]{padding:0 12px!important;width:100%;display:block!important;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;outline:0!important;cursor:text!important;font-size:15px!important;height:40px!important;box-sizing:border-box!important;box-shadow:none!important;margin:0!important;position:static}.um-form .um-field-area-password input[type=password]{padding-right:40px!important}.um-form input[type=number]{width:auto;padding:0 0 0 5px!important;height:30px!important}.um-form input[type=number]:focus,.um-form input[type=password]:focus,.um-form input[type=search]:focus,.um-form input[type=tel]:focus,.um-form input[type=text]:focus,.um-form textarea:focus{box-shadow:none!important;outline:0!important}.um-form input[type=password].um-iconed,.um-form input[type=tel].um-iconed,.um-form input[type=text].um-iconed{padding-left:44px!important}.um-form input[type=password].um-error,.um-form input[type=tel].um-error,.um-form input[type=text].um-error{border-color:#c74a4a!important}.um-form textarea{width:100%;padding:8px 12px!important;display:block;font-size:15px!important;line-height:22px!important;background:#fff;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;box-sizing:border-box;min-height:80px!important;box-shadow:none;outline:0!important}.um-form .um-meta-text textarea{max-width:100%}.um-form .wp-editor-container{border:1px solid #ddd}.um-form .wp-editor-container textarea{background:#ddd!important;color:#222!important;border-radius:0}.um-field-c .um-field-checkbox{margin-bottom:14px;margin-top:0!important;position:relative}.um-field-checkbox:not(.um-field),.um-field-radio:not(.um-field){display:block;margin:8px 0;position:relative}.um-profile.um-editing .um-field-checkbox,.um-profile.um-editing .um-field-radio{cursor:pointer!important}.um-field-checkbox:hover i,.um-field-radio:hover i{color:#666}.um-field-checkbox input,.um-field-radio input{opacity:0!important;display:inline!important;width:0!important;float:left}.um-field-checkbox-state,.um-field-radio-state{position:absolute;top:0;left:1px;width:24px;height:24px}.um-field-checkbox-state i,.um-field-radio-state i{font-size:24px;line-height:24px;height:24px;color:#aaa;transition:all .2s linear}.um-field-checkbox-option,.um-field-radio-option{margin:0 0 0 36px;line-height:24px;color:#888!important;display:block}.um-field-group{margin-top:20px}.um-field-group-head{cursor:pointer;color:#fff;font-size:16px;line-height:22px;padding:10px 20px;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;border-top:1px solid transparent!important;border-bottom:2px solid rgba(0,0,0,.1)!important}.um-field-group-head i{font-size:20px;margin:0 8px 0 0}.um-field-group-head i:before{vertical-align:middle!important}.um-field-group-body{display:none;margin:15px 0 0 0;padding:15px 20px 5px 20px;background:#f9f9f9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative;box-sizing:border-box;width:100%}.um-field-group-body div.um-field{padding:0 0 15px 0}.um-field-group-cancel{font-size:18px;position:absolute;z-index:800;right:8px;top:8px;color:#ccc!important;text-decoration:none!important}.um-field-group-cancel:hover{color:#777!important}.um div.disabled,.um input[type=number]:disabled,.um input[type=submit]:disabled,.um input[type=text]:disabled,.um-disabled{opacity:.6!important;cursor:no-drop!important}input[type=submit].um-button,input[type=submit].um-button:focus{vertical-align:middle!important;height:auto!important;font-size:15px;cursor:pointer!important;width:100%;box-shadow:none;text-shadow:none;font-family:inherit;outline:0!important;margin:0;opacity:1;-webkit-appearance:none}input[type=submit].um-button:hover{opacity:1}.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button:hover{-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)}.um-button.um-btn-auto-width{width:auto;display:inline-block;padding:14px 20px!important;min-width:200px;max-width:450px}a.um-link-alt{line-height:22px;color:#888!important;display:block!important;text-decoration:none!important;font-weight:400;text-align:center;border-bottom:none!important}a.um-link-alt:hover{text-decoration:underline!important}.um-dropdown{position:absolute;height:auto;background:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;z-index:55;display:none;border:1px solid #e5e5e5;box-sizing:border-box;-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 1px rgba(0,0,0,.1)}.um-dropdown li,.um-dropdown ul{list-style-type:none!important;padding:0!important;margin:0!important}.um-dropdown ul{background:#fff;position:relative;z-index:16}.um-dropdown li a{display:block;padding:8px 12px;color:#666;font-size:14px;line-height:18px}.um-dropdown li:last-child a{border-top:1px solid #e5e5e5;padding:12px}.um-dropdown-b{position:relative}.um-dropdown-arr{position:absolute;font-size:24px;width:24px;height:24px;overflow:hidden;z-index:15;color:#eee}.um-dropdown-arr *{display:block!important;width:24px!important;height:24px!important;vertical-align:bottom!important;overflow:hidden!important;line-height:24px!important}div.um-photo{margin:20px auto 0 auto;text-align:center;box-sizing:border-box;max-width:100%}div.um-photo,div.um-photo a,div.um-photo img{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}div.um-photo a{border:1px solid #e5e5e5;padding:5px;box-sizing:border-box;display:inline-block;box-shadow:0 1px 1px #eee;margin:0 auto;max-width:100%}div.um-photo img{max-height:300px;max-width:100%}span.um-req{margin:0 0 0 8px;font-size:14px;display:inline-block}small.um-max-filesize{display:block;color:#999;padding-top:5px}small.um-max-filesize span{font-size:12px}.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched,.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched:focus,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists:focus{border-color:#db2929!important}.um-form .um-field .um-field-area input.um-searching-username{background-image:url(../img/loading.gif);background-position:right center;background-repeat:no-repeat;background-size:24px 24px}.um-search-area{position:relative;max-width:300px}.um-search-area .um-search-field{width:100%;margin:0}.um-search-area .um-search-icon{position:absolute;height:100%;right:10px;top:0}.um-faicon-search:before{display:flex;align-items:center;justify-content:center;height:100%}.um-field .select2-container.select2-container--open,.um-search-filter .select2-container.select2-container--open{z-index:9999999}.um-field .select2.select2-container .select2-selection,.um-search-filter .select2.select2-container .select2-selection{display:block!important;height:40px;padding:0 0 0 12px!important;overflow:hidden!important;position:relative!important;white-space:nowrap!important;line-height:35px!important;color:#666!important;font-size:15px!important;-moz-border-radius:2px!important;-webkit-border-radius:2px!important;border-radius:2px!important;background-clip:padding-box!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff!important;border:1px solid #ddd!important}.rtl .um-field .select2.select2-container .select2-selection,.rtl .um-search-filter .select2.select2-container .select2-selection{padding:0 12px 0 0!important}.um-field .select2.select2-container .select2-selection .select2-selection__arrow,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{display:inline-block!important;width:34px!important;height:100%!important;position:absolute;right:0;top:0;text-align:center;background:0 0!important;border:none!important}.rtl .um-field .select2.select2-container .select2-selection .select2-selection__arrow,.rtl .um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{right:initial;left:0}.um-field .select2.select2-container .select2-selection .select2-selection__arrow:before,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow:before{content:"\f3d0"!important;font-size:28px!important;font-family:Ionicons!important;display:block;height:100%;line-height:40px;min-width:1em;text-align:center;color:#aaa}.um-field .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation],.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation]{display:none}.um-field .select2-container.select2-container--open .select2-dropdown,.um-search-filter .select2-container.select2-container--open .select2-dropdown{border:1px solid #ddd!important;border-radius:0}.um-field .select2-container.select2-container--open .select2-dropdown .select2-results li,.um-search-filter .select2-container.select2-container--open .select2-dropdown .select2-results li{list-style:none;display:list-item;background:0 0;font-size:15px;margin:5px!important;color:#666!important;padding:3px 7px 4px!important;cursor:pointer;min-height:1em}.um-field .select2.select2-container .select2-selection.select2-selection--multiple,.um-search-filter .select2.select2-container .select2-selection.select2-selection--multiple{height:auto!important;line-height:.8!important;min-height:40px;padding-bottom:4px!important}.um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:37px;padding-left:0;padding-right:24px}.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{padding-left:24px;padding-right:0}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{line-height:37px;box-sizing:border-box;list-style:none;margin:0;padding-left:0;padding-right:30px;width:100%;font-size:13px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:30px;padding-right:0}.um-field .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted,.um-search-filter .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted{background:#f4f4f4;color:#666}.um-field .select2-dropdown .select2-results li.select2-results__option[aria-selected=true],.um-search-filter .select2-dropdown .select2-results li.select2-results__option[aria-selected=true]{background-color:#ddd}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-field .select2-container--default .select2-selection--single .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{color:#aaa;font-size:28px;font-weight:400;line-height:34px;margin:0!important;right:0;text-align:center;width:1em}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{left:0;right:initial}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear{position:absolute}.um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 5px 0 0;max-height:28px;padding:3px 3px 3px 5px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px;padding:3px 5px 3px 3px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 5px 0 0;padding:0}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 0 0 5px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input{border:none!important;padding:0!important;max-height:28px}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered li,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered li{overflow-x:hidden;text-overflow:ellipsis;max-width:100%;box-sizing:border-box;line-height:20px}.um-field-multiselect .um-field-area .um-field-icon,.um-field-select .um-field-area .um-field-icon{z-index:99999999}.um-field-select .um-field-area.um-field-area-has-icon .select2-selection__rendered{text-indent:20px}.um-field-multiselect .um-field-area.um-field-area-has-icon ul:first-child{margin-left:30px!important}.um-field-area .wp-switch-editor{float:none;height:auto} \ No newline at end of file +.um:not(.um-admin){width:100%;text-align:left;box-sizing:border-box;color:#666;font-size:15px;margin-bottom:30px!important;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important;opacity:0}.um-s1,.um-s2{display:none}.um:not(.um-admin) :after,.um:not(.um-admin) :before{box-sizing:content-box}.um-account-side li a,.um-cover a,.um-field-value a,.um-header a,.um-member-less a,.um-member-more a,.um-member-name a,.um-member-photo a,.um-members a,.um-members-pagi a,.um-members-pagi span{border-bottom:0!important}.um-modal a:focus,.um:not(.um-admin) a:focus{outline:0!important}.um:not(.um-admin) a .image-overlay,.um:not(.um-admin) a:hover .image-overlay,.um:not(.um-admin) a:hover .image-overlay *{display:none!important;width:0!important;height:0!important;position:static!important}.um.um-in-admin{padding-top:0}.um.um-in-admin .um-tip{display:none!important}.um:not(.um-admin):not(.um-directory) input,.um:not(.um-admin):not(.um-directory) select,.um:not(.um-admin):not(.um-directory) textarea{font-size:15px}.um:not(.um-admin) *{-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important}.um-left{float:left}.um-right{float:right}.um-clear{clear:both}.um-center{text-align:center}.um-center .um-button{display:inline-block!important;width:auto!important;min-width:250px!important}.um-half{width:48%}.um-field-half{width:48%;float:left}.um-field-half.right{float:right}.um-field-tri{width:30%;float:left;margin-right:3%}.um img{box-shadow:none!important}.um-col{padding-bottom:20px}.um-col-alt{margin:15px 0 5px 0}.um-col-alt-s{padding-top:10px}.um-col-alt-b{padding-top:20px}.um-col-121{float:left;width:48%}.um-col-122{float:right;width:48%}.um-col-131{float:left;width:30%}.um-col-132{float:left;width:30%;margin:0 5%}.um-col-133{float:left;width:30%}.um-raty i{font-size:26px}.um-field-half .um-raty i{font-size:21px}.um-field-tri .um-raty i{font-size:21px}.um-button i{font-size:22px;width:22px;height:12px!important;display:inline-block;line-height:12px!important;vertical-align:middle!important;position:relative;top:-6px;margin-right:8px}.um-row-heading{padding:5px 0;font-size:16px}.um-row-heading i{font-size:24px;height:24px;line-height:24px;margin:0 12px 0 0;display:inline-block;width:30px;text-align:center}.um-row-heading i:before{vertical-align:middle!important}p.um-notice{width:auto;color:#fff;box-sizing:border-box;font-size:15px;padding:12px!important;margin:12px 0 0 0!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative}p.um-notice a{color:#fff;text-decoration:underline}p.um-notice i{position:absolute;right:14px;font-size:36px;cursor:pointer;top:7px;display:block;height:30px;line-height:30px}p.um-notice.success{background:#7acf58}p.um-notice.err{background:#c74a4a}p.um-notice.warning{background:#f9f9d1;color:#666;border:1px solid #efe4a2;padding:8px 15px!important}p.um-notice.warning a{color:#666;text-decoration:underline}.um-field-error{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:12px 0 0 0}.um-field-error a{color:#fff!important;text-decoration:underline!important}.um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#c74a4a;font-size:28px;line-height:1em!important}.um-error-block{width:auto;max-width:100%;background:#c74a4a;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-field-notice{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:20px!important;margin:5px 0 0 0}.um-field-notice a{color:#fff!important;text-decoration:underline!important}.um-field-notice .um-field-arrow{top:-17px;left:10px;position:absolute;z-index:1;color:#497bc7!important;font-size:28px;line-height:1em!important}.um-notice-block{width:auto;max-width:100%;background:#497bc7;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;color:#fff;box-sizing:border-box;position:relative;padding:12px;font-size:14px;line-height:1em!important;margin:12px 0 0 0}.um-tip{margin:0 0 0 8px;cursor:pointer;display:inline-block;position:relative;top:3px}.um-tip i{font-size:22px;height:22px;line-height:22px;display:block;position:relative}.um-tip-text{display:block;font-size:13px;line-height:15px;color:#999}.um-form button::-moz-focus-inner,.um-form input::-moz-focus-inner{border:0!important;padding:0!important}.um-field{position:relative;padding:15px 0 0 0}.um-field-b,.um-field-c{padding-top:0!important}.um-field-label{display:block;margin:0 0 8px 0}.um-field-label .um-field-label-icon{float:left;margin:0 8px 0 0;height:22px;line-height:18px;display:inline-block;width:24px;text-align:center}.um-field-label .um-field-label-icon i{font-size:22px;position:relative;top:1px}.um-field-label label{font-size:15px!important;line-height:22px!important;font-weight:700;font-weight:600}.um-field-area{position:relative;word-wrap:break-word}.um-field-area-password{position:relative}.um-toggle-password{cursor:pointer;display:block;position:absolute;right:0;top:0;height:100%;width:40px;text-align:center;box-sizing:border-box;font-size:20px;line-height:2}.um-toggle-password i{transition:all .2s linear}.um-toggle-password:hover i{color:#44b0ec}.um-field-value p{margin:0 0 6px 0!important;padding:0}.um-field-block{color:#777;font-size:17px}.um-field-spacing{width:100%}.um-field-divider{width:100%;margin:0 0 12px 0;height:24px;position:relative}.um-field-divider-text{position:absolute;width:100%;text-align:center;bottom:-24px;left:0;font-size:16px;padding:10px 0}.um-field-divider-text span{background:#fff;color:#555;display:inline-block;padding:0 15px}.um-field-icon{position:absolute;cursor:default;text-align:center!important;top:2px;left:0;width:44px;font-size:22px;line-height:1.7em;z-index:1}.um-form input[type=number],.um-form input[type=password],.um-form input[type=search],.um-form input[type=tel],.um-form input[type=text]{padding:0 12px!important;width:100%;display:block!important;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;outline:0!important;cursor:text!important;font-size:15px!important;height:40px!important;box-sizing:border-box!important;box-shadow:none!important;margin:0!important;position:static}.um-form .um-field-area-password input[type=password]{padding-right:40px!important}.um-form input[type=number]{width:auto;padding:0 0 0 5px!important;height:30px!important}.um-form input[type=number]:focus,.um-form input[type=password]:focus,.um-form input[type=search]:focus,.um-form input[type=tel]:focus,.um-form input[type=text]:focus,.um-form textarea:focus{box-shadow:none!important;outline:0!important}.um-form input[type=password].um-iconed,.um-form input[type=tel].um-iconed,.um-form input[type=text].um-iconed{padding-left:44px!important}.um-form input[type=password].um-error,.um-form input[type=tel].um-error,.um-form input[type=text].um-error{border-color:#c74a4a!important}.um-form textarea{width:100%;padding:8px 12px!important;display:block;font-size:15px!important;line-height:22px!important;background:#fff;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;box-sizing:border-box;min-height:80px!important;box-shadow:none;outline:0!important}.um-form .um-meta-text textarea{max-width:100%}.um-form .wp-editor-container{border:1px solid #ddd}.um-form .wp-editor-container textarea{background:#ddd!important;color:#222!important;border-radius:0}.um-field-c .um-field-checkbox{margin-bottom:14px;margin-top:0!important;position:relative}.um-field-checkbox:not(.um-field),.um-field-radio:not(.um-field){display:block;margin:8px 0;position:relative}.um-profile.um-editing .um-field-checkbox,.um-profile.um-editing .um-field-radio{cursor:pointer!important}.um-field-checkbox:hover i,.um-field-radio:hover i{color:#666}.um-field-checkbox input,.um-field-radio input{opacity:0!important;display:inline!important;width:0!important;float:left}.um-field-checkbox-state,.um-field-radio-state{position:absolute;top:0;left:1px;width:24px;height:24px}.um-field-checkbox-state i,.um-field-radio-state i{font-size:24px;line-height:24px;height:24px;color:#aaa;transition:all .2s linear}.um-field-checkbox-option,.um-field-radio-option{margin:0 0 0 36px;line-height:24px;color:#888!important;display:block}.um-field-group{margin-top:20px}.um-field-group-head{cursor:pointer;color:#fff;font-size:16px;line-height:22px;padding:10px 20px;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;border-top:1px solid transparent!important;border-bottom:2px solid rgba(0,0,0,.1)!important}.um-field-group-head i{font-size:20px;margin:0 8px 0 0}.um-field-group-head i:before{vertical-align:middle!important}.um-field-group-body{display:none;margin:15px 0 0 0;padding:15px 20px 5px 20px;background:#f9f9f9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;position:relative;box-sizing:border-box;width:100%}.um-field-group-body div.um-field{padding:0 0 15px 0}.um-field-group-cancel{font-size:18px;position:absolute;z-index:800;right:8px;top:8px;color:#ccc!important;text-decoration:none!important}.um-field-group-cancel:hover{color:#777!important}.um div.disabled,.um input[type=number]:disabled,.um input[type=submit]:disabled,.um input[type=text]:disabled,.um-disabled{opacity:.6!important;cursor:no-drop!important}input[type=submit].um-button,input[type=submit].um-button:focus{vertical-align:middle!important;height:auto!important;font-size:15px;cursor:pointer!important;width:100%;box-shadow:none;text-shadow:none;font-family:inherit;outline:0!important;margin:0;opacity:1;-webkit-appearance:none}input[type=submit].um-button:hover{opacity:1}.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button{font-size:15px;border:none!important;display:block;width:100%;line-height:1em!important;padding:16px 20px!important;text-decoration:none!important;text-align:center;text-transform:none!important;font-weight:400!important;overflow:hidden;position:relative;transition:.25s;box-sizing:border-box;-moz-border-radius:4px!important;-webkit-border-radius:4px!important;border-radius:4px!important;-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);opacity:1}a.um-button:hover{-webkit-box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)}.um-button.um-btn-auto-width{width:auto;display:inline-block;padding:14px 20px!important;min-width:200px;max-width:450px}a.um-link-alt{line-height:22px;color:#888!important;display:block!important;text-decoration:none!important;font-weight:400;text-align:center;border-bottom:none!important}a.um-link-alt:hover{text-decoration:underline!important}.um-dropdown{position:absolute;height:auto;background:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;z-index:55;display:none;border:1px solid #e5e5e5;box-sizing:border-box;-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 1px rgba(0,0,0,.1)}.um-dropdown li,.um-dropdown ul{list-style-type:none!important;padding:0!important;margin:0!important}.um-dropdown ul{background:#fff;position:relative;z-index:16}.um-dropdown li a{display:block;padding:8px 12px;color:#666;font-size:14px;line-height:18px}.um-dropdown li:last-child a{border-top:1px solid #e5e5e5;padding:12px}.um-dropdown-b{position:relative}.um-dropdown-arr{position:absolute;font-size:24px;width:24px;height:24px;overflow:hidden;z-index:15;color:#eee}.um-dropdown-arr *{display:block!important;width:24px!important;height:24px!important;vertical-align:bottom!important;overflow:hidden!important;line-height:24px!important}div.um-photo{margin:20px auto 0 auto;text-align:center;box-sizing:border-box;max-width:100%}div.um-photo,div.um-photo a,div.um-photo img{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}div.um-photo a{border:1px solid #e5e5e5;padding:5px;box-sizing:border-box;display:inline-block;box-shadow:0 1px 1px #eee;margin:0 auto;max-width:100%}div.um-photo img{max-height:300px;max-width:100%}span.um-req{margin:0 0 0 8px;font-size:14px;display:inline-block}small.um-max-filesize{display:block;color:#999;padding-top:5px}small.um-max-filesize span{font-size:12px}.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched,.um-form .um-field .um-field-area input.um-form-field.um-validate-not-matched:focus,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists,.um-form .um-field .um-field-area input.um-form-field.um-validate-username-exists:focus{border-color:#db2929!important}.um-form .um-field .um-field-area input.um-searching-username{background-image:url(../img/loading.gif);background-position:right center;background-repeat:no-repeat;background-size:24px 24px}.um-search-area{position:relative;max-width:300px}.um-search-area .um-search-field{width:100%;margin:0;padding-left:25px}.rtl .um-search-area .um-search-field{padding-right:25px;padding-left:initial}.um-search-area .um-search-icon{position:absolute;height:100%;left:6px;top:0}.rtl .um-search-area .um-search-icon{right:6px;left:initial}.um-faicon-search:before{display:flex;align-items:center;justify-content:center;height:100%}.um-field .select2-container.select2-container--open,.um-search-filter .select2-container.select2-container--open{z-index:9999999}.um-field .select2.select2-container .select2-selection,.um-search-filter .select2.select2-container .select2-selection{display:block!important;height:40px;padding:0 0 0 12px!important;overflow:hidden!important;position:relative!important;white-space:nowrap!important;line-height:35px!important;color:#666!important;font-size:15px!important;-moz-border-radius:2px!important;-webkit-border-radius:2px!important;border-radius:2px!important;background-clip:padding-box!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#fff!important;border:1px solid #ddd!important}.rtl .um-field .select2.select2-container .select2-selection,.rtl .um-search-filter .select2.select2-container .select2-selection{padding:0 12px 0 0!important}.um-field .select2.select2-container .select2-selection .select2-selection__arrow,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{display:inline-block!important;width:34px!important;height:100%!important;position:absolute;right:0;top:0;text-align:center;background:0 0!important;border:none!important}.rtl .um-field .select2.select2-container .select2-selection .select2-selection__arrow,.rtl .um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow{right:initial;left:0}.um-field .select2.select2-container .select2-selection .select2-selection__arrow:before,.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow:before{content:"\f3d0"!important;font-size:28px!important;font-family:Ionicons!important;display:block;height:100%;line-height:40px;min-width:1em;text-align:center;color:#aaa}.um-field .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation],.um-search-filter .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation]{display:none}.um-field .select2-container.select2-container--open .select2-dropdown,.um-search-filter .select2-container.select2-container--open .select2-dropdown{border:1px solid #ddd!important;border-radius:0}.um-field .select2-container.select2-container--open .select2-dropdown .select2-results li,.um-search-filter .select2-container.select2-container--open .select2-dropdown .select2-results li{list-style:none;display:list-item;background:0 0;font-size:15px;margin:5px!important;color:#666!important;padding:3px 7px 4px!important;cursor:pointer;min-height:1em}.um-field .select2.select2-container .select2-selection.select2-selection--multiple,.um-search-filter .select2.select2-container .select2-selection.select2-selection--multiple{height:auto!important;line-height:.8!important;min-height:40px;padding-bottom:4px!important}.um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:37px;padding-left:0;padding-right:24px}.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__rendered{padding-left:24px;padding-right:0}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{line-height:37px;box-sizing:border-box;list-style:none;margin:0;padding-left:0;padding-right:30px;width:100%;font-size:13px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:30px;padding-right:0}.um-field .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted,.um-search-filter .select2-dropdown .select2-results li.select2-results__option.select2-results__option--highlighted{background:#f4f4f4;color:#666}.um-field .select2-dropdown .select2-results li.select2-results__option[aria-selected=true],.um-search-filter .select2-dropdown .select2-results li.select2-results__option[aria-selected=true]{background-color:#ddd}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-field .select2-container--default .select2-selection--single .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{color:#aaa;font-size:28px;font-weight:400;line-height:34px;margin:0!important;right:0;text-align:center;width:1em}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-field .select2-container--default .select2-selection--single .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear,.rtl .um-search-filter .select2-container--default .select2-selection--single .select2-selection__clear{left:0;right:initial}.um-field .select2-container--default .select2-selection--multiple .select2-selection__clear,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__clear{position:absolute}.um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 5px 0 0;max-height:28px;padding:3px 3px 3px 5px}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-selection__choice,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px;padding:3px 5px 3px 3px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 5px 0 0;padding:0}.rtl .um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline,.rtl .um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline{margin:5px 0 0 5px}.um-field .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input,.um-search-filter .select2-container--default .select2-selection--multiple .select2-search.select2-search--inline>input{border:none!important;padding:0!important;max-height:28px}.um-field .select2-container--default .select2-selection--multiple .select2-selection__rendered li,.um-search-filter .select2-container--default .select2-selection--multiple .select2-selection__rendered li{overflow-x:hidden;text-overflow:ellipsis;max-width:100%;box-sizing:border-box;line-height:20px}.um-field-multiselect .um-field-area .um-field-icon,.um-field-select .um-field-area .um-field-icon{z-index:99999999}.um-field-select .um-field-area.um-field-area-has-icon .select2-selection__rendered{text-indent:20px}.um-field-multiselect .um-field-area.um-field-area-has-icon ul:first-child{margin-left:30px!important}.um-field-area .wp-switch-editor{float:none;height:auto} \ No newline at end of file From 6369a3b5d077a6a35420f6fc84f1370515249947 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 16:16:54 +0200 Subject: [PATCH 70/76] - changed texts; - added a few links to docs; --- includes/admin/core/class-admin-settings.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 22bbed5e..2620523c 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2087,8 +2087,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'title' => __( 'Advanced', 'ultimate-member' ), 'sections' => array( '' => array( - 'title' => __( 'General', 'ultimate-member' ), - 'fields' => array( + 'title' => __( 'General', 'ultimate-member' ), + 'description' => sprintf( __( 'Advanced settings section is designed to help you fine-tune your website or add extra features. Learn more about advanced settings section..', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1902-advanced-tab' ), + 'fields' => array( array( 'id' => 'form_asterisk', 'type' => 'checkbox', From 1cb2b9590b1e295d15fd821f79195197fef2354f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 16:29:16 +0200 Subject: [PATCH 71/76] - changed texts; - added a few links to docs; --- includes/admin/core/class-admin-settings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 2620523c..79416452 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1626,7 +1626,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'form_sections' => array( 'template' => array( 'title' => __( 'Template', 'ultimate-member' ), - 'description' => __( 'This section allows you to customize the user profile template and size.', 'ultimate-member' ), + 'description' => sprintf( __( 'This section allows you to customize the user profile template and size. Learn more about custom profile template creation.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/120-adding-your-custom-profile-templates' ), 'fields' => array( array( 'id' => 'profile_template', @@ -2118,7 +2118,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'override_templates' => array( 'title' => __( 'Override templates', 'ultimate-member' ), // translators: %s: Link to the docs article. - 'description' => sprintf( __( 'You can find a list of template file changes with each release. You can check the latest templates and their statuses, and see if they\'re outdated or updated. You may get more details about overriding templates here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), /** @noinspection HtmlUnknownTarget */ + 'description' => sprintf( __( 'You can find a list of template file changes with each release. Learn more about overriding templates.
    You can check the latest templates and their statuses, and see if they\'re outdated or updated. Learn more about fixing outdated templates.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map', 'https://docs.ultimatemember.com/article/1847-fixing-outdated-ultimate-member-templates' ), /** @noinspection HtmlUnknownTarget */ 'fields' => array( array( 'id' => 'override_templates_list_table', From 966aecd320777b0ffeab6f0eeb1d87ace5cd9f9d Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 16:34:17 +0200 Subject: [PATCH 72/76] - changed texts; --- includes/admin/core/class-admin-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 79416452..a9fb1fe7 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2118,7 +2118,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'override_templates' => array( 'title' => __( 'Override templates', 'ultimate-member' ), // translators: %s: Link to the docs article. - 'description' => sprintf( __( 'You can find a list of template file changes with each release. Learn more about overriding templates.
    You can check the latest templates and their statuses, and see if they\'re outdated or updated. Learn more about fixing outdated templates.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map', 'https://docs.ultimatemember.com/article/1847-fixing-outdated-ultimate-member-templates' ), /** @noinspection HtmlUnknownTarget */ + 'description' => sprintf( __( 'Each time we release an update, you\'ll find a list of changes made to the template files. Learn more about overriding templates.
    You can easily check the status of the latest templates to see if they are up-to-date or need updating. Learn more about fixing outdated templates.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map', 'https://docs.ultimatemember.com/article/1847-fixing-outdated-ultimate-member-templates' ), /** @noinspection HtmlUnknownTarget */ 'fields' => array( array( 'id' => 'override_templates_list_table', From 0684f63beb2da393604fcd01abcd43dfd7fb026a Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 16 Feb 2024 16:46:30 +0200 Subject: [PATCH 73/76] - updated versions; --- readme.txt | 5 +++-- ultimate-member.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 60d0c948..4fd3bdd9 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: community, member, membership, user-profile, user-registration Requires PHP: 5.6 Requires at least: 5.5 Tested up to: 6.4 -Stable tag: 2.8.2 +Stable tag: 2.8.3 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -166,10 +166,11 @@ No specific extensions are needed. But we highly recommended keep active these P IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION -= 2.8.3: February 21, 2024 = += 2.8.3: February 19, 2024 = * Enhancements: + - Added: Link to the Ultimate Member docs - Tweak: Ultimate Member > Settings redesign. More details about setting up. Tooltips changed to descriptions. * Bugfixes: diff --git a/ultimate-member.php b/ultimate-member.php index c4edc25a..27887dd6 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.8.3-rc.1 + * Version: 2.8.3 * Author: Ultimate Member * Author URI: http://ultimatemember.com/ * Text Domain: ultimate-member From 718b94ca8e533dc10fe1e3eb8574f439c9f9750f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 19 Feb 2024 10:50:10 +0200 Subject: [PATCH 74/76] - update script $handler; --- includes/admin/class-enqueue.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index c92dda07..5623c9e4 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -585,9 +585,9 @@ final class Enqueue extends \um\common\Enqueue { } elseif ( 'ultimate-member_page_um_options' === $hook ) { // phpcs:ignore WordPress.Security.NonceVerification if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'security' === $_GET['section'] ) { - wp_register_script( 'um_admin_secure', $js_url . 'admin/security' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true ); - wp_set_script_translations( 'um_admin_secure', 'ultimate-member' ); - wp_enqueue_script( 'um_admin_secure' ); + wp_register_script( 'um_admin_security', $js_url . 'admin/security' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true ); + wp_set_script_translations( 'um_admin_security', 'ultimate-member' ); + wp_enqueue_script( 'um_admin_security' ); } // phpcs:ignore WordPress.Security.NonceVerification From 6a604e6821d87169ce173e2ccb0c87e62d411f0f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Mon, 19 Feb 2024 11:21:33 +0200 Subject: [PATCH 75/76] - fixed issue with errors detection in license response; --- includes/admin/core/class-admin-notices.php | 24 ++++++++----- includes/admin/core/class-admin-settings.php | 37 +++++++++++++++----- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 7e93f21c..8ea72173 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -576,9 +576,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } } - - function check_wrong_licenses() { - $invalid_license = 0; + public function check_wrong_licenses() { + $invalid_license = 0; $arr_inactive_license_keys = array(); if ( empty( UM()->admin_settings()->settings_structure['licenses']['fields'] ) ) { @@ -588,10 +587,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { foreach ( UM()->admin_settings()->settings_structure['licenses']['fields'] as $field_data ) { $license = get_option( "{$field_data['id']}_edd_answer" ); - if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) + if ( ( is_object( $license ) && isset( $license->license ) && 'valid' === $license->license ) || 'valid' === $license ) { continue; + } - if ( ( is_object( $license ) && 'inactive' == $license->license ) || 'inactive' == $license ) { + if ( ( is_object( $license ) && isset( $license->license ) && 'inactive' === $license->license ) || 'inactive' === $license ) { $arr_inactive_license_keys[] = $license->item_name; } @@ -603,7 +603,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { 'license_key', array( 'class' => 'error', - // translators: %1$s is a inactive license number; %2$s is a plugin name; %3$s is a store link. + // translators: %1$s is an inactive license number; %2$s is a plugin name; %3$s is a store link. 'message' => '

    ' . sprintf( __( 'There are %1$s inactive %2$s license keys for this site. This site is not authorized to get plugin updates. You can active this site on www.ultimatemember.com.', 'ultimate-member' ), count( $arr_inactive_license_keys ), UM_PLUGIN_NAME, UM()->store_url ) . '

    ', ), 3 @@ -611,12 +611,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } if ( $invalid_license ) { + $licenses_page_url = add_query_arg( + array( + 'page' => 'um_options', + 'tab' => 'licenses', + ), + admin_url( 'admin.php' ) + ); + $this->add_notice( 'license_key', array( 'class' => 'error', - // translators: %1$s is a invalid license; %2$s is a plugin name; %3$s is a license link. - 'message' => '

    ' . sprintf( __( 'You have %1$s invalid or expired license keys for %2$s. Please go to the Licenses page to correct this issue.', 'ultimate-member' ), $invalid_license, UM_PLUGIN_NAME, add_query_arg( array( 'page' => 'um_options', 'tab' => 'licenses' ), admin_url( 'admin.php' ) ) ) . '

    ', + // translators: %1$s is an invalid license; %2$s is a plugin name; %3$s is a license link. + 'message' => '

    ' . sprintf( __( 'You have %1$s invalid or expired license keys for %2$s. Please go to the Licenses page to correct this issue.', 'ultimate-member' ), $invalid_license, UM_PLUGIN_NAME, $licenses_page_url ) . '

    ', ), 3 ); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index a9fb1fe7..01d3799f 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1,6 +1,8 @@ options()->get( $field_data['id'] ); - $value = isset( $option_value ) && ! empty( $option_value ) ? $option_value : ( isset( $field_data['default'] ) ? $field_data['default'] : '' ); + $option_value = UM()->options()->get( $field_data['id'] ); + $default_value = isset( $field_data['default'] ) ? $field_data['default'] : ''; + $value = ! empty( $option_value ) ? $option_value : $default_value; $license = get_option( "{$field_data['id']}_edd_answer" ); if ( is_object( $license ) && ! empty( $value ) ) { - // activate_license 'invalid' on anything other than valid, so if there was an error capture it - if ( empty( $license->success ) ) { + // Activate_license 'invalid' on anything other than valid, so if there was an error capture it + if ( is_wp_error( $license ) ) { + $class = 'error'; + $errors_data = array(); + $error_codes = $license->get_error_codes(); + if ( ! empty( $error_codes ) ) { + foreach ( $error_codes as $error_code ) { + // translators: %1$s is an error code; %2$s is an error message. + $errors_data[] = sprintf( __( 'code: %1$s, message: %2$s;', 'ultimate-member' ), $error_code, $license->get_error_messages( $error_code ) ); + } + } + $errors_data = ! empty( $errors_data ) ? implode( ' ', $errors_data ) : ''; + + // translators: %1$s is an error data; %2$s is a support link. + $messages[] = sprintf( __( 'There was an error with this license key: %1$s. Please contact our support team.', 'ultimate-member' ), $errors_data, 'https://ultimatemember.com/support' ); + + $license_status = 'license-' . $class . '-notice'; + } elseif ( empty( $license->success ) ) { if ( ! empty( $license->error ) ) { switch ( $license->error ) { @@ -3102,7 +3121,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $messages[] = sprintf( // translators: %1$s is an expiry date; %2$s is a renewal link. __( 'Your license key expired on %1$s. Please renew your license key.', 'ultimate-member' ), - wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ), + wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new DateTimeZone( 'UTC' ) ), 'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' ); @@ -3197,7 +3216,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $messages[] = sprintf( // translators: %1$s is a expiry date; %2$s is a renew link. __( 'Your license key expired on %1$s. Please renew your license key.', 'ultimate-member' ), - wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ), + wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new DateTimeZone( 'UTC' ) ), 'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' ); @@ -3273,7 +3292,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $messages[] = sprintf( // translators: %1$s is an expiry date; %2$s is a renewal link. __( 'Your license key expires soon! It expires on %1$s. Renew your license key.', 'ultimate-member' ), - wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ), + wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new DateTimeZone( 'UTC' ) ), 'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' ); @@ -3284,7 +3303,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $messages[] = sprintf( // translators: %s: expiry date. __( 'Your license key expires on %s.', 'ultimate-member' ), - wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ) + wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new DateTimeZone( 'UTC' ) ) ); $license_status = 'license-expiration-date-notice'; @@ -3323,7 +3342,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { license ) || 'valid' === $license ) ) { + if ( ! empty( $value ) && ( ( is_object( $license ) && isset( $license->license ) && 'valid' === $license->license ) || 'valid' === $license ) ) { ?> Date: Mon, 19 Feb 2024 11:42:09 +0200 Subject: [PATCH 76/76] - fixed texts; --- includes/admin/core/class-admin-settings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 01d3799f..6b03f1e2 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2090,7 +2090,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'sections' => array( '' => array( 'title' => __( 'General', 'ultimate-member' ), - 'description' => sprintf( __( 'Advanced settings section is designed to help you fine-tune your website or add extra features. Learn more about advanced settings section..', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1902-advanced-tab' ), + 'description' => sprintf( __( 'Advanced settings section is designed to help you fine-tune your website or add extra features. Learn more about advanced settings section.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1902-advanced-tab' ), 'fields' => array( array( 'id' => 'form_asterisk', @@ -2207,7 +2207,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'id' => 'rest_api_version', 'type' => 'select', - 'label' => __( 'Version', 'ultimate-member' ), + 'label' => __( 'REST API Version', 'ultimate-member' ), 'description' => __( 'This controls the REST API version, we recommend to use the last version.', 'ultimate-member' ), 'options' => array( '1.0' => __( '1.0 version', 'ultimate-member' ), @@ -2233,7 +2233,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), - 'install_info' => array( + 'system_info' => array( 'title' => __( 'System info', 'ultimate-member' ), 'link' => add_query_arg( array( 'tab' => 'debug' ), admin_url( 'site-health.php' ) ), ),
    Extend UM core pages.Skip filter by rating default handler and add 3rd-party handlers in callback.Extend UM core pages.Set Ultimate Member predefined pages content with key = 'my_page_key'.Set Ultimate Member predefined pages content with key = 'my_page_key'.
    - +