Skip to content

Instantly share code, notes, and snippets.

@JohnTendik
Last active October 16, 2019 04:26
Show Gist options
  • Save JohnTendik/d1162eaec9b1483b16b80a0824516e70 to your computer and use it in GitHub Desktop.
Save JohnTendik/d1162eaec9b1483b16b80a0824516e70 to your computer and use it in GitHub Desktop.
Quick snippet to hide certain tabs from the youzer community profile section
<?php
if (!function_exists('hide_youzer_tabs')) {
// Filter
add_filter('yz_profile_primary_nav', 'hide_youzer_tabs', 10, 2);
function hide_youzer_tabs($tabs) {
// Make sure we dont remove the tabs in the admin back end pages
if (is_admin()) {
return $tabs;
}
// Loop through the available tabs
foreach ($tabs as $key => $tab) {
$name = $tab['name']; // Name of the tab
if ($name == 'Points' || $name == 'Info' || $name == 'Overview') {
if (bp_displayed_user_id() !== get_current_user_id()) {
// If tab is Points, Info or Overview and the current user is not viewing own profile, remove the tabs from the menu
unset($tabs[$key]);
}
}
}
return $tabs;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment