mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Improve subnav link class handling in user profiles
Refactor the subnav link class generation to use an array-based approach. This ensures better flexibility and readability while adding the "active" class conditionally when needed.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
- Added: Extra condition for checking the license activation requests.
|
||||
- Added: 2nd `$args` attribute to the action hook 'um_cover_area_content'.
|
||||
- Added: Class `um-profile-subnav-{$subnav_id}-link` to the sub navigation links in the User Profile page.
|
||||
- Tweak: Updated `Extensions_Updater` class to use Action Scheduler in the upgrade process of the UM extensions.
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
@@ -1856,9 +1856,15 @@ function um_profile_menu( $args ) {
|
||||
<?php foreach ( $tab['subnav'] as $id_s => $subtab ) {
|
||||
|
||||
$subnav_link = add_query_arg( 'subnav', $id_s );
|
||||
$subnav_link = apply_filters( 'um_user_profile_subnav_link', $subnav_link, $id_s, $subtab ); ?>
|
||||
$subnav_link = apply_filters( 'um_user_profile_subnav_link', $subnav_link, $id_s, $subtab );
|
||||
|
||||
<a href="<?php echo esc_url( $subnav_link ); ?>" class="<?php echo $active_subnav == $id_s ? 'active' : ''; ?>">
|
||||
$subnav_classes = array( 'um-profile-subnav-' . $id_s . '-link' );
|
||||
if ( $active_subnav === $id_s ) {
|
||||
$subnav_classes[] = 'active';
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo esc_url( $subnav_link ); ?>" class="<?php echo esc_attr( implode( ' ', $subnav_classes ) ); ?>">
|
||||
<?php echo $subtab; ?>
|
||||
</a>
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI
|
||||
|
||||
* Added: Extra condition for checking the license activation requests.
|
||||
* Added: 2nd `$args` attribute to the action hook 'um_cover_area_content'.
|
||||
* Added: Class `um-profile-subnav-{$subnav_id}-link` to the sub navigation links in the User Profile page.
|
||||
* Tweak: Updated `Extensions_Updater` class to use Action Scheduler in the upgrade process of the UM extensions.
|
||||
|
||||
**Bugfixes**
|
||||
|
||||
Reference in New Issue
Block a user