Announcement

Collapse
No announcement yet.

Posts since last visit

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

  • Posts since last visit

    When you log in to my forum it shows Private messages since last visit but Id like to show posts since last visit. Is there an option for this or could someone help with a bit of code for this ?

    Any help appreciated,

    Oli

  • #2
    A number? Well, you could use phpinclude templates..

    PHP Code:
    if (THIS_SCRIPT == "index") {
      
    $threads $DB_site->query_first("SELECT COUNT(postid) AS new  from ".THREAD_PREFIX."posts WHERE dateline > $bbuserinfo[lastvisit]");

    Assuming $bbuserinfo[lastvisit] is a unix timestamp (not exactly sure), that should pull the # of any new posts made since that time.
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson

    Comment


    • #3
      is this simply a template modification? if not, can you please let me know which php file to alter and where i would insert this code? i think this is a must have feature and was surprised to see that it wasn't included in VB3.

      www.cocteautwinsforums.com

      Comment


      • #4
        ok i found this thread:

        http://www.vbulletin.com/forum/showthread.php?t=101600

        which shows you how to display the number of posts since your last visit but one problem i'm having is i don't know exactly where to put it in the FORUMHOME template! i want it to appear directly below the "Welcome, username" line. could someone please tell me exactly where to insert the code in the FORUMHOME template?

        www.cocteautwinsforums.com

        Comment


        • #5
          Hi,

          Originally posted by cka
          A number? Well, you could use phpinclude templates..
          your query will show the number of ALL post, even if the user is allowed to view them all or not! How can I get the number of all "readable" new posts?!

          Regards,

          Tobi

          Comment


          • #6
            Originally posted by mmmender
            ok i found this thread:

            http://www.vbulletin.com/forum/showthread.php?t=101600

            which shows you how to display the number of posts since your last visit but one problem i'm having is i don't know exactly where to put it in the FORUMHOME template! i want it to appear directly below the "Welcome, username" line. could someone please tell me exactly where to insert the code in the FORUMHOME template?
            I believe you want to put it in the navbar template (found under the Navigation/Breadcrumb Templates right under the section:

            <if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl]">$vbphrase[private_messages_nav]</phrase></if>
            Now if I could figure out how to make the number reset a bit sooner.

            Comment


            • #7
              Problem is that it can be a fairly intensive query esp with out indexs.

              I personally use this in my phpinclude_start and have set proper indexs where nessary

              This works so it will only update on the forumhome, and only to non guest users.
              PHP Code:
              if (THIS_SCRIPT == 'index' AND $bbuserinfo['userid'] != '0'

              // Posts 
              $getnewposts $DB_site->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "post WHERE visible = 1 AND dateline >= '$bbuserinfo[lastvisit]'"); 
              $newposts number_format($getnewposts['count']); 
              // Threads 
              $getnewthreads $DB_site->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "thread WHERE dateline >= '$bbuserinfo[lastvisit]'"); 
              $newthreads number_format($getnewthreads['count']);

              And my html code that for me goes in the navbar
              HTML Code:
              <if condition="$bbuserinfo[userid] != '0' AND THIS_SCRIPT == 'index'"><br /><span class="smallfont">There has been <a href="$vboptions[bburl]/search.php?do=getnew">$newposts</a> new posts and <a href="$vboptions[bburl]/search.php?do=getnew">$newthreads</a> new threads since your last visit.<br />( <a href="$vboptions[bburl]/search.php?do=getnew"> Get New Posts</a> ) </span></if></div>
              		</if>

              Comment

              Loading...
              Working...
              X