Conditional question: number of users online

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neomaven
    Member
    • Nov 2006
    • 64
    • 3.6.x

    Conditional question: number of users online

    I was hoping to make use of a conditional in a template that would only show a particular item if there were less than a certain number of users currently online, but not sure which vb variable to use.

    Any hints?

    Also, for future reference, is there a list somewhere that details the various built-in vb variables that can be referenced in template conditionals? This would be quite helpful. I tried searching this forum, but couldn't find anything like that.

    Thanks
  • peterska2
    Senior Member
    • Oct 2003
    • 8869
    • 3.7.x

    #2
    There is no function to do this. This will require modification to your site.
    For modification support, advice and assistance, please visit vBulletin.org.

    Comment

    • neomaven
      Member
      • Nov 2006
      • 64
      • 3.6.x

      #3
      Ok, perhaps you can tell me if a stock vb variable exists to reference the current number of online users? Something like $vbonlineusers perhaps?

      I can then construct the rest of the conditional that I need.

      Comment

      • peterska2
        Senior Member
        • Oct 2003
        • 8869
        • 3.7.x

        #4
        There isn't (I checked before replying yesterday) which is why you will need a modification to do this.

        Comment

        • neomaven
          Member
          • Nov 2006
          • 64
          • 3.6.x

          #5
          I just noticed the default FORUMHOME template uses this variable in the What's Going On box:

          $totalonline

          in this section here:

          PHP Code:
          <!-- logged-in users -->
          <
          tbody>
           <
          tr>
            <
          td class="thead" colspan="2">
             <
          a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
             <
          a href="online.php$session[sessionurl_q]rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
            </
          td>
           </
          tr>
          </
          tbody
          Could I use this variable in a template conditional like this:

          PHP Code:
          <if condition="$totalonline >= 500">
          DO 
          THIS
          <else />
          DO 
          THAT
          </if> 
          Last edited by neomaven; Fri 21 Dec '07, 8:11am.

          Comment

          • neomaven
            Member
            • Nov 2006
            • 64
            • 3.6.x

            #6
            **UPDATE**

            I tested this conditional format and it seems to work just fine:

            PHP Code:
            <if condition="$totalonline >= 500">
            DO 
            THIS
            <else />
            DO 
            THAT
            </if> 
            Just sharing this info for posterity (and those who actually use the forum search function ) and anyone who may need to reference the number of online users in a template conditional.

            I must say I am a bit proud of myself for figuring this out on my own, especially when a VB staff member claimed such a variable didn't exist
            Last edited by neomaven; Fri 21 Dec '07, 8:10am.

            Comment

            Related Topics

            Collapse

            Working...