These tabs are hardcoded into the theme template. So you have two options:
1. Override the theme template in your own theme (copy /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/index.php
to /wp-content/themes/[your-theme]/buddypress/activity/index.php
, open the copied template, and remove the tabs you don’t want.
2. Hide with CSS. Eg
body.activity.directory #activity-friends {
display: none;
}
Hello Gorges
And thank you 🙂
In fact, I want to hide these tabs to everyone except for a wordpress role and the super admin
It works (a priori) but do not hesitate to suggest an improvement.
I am not sure of my code!
Regards
add_action('wp_head', 'HD_maj_activite');
function HD_maj_activite() {
$bp_loggedin_user_id = bp_loggedin_user_id();
$user_info = get_userdata($bp_loggedin_user_id);
$user_roles = $user_info->roles;
if (is_super_admin() || in_array('membre2', $user_roles))
return ;
$output .= '<style type="text/css">body.activity.directory #activity-friends {display: none;}</style>';
$output .= '<style type="text/css">body.activity.directory #activity-groups {display: none;}</style>';
echo $output; //
}
Hello,
Ah, I have error messages. but I do not see how to correct!
04-Dec-2017 09:42:49 UTC] PHP Notice: Trying to get property of non-object in /home/../wp-content/themes/woffice-am/bp-am/bp-membres.php on line 7
=> $user_roles = $user_info->roles;
[04-Dec-2017 09:42:49 UTC] PHP Warning: in_array() expects parameter 2 to be array, null given in /../wp-content/themes/woffice-am/bp-am/bp-membres.php on line 8
=> if (is_super_admin() || in_array('membre2', $user_roles))
[04-Dec-2017 09:42:49 UTC] PHP Notice: Undefined variable: output in /home/../wp-content/themes/woffice-am/bp-am/bp-membres.php on line 10
=> $output .= '<style type="text/css">body.activity.directory #activity-friends {display: none;}</style>';
Hello,
Still unresolved.
If anyone can help me solve it
Have a good day