Hide profile field
You have to ask 1000 and 1 times!
You have to modify the profile loop (/members/single/profile/profile-loop.php)
Change this line:
while ( bp_profile_fields() ) : bp_the_profile_field();
while ( bp_profile_fields() ) : bp_the_profile_field(); if ( bp_get_the_profile_field_id() != 'ID # YOU WANT TO SKIP' ) :
then change the corresponding endwhile; line to:
That’s one way of doing it.
Tested just now, works for me.
You need to use the profile id #.
Go to your profile field setup and check the ID by putting your mouse over the “Edit” field. The ID # is field_id.
For example, “Name” is 1.
Either that or go to your DB and manually look up the profile field id in the wp_bp_xprofile_fields table.
You can also use any profile template tag and do your conditional.
If you wanted to use the profile name, use bp_get_the_profile_field_name() instead.
Get your list of ‘hidden’ field ids, add them to an array, and modify your if clause above to test whether the current id is in the array.
This is one for you to look up in the PHP books.
I found this thread and it looks like exactly what I need to stop users real names from displaying in there profile. the problem is I cannot find the file /members/single/profile/profile-loop.php
can someone point me in the right direction. is it in buddypress pluggin or in wordpress main files?
I have got this sorted out with buddypress profile privacy pluggin
Perfect!!!!!!!!!!!!!!!! thankyou verymuch “R-a-Y” for this solution ,and also thanks to “ANTON” to start this topic.
I can find the above function under the legacy branch of code base, but what is the BuddyPress 1.8 equivalent?
this is great help… but how do we do this with the s2member fields when we have s2member set to integrate with buddypress profiles???
Hello to everyone. Sorry If I reup this topic.
I try the method @r-a-y suggests in file edit.php (not in /profile-loop.php) and it worked just fine.
The problem is that I wanted that normal users cannot edit but admins can.
So I think that the easiest way is with user_id (the alternative would be using wp_meta, the role and wp_capabiliets I think?
So I have to put something like that
while ( bp_profile_fields() ) : bp_the_profile_field(); if ( get_current_user_id()=#ADMIN ID OR bp_get_the_profile_field_id() != 'ID # YOU WANT TO SKIP' ) :
Am i right?
Thanks for the anwser
You must be logged in to reply to this topic.