Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove single profile group tabs from edit profile page, fixes #205 #206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions engine/includes/buddypress-cbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,19 @@ function is_activity_page() {
return ( bp_is_activity_component() && !bp_is_user() );
}
}

/**
* Remove profile group tab from edit profile page if there's only one profile group.
* A lone button reading "Base" that does nothing (refreshes the current page) is confusing
* to users and useless.
*
* @since 1.0.7
*/
function cbox_remove_extranneous_profile_group_tabs($tabs, $groups) {
if ( count( $groups ) > 1 ) {
return $tabs;
} else {
return;
}
}
add_filter( 'xprofile_filter_profile_group_tabs', 'cbox_remove_extranneous_profile_group_tabs' );
10 changes: 7 additions & 3 deletions members/single/profile/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@

<h4><?php printf( __( "Editing '%s' Profile Group", "buddypress" ), bp_get_the_profile_group_name() ); ?></h4>

<ul class="button-nav">
<?php if ( bp_profile_group_tabs() ): ?>

<?php bp_profile_group_tabs(); ?>
<ul class="button-nav">

</ul>
<?php bp_profile_group_tabs(); ?>

</ul>

<?php endif; ?>

<div class="clear"></div>

Expand Down