Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide profile field


  • Anton
    Participant

    @antonrsa

    Is there a way to hide a certain profile field? I have a date of birth field that I use but I don’t want it to be visible to other members.

Viewing 17 replies - 1 through 17 (of 17 total)

  • nickmy
    Participant

    @nickmy

    I asked 1000 times how to hide special profile fields :P no answer @r-a-y @djpaul @hnla????


    r-a-y
    Keymaster

    @r-a-y

    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();

    to:
    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:
    endif; endwhile;

    That’s one way of doing it.


    nickmy
    Participant

    @nickmy

    is not working @r-a-y

    You changed this bit?

    ‘ID # YOU WANT TO SKIP’


    nickmy
    Participant

    @nickmy

    yes I did


    nickmy
    Participant

    @nickmy

    @djpaul I also tried it with profile name


    r-a-y
    Keymaster

    @r-a-y

    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.


    nickmy
    Participant

    @nickmy

    THANKS :D

    it works


    nickmy
    Participant

    @nickmy

    @r-a-y & @djpaul thank you very much I’ve got a last question what do I need to change if I want to hide more profile fields


    Roger Coathup
    Participant

    @rogercoathup

    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.


    Anton
    Participant

    @antonrsa

    thanks @r-a-y


    Aliceembroid
    Participant

    @aliceembroid

    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?
    Alice.


    Aliceembroid
    Participant

    @aliceembroid

    I have got this sorted out with buddypress profile privacy pluggin


    coco
    Participant

    @king-janak

    Perfect!!!!!!!!!!!!!!!! thankyou verymuch “R-a-Y” for this solution ,and also thanks to “ANTON” to start this topic.

    http://www.Champaneri.in


    rtandoh
    Participant

    @rtandoh

    Hi

    I can find the above function under the legacy branch of code base, but what is the BuddyPress 1.8 equivalent?

    Thanks.

    Richard


    somethingelse
    Participant

    @somethingelse

    this is great help… but how do we do this with the s2member fields when we have s2member set to integrate with buddypress profiles???


    agundabbo
    Participant

    @agundabbo

    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

Viewing 17 replies - 1 through 17 (of 17 total)
  • The topic ‘Hide profile field’ is closed to new replies.
Skip to toolbar