From 22585ec184892cd8a884a567e1da1d5e6d484941 Mon Sep 17 00:00:00 2001 From: yura_nalivaiko Date: Mon, 26 Feb 2018 12:54:41 +0200 Subject: [PATCH] - changed code for account tabs; --- includes/core/class-account.php | 49 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/includes/core/class-account.php b/includes/core/class-account.php index 3268fc09..72819848 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -32,7 +32,33 @@ if ( ! class_exists( 'Account' ) ) { * @param $args */ function init_tabs( $args ) { + $this->tabs = $this->get_tabs(); + ksort( $this->tabs ); + + $tabs_structed = array(); + foreach ( $this->tabs as $k => $arr ) { + + foreach ( $arr as $id => $info ) { + + if ( ! empty( $args['tab'] ) && $id != $args['tab'] ) + continue; + + $output = $this->get_tab_fields( $id, $args ); + + if ( ! empty( $output ) ) + $tabs_structed[$id] = $info; + + } + + } + + $this->tabs = $tabs_structed; + } + + + function get_tabs() { + $tabs = array(); $tabs[100]['general'] = array( 'icon' => 'um-faicon-user', 'title' => __( 'Account', 'ultimate-member' ), @@ -68,28 +94,7 @@ if ( ! class_exists( 'Account' ) ) { } - $this->tabs = apply_filters( 'um_account_page_default_tabs_hook', $tabs ); - - ksort( $this->tabs ); - - $tabs_structed = array(); - foreach ( $this->tabs as $k => $arr ) { - - foreach ( $arr as $id => $info ) { - - if ( ! empty( $args['tab'] ) && $id != $args['tab'] ) - continue; - - $output = $this->get_tab_fields( $id, $args ); - - if ( ! empty( $output ) ) - $tabs_structed[$id] = $info; - - } - - } - - $this->tabs = $tabs_structed; + return apply_filters( 'um_account_page_default_tabs_hook', $tabs ); }