Announcement

Collapse
No announcement yet.

Conditionals based on when the when a thread was created? When a thread was last posted in?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditionals based on when the when a thread was created? When a thread was last posted in?

    I want to create a conditional to serve ads into my board pages in one specific forum based on the following criteria:

    - The thread must have been been created after a certain year, say 2008.

    - I don't want threads that were started before 2008 which may have been bumped bumped by posts after 2008.

    Is such a thing do-able?

    Thanks

  • #2
    You would have to compare against $threadinfo['dateline'] and $threadinfo['lastpost'].

    Both are UNIX Timestamp fields and hold the time as integers. This field is converted with code to a readable time. The value itself is the number of milliseconds since December 31, 1969 (when the world began according to UNIX).

    dateline - Time the thread is created.
    lastpost - Time the thread was last updated.

    You can convert times here: http://www.onlineconversion.com/unix_time.htm

    It may be $thread instead of $threadinfo in some locations.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment


    • #3
      Thanks Wayne! Here is another conditionals brain twister....

      We have one thread that has over a million views and I want to target specific ads to that thread only. How would I use conditionals to serve an ad into one specific thread while excluding the existing ads being served into the thread from the forum-wide conditional already running (so double the amount of ads don't serve into the thread).

      Comment


      • #4
        Originally posted by Wayne Luke View Post
        You would have to compare against $threadinfo['dateline'] and $threadinfo['lastpost'].

        Both are UNIX Timestamp fields and hold the time as integers. This field is converted with code to a readable time. The value itself is the number of milliseconds since December 31, 1969 (when the world began according to UNIX).

        dateline - Time the thread is created.
        lastpost - Time the thread was last updated.

        You can convert times here: http://www.onlineconversion.com/unix_time.htm

        It may be $thread instead of $threadinfo in some locations.

        ​I currently have a forum with conditionals running to show a leaderboard (ADVERTISEMENT A) below the navbar to members or else it show bigger ads (ADVERTISEMENT B) to other user groups.

        <!-- MAIN FORUM TAG -->
        <if condition="$forumid == '14'">
        <if condition=" in_array($bbuserinfo[usergroupid],array(30,9))">
        ADVERTISMENT A
        <else />
        ADVERTISEMENT B
        </if>
        </if>

        How can I use this and ALSO incorporate the dateline conditional to display different ad types? For example, I want to show members smaller ads as I am doing above, but if the thread in the forum (14) was started after 2008 show ADVERTISEMENT C and if the thread was started before 2008 just show ADVERTISEMENT A.
        ALSO For all other user groups, show ADVERTISEMENT B as above if thread in the forum was started before 2008, if the thread was started after that show ADVERTISEMENT D.

        Will this work?

        <!-- MAIN FORUM TAG MEMBERS -->
        <if condition="$forumid == '14'">
        <if condition=" in_array($bbuserinfo[usergroupid],array(30,9))">
        <if condition="$dateline > '1230768000'">
        ADVERTISMENT A
        <else />
        ADVERTISEMENT C
        </if>
        </if>
        </if>
        <!-- MAIN FORUM TAG GUESTS -->
        <if condition="$forumid == '14'">
        <if condition=" in_array($bbuserinfo[usergroupid],array(2,3,4,5,6,7,8))">
        <if condition="$dateline < '1230768000'">
        ADVERTISMENT B
        <else />
        ADVERTISEMENT D
        </if>
        </if>
        </if>


        Comment


        • #5
          I figured it out! *pats self on head*

          Comment

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