if conditional problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waterwheel
    Senior Member
    • Oct 2004
    • 257
    • 3.6.x

    if conditional problem

    I have this code

    Code:
    <if condition="$userinfo[field17] != no"><a href="http://www.amberalert.com" style="font-size:9px; color:red;">Amber Alert - MN</a></if>
    and I have a profile field 17 which is a single selection radio button with the first option as no, and the second option as yes. I have it set to make the first option (no) as the default.

    My problem is, the amber alert shows up whether it's set to yes or no. The logic seems right, but it doesn't work. What gives?

    TIA,

    ww
    "Oh, so they have internet on computers now!" --Homer.

  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    Raido buttons are stored in bitfields

    ie: 1 2 4 8 16 32 64 etc

    <if condition="$userinfo[field17] &= 2"><a href="http://www.amberalert.com" style="font-size:9px; color:red;">Amber Alert - MN</a></if

    Comment

    • waterwheel
      Senior Member
      • Oct 2004
      • 257
      • 3.6.x

      #3
      Thanks for the quick response Zachery, but no dice. I have the code

      <if condition="$userinfo[field17] &= 2"><a href="http://www.amberalert.com" style="font-size:9px; color:red;">Amber Alert - MN</a></if>

      But it still doesn't show up. This is the user profile field:

      Show Amber Alerts Single-Selection Radio Buttons Editable, Hidden field17

      I tried doing == and && but those didn't seem to work either. I have option one as no, which is the default, and option two as yes.


      I got the code from vb.org which was for 3.5. http://www.vbulletin.org/forum/showthread.php?p=873179

      OPTIONAL (User selectable)


      If you want to have this user-selectable you need to add a custom profile field. Create the new field as a radiobutton, give it a name and description of your choice, the options yes and no and use the following code instead of only $FNB_HTML:

      HTML Code:
      <if condition="$userinfo[fieldXX] == yes">$FNB_HTML</if>
      (if user wishes to show up)
      or

      HTML Code:
      <if condition="$userinfo[fieldXX] != no">$FNB_HTML</if>
      (show by default, user can deactivate it)

      Remember to replace XX with the number of the new profilefield!
      I'm wondering if this may have to do with syntax changes between 3.5 >>> 3.6 :shrug:
      "Oh, so they have internet on computers now!" --Homer.

      Comment

      • waterwheel
        Senior Member
        • Oct 2004
        • 257
        • 3.6.x

        #4
        Okay, this is just quirky.

        I have one thing that is a carbon copy of another. I have a ssrb for "show buddies in profile" and a ssrb for "show amber alerts" I have the exact same code for both, with the only difference being the profile #. The selection for show buddies in profile works fine when I turn it on and off, but the amber alert thing still shows up. I even have them both on the edit profile page. One's in the navbar, and one's in the memberinfo. Other than that, there's no difference that I can see, and no reason the amber alerts shouldn't be working.
        wtf?
        "Oh, so they have internet on computers now!" --Homer.

        Comment

        • mac27
          Senior Member
          • Dec 2005
          • 115
          • 3.6.x

          #5
          Did you ever figure this out? I have the same problem. My user field that is a radio button will not turn off. It always stays on.

          Never mind I got mine working.
          Last edited by mac27; Thu 15 Feb '07, 8:05pm.

          Comment

          • waterwheel
            Senior Member
            • Oct 2004
            • 257
            • 3.6.x

            #6
            care to share?

            I didn't get it to work, and just gave up. The logic seems right, but the damn thing just doesn't work. I feel stoopid.
            "Oh, so they have internet on computers now!" --Homer.

            Comment

            • harmor
              Senior Member
              • Aug 2003
              • 1334

              #7
              Take $userinfo[field17] and place it at the top of the template you're trying to write the conditional. Save the template and view the page. You should see the result in the upper left corner. This may help you in seeing what's wrong.

              Comment

              • mac27
                Senior Member
                • Dec 2005
                • 115
                • 3.6.x

                #8
                Originally posted by waterwheel
                care to share?

                I didn't get it to work, and just gave up. The logic seems right, but the damn thing just doesn't work. I feel stoopid.

                Use this conditional, notice the ' around the yes.

                <if condition="$post['fieldX']=='Yes'">
                Text/code here
                </if>

                I use this so that if a user selects yes on a radio button in the userCP that field will show up. If they select No then it won't.

                HTHs
                Last edited by mac27; Mon 19 Feb '07, 2:23pm.

                Comment

                • waterwheel
                  Senior Member
                  • Oct 2004
                  • 257
                  • 3.6.x

                  #9
                  Originally posted by mac27
                  Use this conditional, notice the ' around the yes.

                  <if condition="$post['fieldX']=='Yes'">
                  Text/code here
                  </if>

                  I use this so that if a user selects yes on a radio button in the userCP that field will show up. If they select No then it won't.

                  HTHs
                  There must be an evil troll inside my server because this is the exact code I have and I've also used every variation of it, and nothing is working.

                  <center>
                  <if condition="$post['field17']=='yes'">
                  <a href="http://www.amberalert.com" style="font-size:9px; color:red;">Amber Alert - MN</a>
                  </if>
                  </center>

                  I've done it with and without the ' and I've used $post and $userinfo with all of the variations of the == and !=. I've done like 4 factorial versions of this and nada.

                  If someone can solve the mistry, I shall pay them one half dollar (American).

                  Think of the kids we could be saving once this is working.
                  "Oh, so they have internet on computers now!" --Homer.

                  Comment

                  • mac27
                    Senior Member
                    • Dec 2005
                    • 115
                    • 3.6.x

                    #10
                    Are you trying to show this on the forum Home page?

                    Comment

                    • waterwheel
                      Senior Member
                      • Oct 2004
                      • 257
                      • 3.6.x

                      #11
                      Yes. I have it in the navbar template.
                      "Oh, so they have internet on computers now!" --Homer.

                      Comment

                      • Kurisu
                        Member
                        • Aug 2002
                        • 36
                        • 3.6.x

                        #12
                        Did you solve your mystery by now?

                        Comment

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