Do ypu want to hide it via CSS or only trough PHP?
re the php approach:
Do you know how to use apply_filters ?
If so, see this:
`
$tabs = apply_filters( ‘xprofile_filter_profile_group_tabs’, $tabs, $groups, $group_name );`
in bp_profile_group_tabs() in /bp-xprofile/ -> bp-xprofile-template.php
It’s been a while since my original post, but I think I’ve figured this out and I hope this helps someone else. The original problem changed a bit too. Basically, now I want to show a profile group based on the value in an xprofile field (when editing a profile). So, if my User Category field for a logged in user says Recruiter, then I want to show the profile group called “Recruiter” (show this for admins too). Otherwise, I want to hide this profile group through php.
Thanks to the hint above, I was able to come up with a function in my child theme’s function.php file.
I’m just learning php/wordpress, and I don’t have a clear understanding why this works. I do know that $group_name[3] is the Recruiter profile group. Also, I do realize this snippet uses awful coding practices. If anyone has improvements, please let me know.
function my_recruit($group_name){
if ( is_site_admin() || xprofile_get_field_data( “User Category”)===”Recruiter”) {
echo $group_name[0];
echo $group_name[1];
echo $group_name[2];
echo $group_name[3];
}
else {
echo $group_name[0];
echo $group_name[1];
echo $group_name[2];
}
}
add_filter(‘xprofile_filter_profile_group_tabs’,’my_recruit’);
@haughtam Sort of off topic, but how did you hide the profile group when it’s being viewed? I have a profile group that I want to be shown when editing, but hidden when viewed (because the info is being called elsewhere). Thanks!
@haughtam just wanted to say thanks for that little bit of code up there.