- code formatting;

This commit is contained in:
nikitasinelnikov
2018-12-07 15:07:50 +02:00
parent 939c57d1a3
commit 3383c69e2d
3 changed files with 42 additions and 41 deletions
+38 -36
View File
@@ -123,44 +123,43 @@ 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' => __('Enable profile menu','ultimate-member'),
)
);
$tabs = UM()->profile()->tabs_primary();
foreach( $tabs as $id => $tab ) {
foreach ( $tabs as $id => $tab ) {
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
array(
'id' => 'profile_tab_' . $id,
'type' => 'checkbox',
'label' => sprintf(__('%s Tab','ultimate-member'), $tab ),
'conditional' => array( 'profile_menu', '=', 1 ),
'id' => 'profile_tab_' . $id,
'type' => 'checkbox',
'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab ),
'conditional' => array( 'profile_menu', '=', 1 ),
),
array(
'id' => 'profile_tab_' . $id . '_privacy',
'type' => 'select',
'label' => sprintf( __( 'Who can see %s Tab?','ultimate-member' ), $tab ),
'tooltip' => __( 'Select which users can view this tab.','ultimate-member' ),
'options' => UM()->profile()->tabs_privacy(),
'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
'id' => 'profile_tab_' . $id . '_privacy',
'type' => 'select',
'label' => sprintf( __( 'Who can see %s Tab?', 'ultimate-member' ), $tab ),
'tooltip' => __( 'Select which users can view this tab.', 'ultimate-member' ),
'options' => UM()->profile()->tabs_privacy(),
'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
'size' => 'small'
),
array(
'id' => 'profile_tab_' . $id . '_roles',
'type' => 'select',
'id' => 'profile_tab_' . $id . '_roles',
'type' => 'select',
'multi' => true,
'label' => __( 'Allowed roles','ultimate-member' ),
'tooltip' => __( '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', '=', 4 ),
'label' => __( 'Allowed roles','ultimate-member' ),
'tooltip' => __( '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', '=', 4 ),
'size' => 'small'
)
) );
@@ -168,19 +167,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
array(
'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' ),
'options' => UM()->profile()->tabs_enabled(),
'conditional' => array( 'profile_menu', '=', 1 ),
'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' ),
'options' => UM()->profile()->tabs_enabled(),
'conditional' => array( 'profile_menu', '=', 1 ),
'size' => 'small'
),
array(
'id' => 'profile_menu_icons',
'type' => 'checkbox',
'label' => __('Enable menu icons in desktop view','ultimate-member'),
'conditional' => array( 'profile_menu', '=', 1 ),
'id' => 'profile_menu_icons',
'type' => 'checkbox',
'label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ),
'conditional' => array( 'profile_menu', '=', 1 ),
)
) );
@@ -190,15 +189,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$exclude_taxonomies = UM()->excluded_taxonomies();
foreach ( $all_taxonomies as $key => $taxonomy ) {
if( in_array( $key , $exclude_taxonomies ) )
unset( $all_taxonomies[$key] );
if( in_array( $key , $exclude_taxonomies ) ) {
unset( $all_taxonomies[ $key ] );
}
}
$restricted_access_post_metabox_value = array();
if ( $restricted_access_post_metabox = UM()->options()->get( 'restricted_access_post_metabox' ) ) {
foreach ( $restricted_access_post_metabox as $key => $value ) {
if ( $value )
if ( $value ) {
$restricted_access_post_metabox_value[] = $key;
}
}
}
@@ -206,8 +207,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$restricted_access_taxonomy_metabox_value = array();
if ( $restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' ) ) {
foreach ( $restricted_access_taxonomy_metabox as $key => $value ) {
if ( $value )
if ( $value ) {
$restricted_access_taxonomy_metabox_value[] = $key;
}
}
}
+4 -4
View File
@@ -184,14 +184,14 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
*/
function tabs_enabled() {
$tabs = $this->tabs();
foreach( $tabs as $id => $info ){
foreach ( $tabs as $id => $info ) {
if ( isset( $info['name'] ) ) {
if ( UM()->options()->get('profile_tab_'.$id) || isset( $info['_builtin'] ) ) {
$primary[$id] = $info['name'];
if ( UM()->options()->get( 'profile_tab_' . $id ) || isset( $info['_builtin'] ) ) {
$primary[ $id ] = $info['name'];
}
}
}
return ( isset( $primary ) ) ? $primary : '';
return isset( $primary ) ? $primary : '';
}
-1
View File
@@ -360,7 +360,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
} else {
//$user_in_url = sanitize_title( $user_in_url );
$user_in_url = urlencode( $user_in_url );
}