Hi!
I’ve been trying unsuccessfully with the following code:
-Hide USER-MEDIA and WALL tabs for the role Subscriber and customer. (this code hiden in all profiles)
and how do I hide the tab GROUP only in customer, do I duplicate the action?-Redirect to custom page when Im not logged when i see the page of subscriber´s profiles
Thank you very much!!
regards,
Jenniferfunction bpfr_hide_activity_nav() { $user_id = get_current_user_id(); $user = wp_get_current_user(); if ( $user_id == in_array( 'subscriber', $user->roles ) or in_array( 'customer', $user->roles ) ) { bp_core_remove_nav_item( 'user-media' ); bp_core_remove_nav_item( 'wall' ); } return; } add_action( 'bp_ready', 'bpfr_hide_activity_nav', 110, 3 ); function buddy_private( $redirect_to, $redirect_url_specified, $user ) { $user_id = get_current_user_id(); if ( ! is_user_logged_in() && ( ( $user_id == in_array( 'subscriber', $user->roles ) or in_array( 'customer', $user->roles ) ) ) ) { $redirect_to = 'https://example.com/'; } return $redirect_to; } add_filter( 'login_redirect', 'buddy_private', 110, 3 );
- This topic was modified 5 years, 1 month ago by Brajesh Singh. Reason: Removed url as requested
Hi Jennifer,
for the part 1(wall,user media), The code should work. If it is not, I will suggest reprting/asking to the plugin developers.For the second part(custom redirect).
You may use the following code
function bpc_redirect_for_no_logged() { if ( bp_is_user() && ! is_user_logged_in() ) { $redirect_url = site_url( '/' );// change it. bp_core_redirect( $redirect_url ); } } add_action( 'bp_template_redirect', 'bpc_redirect_for_no_logged');
Please make sure to change the redirect url.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Hide tabs and profile for custom roles’ is closed to new replies.
This topic is: resolved