Also while you are in there I am having an issue hiding custom menus based on role. Here is my code and the issue is no matter what i put for the slug I want to hide it works but it also stops the other custom tabs from working it says looks like this page doesnt exists:
function bpfr_hide_activity_nav() {
$user_id = get_current_user_id();
$user = wp_get_current_user();
if ( $user_id == in_array( ‘editor’, $user->roles ) or in_array( ‘customer’, $user->roles ) ) {bp_core_remove_nav_item( ‘1-3’ );
}
return;
}add_action( ‘bp_ready’, ‘bpfr_hide_activity_nav’, 110, 3 );
instead of just hiding 1-3 it also prevents users from accessing casting-get-started which does not make any sense as it’s not included there.
Hi Ethan,
Thank you.1. I was able to login to your site but the bp-custom.php is not a plugin file and not editable/viewable from the dashboard. Please provide me temporary ftp access for an hour too.
2. The code you are using is removing a nav item. Can you please provide me an example tab to remove. I can update that on your site.
Thank you
BrajeshFor example, need to hide the user menu tab slugged 1-2 or getting started.
Hi Ethan,
Thank you.1. Your registration issue is fixed. There was an issue with the BuddyPress Auto Activate plugin. The hook was getting called too early and bp-custom.php code had no effect on it.
2. I will be taking a look at the tab later today and update you.
Regards
BrajeshHi Ethan,
Sorry, I tested it on your site but could not reply here.You are unable to remove the tab as the tab has numeric slug (‘1-3’) and the nav removal function has a bug with numeric slug.
If you use any other slug(e.. groups), that gets removed.
Since you are registering the tab via code, i will suggest using a non numeric slug e.g ‘info’, ‘getting-started’ or anything on that line.
PS:- I have put the updated code in your bp-custom.php, please feel free to update as you need.
Regards
BrajeshIf you login as a test user for example ethanfiggs you will see the code i put it ends up blocking more then the pages described but all the custom bp profile tabs made for some reason
Hi Ethan,
Where can I see the code? Is it in bp-custom.php?Regards
Brajesh
You must be logged in to reply to this topic.