Showing an item in postbit_legacy only for a specific forum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedWingFan
    Senior Member
    • Sep 2004
    • 371
    • 4.0.0

    Showing an item in postbit_legacy only for a specific forum

    I have installed a product (iTrader) that lets me show a member's trader rating in thier postbit, below their post count. What I want to do is limit the display of this information only when they are visiting our Classifieds forum area. I believe I can use the in_array function somehow...but how would I do this, and which variable(s) should I be using? The vB docs mention in_array, but no examples of how to use it within vB (and the docs just point to the PHP site anyway...I already know how it works, but not within the vB context).

    I already have this inside an "is_member_of" conditional so that members who are not allowed to use our Classifieds forum can not access it (and that works fine, BTW), but now I just need to limit it to a single forum or forums.
  • feldon23
    Senior Member
    • Nov 2001
    • 11291
    • 3.7.x

    #2
    One forum:

    Code:
    <if condition="$forumid == 12">
      show stuff for forum id #12
    </if>
    Multiple forums:

    Code:
    <if condition="in_array($forumid, [COLOR=SeaGreen]array(12,17)[/COLOR])">
      show stuff for forum id #12 and #17
    </if>
    I might be wrong with the $forumid above. It might be $forum[forumid]. If so, then it will be this:
    Code:
    <if condition="$forum[forumid] == 12">
       show stuff for forum id #12
    </if>
    I would like to see a conditional reference too. At least the dozen most useful conditionals for postbit, threadbit, forumbit, forumhome, memberinfo (user profile), and usercp. Maybe I just need to write one myself.
    Last edited by feldon23; Sat 9 Sep '06, 8:53am.

    Comment

    • Zachery
      Former vBulletin Support
      • Jul 2002
      • 59097

      #3
      Feldon if you are going to use an in_array your second item must be an array

      array(12)

      Comment

      • feldon23
        Senior Member
        • Nov 2001
        • 11291
        • 3.7.x

        #4
        Oops.

        Comment

        • RedWingFan
          Senior Member
          • Sep 2004
          • 371
          • 4.0.0

          #5
          Originally posted by feldon23
          I would like to see a conditional reference too. At least the dozen most useful conditionals for postbit, threadbit, forumbit, forumhome, memberinfo (user profile), and usercp. Maybe I just need to write one myself.
          A conditional tutorial would probably help us out a lot. vB's documentation has a good start on it IMHO, but in this instance, I knew of how something worked, but not the specifics (such as variable names). Having a reference guide with a tutorial and/or examples would make it easier for a dunce such as yours truly.

          My problem is, I am admin for this large forum as a volunteer, and I have to try to squeeze in my work on this forum in between my paying web jobs. I sometimes find it difficult to change gears--I write my own code and I'm used to the way I do things; vBulletin's team uses different ways of writing and organizing code, as do any other PHP-based packages I've used and modified (phpBB, WordPress, Gallery, etc.). My mind isn't what it used to be...

          I'm going to try your conditionals and see what happens. Thanks much!

          Comment

          • RedWingFan
            Senior Member
            • Sep 2004
            • 371
            • 4.0.0

            #6
            This worked perfectly:
            Code:
            <if condition="$forum[forumid] == 12">
               show stuff for forum id #12
            </if>
            Thanks again!

            Comment

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