Reply To: How to hide section of profile to all but that user and admin?
Thanks for the reply. I made some changes to the code before reading and was able to accomplish removing the tab from buddypress profiles with this:
function hide_achievements_from_users() {
global $bp;
if ((bp_loggedin_user_id() == bp_displayed_user_id()) || (current_user_can('administrator'))){
return;
}
bp_core_remove_nav_item('achievements');
}
add_action( 'bp_setup_nav', 'hide_achievements_from_users', 99 );
However I’m stuck on how to 404 the pages if they manually type out the URL
In your code I see:
// I guess we should 404 this page because this member isn't an admin or the displayed member.
$wp_query->set_404();
status_header( 404 );
nocache_headers();
How do I get this to apply only when it is http://mysite.com/members/<username>/achievements?