From ff0b90f29e259c527c43bcfc9d58d3777ff104cc Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 14 Feb 2024 16:17:20 +0200 Subject: [PATCH] - 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' ) ); - ?> -

- -