Hide Profile Fields in user profiles based on their selection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RagnarokDensetsu
    Senior Member
    • Nov 2005
    • 390
    • 3.7.x

    Hide Profile Fields in user profiles based on their selection

    Yeah, that title makes sense >.>

    Anyways, I've added a custom profile field using single-selection radio buttons. Some of my users, it turns out, would prefer to leave this field blank instead of being forced into filling it out.

    One of the options I've provided as a result is an option not to disclose it. I have the following conditional to prevent it from displaying in the postbit if they have selected this option.

    Code:
    <if condition="$post[fieldX] != '(do not display)'">
    <div class="smallfont">
    $vbphrase[phrase_name]: $post[fieldX]
    </div>
    </if>
    But my profile field still displays in the user's profile, and since it is not possible to leave it blank, I am stuck with those profiles displaying this:

    Custom Field:
    (do not display)

    I would like to make its appearance conditional on whether they have selected the (do not display) option or not, but have not been able to figure out how. Failing that, I'd like it not to display at all.

    Thanks in advance!

    Edit: I am currently running 3.7.5 PL1, by the way.
  • RagnarokDensetsu
    Senior Member
    • Nov 2005
    • 390
    • 3.7.x

    #2
    Anybody?

    Comment

    • Lynne
      Former vBulletin Support
      • Oct 2004
      • 26255

      #3
      Are you sure you can't leave it blank? That is probably the default - look in the database and see what it is being set to for old users and new users.

      I am not understanding this though. What page is this on? You say user profile page, but $post is only used in the postbit templates (showthread page). And, how can you have a field who's only option is to select (do not display). That doesn't make sense to me.

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to vbulletin.org
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools &lt;- awesome site for html/css help

      Comment

      • RagnarokDensetsu
        Senior Member
        • Nov 2005
        • 390
        • 3.7.x

        #4
        I'm using single-selection radio buttons; when a user goes to the Edit Your Details page, it forces you to select one of them. In the database it is blank for users who have not edited their profile since it was implemented, but for new users it defaults to the first option, which is the one I've labeled "(do not display)"

        The field itself has 6 options, but as far as I know there is no way to deselect a radio button, so it's not possible to leave it blank.

        I've added the code above to my postbit template, and it's working the way I want it to.

        The issue that I have is that there is no way to prevent the profile field from appearing in the user profiles (member.php pages) as it will display whatever option is selected and it isn't possible not to select anything.

        Comment

        • DoE
          Senior Member
          • Sep 2007
          • 763

          #5
          I can't recall how the profile pages were in 3.7 as compared to 3.8

          But, with that said, of course it is possible to hide it,

          Can you link me to your 3.7 profile page (here in this thread or through pm) and set your custom field to do not display.

          Comment

          • Lynne
            Former vBulletin Support
            • Oct 2004
            • 26255

            #6
            As DoE said, it should be possible to hide it. Perhaps post a screencap of your user profile page settings.

            Please don't PM or VM me for support - I only help out in the threads.
            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
            Want help modifying your vbulletin forum? Head on over to vbulletin.org
            If I post CSS and you don't know where it goes, throw it into the additional.css template.

            W3Schools &lt;- awesome site for html/css help

            Comment

            • DoE
              Senior Member
              • Sep 2007
              • 763

              #7
              Does 3.7 use tabs and blocks?

              I just created a radio selection with the default option set to: (do not display)

              I have it hidden on the profile page when this option is selected by the member.

              Here is how for 3.8.4. Hopefully 3.7 is simular.

              Edit: Member Info Templates -> memberinfo_profilefield

              Above everything, add this:

              <if condition="$profilefield[value] != '(do not display)'">

              scroll to the very bottom, and below the </if> add:

              </if>

              Doing it this way means in the future, any new fields you add to the profile, you will not have to re-edit this template or check field id's if you use (do not display) as an option,
              Last edited by DoE; Fri 15 Jan '10, 8:44am.

              Comment

              • RagnarokDensetsu
                Senior Member
                • Nov 2005
                • 390
                • 3.7.x

                #8
                That worked perfectly, thanks very much

                The only thing I changed was to put your code
                Code:
                <if condition="$profilefield[value] != '(do not display)'">
                Immediately before this, instead of at the beginning of the template.
                Code:
                <dt class="shade">$profilefield[title]</dt>
                This way, it will not display to any visitors, but it will display to the owner of the profile, in case they would like to edit it.

                Thanks for the help!

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...