- fixed profile tabs nav bar visibility;

This commit is contained in:
nikitasinelnikov
2019-07-16 15:14:58 +03:00
parent d95001359c
commit e76e416ae9
4 changed files with 581 additions and 534 deletions
+1
View File
@@ -220,6 +220,7 @@ if ( ! class_exists( 'um\Config' ) ) {
'_um_profile_align' => 'center',
'_um_profile_icons' => 'label',
'_um_profile_cover_enabled' => 1,
'_um_profile_disable_photo_upload' => 0,
'_um_profile_cover_ratio' => '2.7:1',
'_um_profile_photosize' => '190px',
'_um_profile_photocorner' => '1',
+93 -81
View File
@@ -729,7 +729,8 @@ function um_profile_header( $args ) {
// Switch on/off the profile photo uploader
$disable_photo_uploader = empty( $args['use_custom_settings'] ) ? UM()->options()->get( 'disable_profile_photo_upload' ) : $args['disable_photo_upload'];
if ( $disable_photo_uploader ) {
if ( ! empty( $disable_photo_uploader ) ) {
$args['disable_photo_upload'] = 1;
$overlay = '';
} else {
@@ -771,7 +772,7 @@ function um_profile_header( $args ) {
<a href="<?php echo um_user_profile_url(); ?>" class="um-profile-photo-img"
title="<?php echo um_user( 'display_name' ); ?>"><?php echo $overlay . get_avatar( um_user( 'ID' ), $default_size ); ?></a>
<?php if ( ! $disable_photo_uploader && empty( UM()->user()->cannot_edit ) ) {
<?php if ( empty( $disable_photo_uploader ) && empty( UM()->user()->cannot_edit ) ) {
UM()->fields()->add_hidden_field( 'profile_photo' );
@@ -1360,110 +1361,121 @@ function um_profile_menu( $args ) {
// Move default tab priority
$default_tab = UM()->options()->get( 'profile_menu_default_tab' );
$dtab = ( isset( $tabs[ $default_tab ] ) ) ? $tabs[ $default_tab ] : 'main';
if ( isset( $tabs[ $default_tab] ) ) {
if ( isset( $tabs[ $default_tab ] ) ) {
unset( $tabs[ $default_tab ] );
$dtabs[ $default_tab ] = $dtab;
$tabs = $dtabs + $tabs;
} ?>
}
<div class="um-profile-nav">
$tabs_in_nav = array_filter( $tabs, function( $item ) {
if ( ! empty( $item['hidden'] ) ) {
return false;
}
return true;
});
<?php foreach ( $tabs as $id => $tab ) {
if ( ! empty( $tabs_in_nav ) ) { ?>
if ( isset( $tab['hidden'] ) ) {
continue;
}
<div class="um-profile-nav">
$nav_link = UM()->permalinks()->get_current_url( get_option( 'permalink_structure' ) );
$nav_link = remove_query_arg( 'um_action', $nav_link );
$nav_link = remove_query_arg( 'subnav', $nav_link );
$nav_link = add_query_arg( 'profiletab', $id, $nav_link );
<?php foreach ( $tabs as $id => $tab ) {
/**
* UM hook
*
* @type filter
* @title um_profile_menu_link_{$id}
* @description Change profile menu link by tab $id
* @input_vars
* [{"var":"$nav_link","type":"string","desc":"Profile Tab Link"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_profile_menu_link_{$id}', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_profile_menu_link_{$id}', 'my_profile_menu_link', 10, 1 );
* function my_profile_menu_link( $nav_link ) {
* // your code here
* return $nav_link;
* }
* ?>
*/
$nav_link = apply_filters( "um_profile_menu_link_{$id}", $nav_link );
if ( isset( $tab['hidden'] ) ) {
continue;
}
$profile_nav_class = '';
if ( ! UM()->options()->get( 'profile_menu_icons' ) ) {
$profile_nav_class .= ' without-icon';
}
$nav_link = UM()->permalinks()->get_current_url( get_option( 'permalink_structure' ) );
$nav_link = remove_query_arg( 'um_action', $nav_link );
$nav_link = remove_query_arg( 'subnav', $nav_link );
$nav_link = add_query_arg( 'profiletab', $id, $nav_link );
if ( $id == $active_tab ) {
$profile_nav_class .= ' active';
} ?>
/**
* UM hook
*
* @type filter
* @title um_profile_menu_link_{$id}
* @description Change profile menu link by tab $id
* @input_vars
* [{"var":"$nav_link","type":"string","desc":"Profile Tab Link"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_profile_menu_link_{$id}', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_profile_menu_link_{$id}', 'my_profile_menu_link', 10, 1 );
* function my_profile_menu_link( $nav_link ) {
* // your code here
* return $nav_link;
* }
* ?>
*/
$nav_link = apply_filters( "um_profile_menu_link_{$id}", $nav_link );
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
$profile_nav_class = '';
if ( ! UM()->options()->get( 'profile_menu_icons' ) ) {
$profile_nav_class .= ' without-icon';
}
<i class="<?php echo $tab['icon']; ?>"></i>
if ( $id == $active_tab ) {
$profile_nav_class .= ' active';
} ?>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
<span class="uimob800-hide uimob500-hide uimob340-hide title"><?php echo $tab['name']; ?></span>
</a>
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>">
<i class="<?php echo $tab['icon']; ?>"></i>
<i class="<?php echo $tab['icon']; ?>"></i>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<span class="uimob800-hide uimob500-hide uimob340-hide title"><?php echo $tab['name']; ?></span>
</a>
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>">
<span class="title"><?php echo $tab['name']; ?></span>
</a>
<?php } else { ?>
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
<i class="<?php echo $tab['icon']; ?>"></i>
<i class="<?php echo $tab['icon']; ?>"></i>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?>
</a>
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>">
<span class="title"><?php echo $tab['name']; ?></span>
</a>
<?php } else { ?>
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
<span class="um-tab-notifier"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<i class="<?php echo $tab['icon']; ?>"></i>
<span class="title"><?php echo $tab['name']; ?></span>
</a>
<?php } ?>
</div>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?>
</a>
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>">
<?php } ?>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
<span class="um-tab-notifier"><?php echo $tab['notifier']; ?></span>
<?php } ?>
<div class="um-clear"></div>
<span class="title"><?php echo $tab['name']; ?></span>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
<?php foreach ( $tabs as $id => $tab ) {
<div class="um-clear"></div>
</div>
<?php }
foreach ( $tabs as $id => $tab ) {
if ( isset( $tab['subnav'] ) && $active_tab == $id ) {
File diff suppressed because it is too large Load Diff
+1
View File
@@ -140,6 +140,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
= 2.0.53: July 16, 2019 =
* Enhancements:
- Added option to disable profile avatar uploader
- Moved extensions icons to core
* Bugfixes: