vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Real "read/not read" threads highlighting 1.0 (https://vborg.vbsupport.ru/showthread.php?t=47035)

JohnWoo 12-26-2002 10:00 PM

Real "read/not read" threads highlighting 1.0
 
Hello everybody !

Few words how it works :)
As you know vb "marking threads and posts read" system is time and cookie based. This hack is based on adding to "post" table one extra field - "view" (suppose that it must work fine with TEXT type, but for really large forums we can make it LONGTEXT :)
Now when somebody open thread, his usedid will be added to that "view" field of last post of thread. After several users (who open that thread) string in that field may look like
37 298 16879 7287 29087 28 298
So it will be just a long string with userid-s separated by space
Now then user open forumdisplay.php script will check each last post of each thread for part of string
[space userid space]
and if is will be found thread will be marked as read. If you think that it will use too much database space, i can say that it will use some place of course, but not too much, because after each reply in thread (new last post in thread) all old data in all "view" fields of all old posts in thread will be deleted. On forum home page script looks for userid number in "view" field of last post in each forum and if it found display that there were no new posts in that forum. To make it work faster (with less database requests) i added "lastpostid" field in thread table :)
Additionally read\unread marking can be time based (new field ) "marktime" in users table. And users are able to select number of hours (all posts older then that number of hours will be marked as read) in their CP options.
And at last to mark forum (or all forums) read we just mark read last post in that forum (or in all forums:)
Sorry for my English and please ask questions if you don't understand something :)

PS Updated to 1.1. New thread here
https://vborg.vbsupport.ru/showthrea...threadid=47101

VeoMorphine 12-27-2002 04:56 PM

what does it do?

Brad 12-27-2002 05:34 PM

If im correct this will not mark threads as "read" when your session has timed out. I would install it but im worried about it adding alot of clutter to my Database.

JohnWoo 12-27-2002 07:07 PM

Hi!

Sorry :) just found part of missed code in .txt
Fixed .zip in first edited post already :)

Brad 12-28-2002 05:25 AM

John, do you have any idea how many querys this adds and how much processing time it will add to a forum?. Id love to add it but not if it will cause slower responce times.

JohnWoo 12-28-2002 06:45 AM

:)
-one addditional UPDATE is showthread.php
-one additional SELECT (of 2 fields only) for each thread or subforum on forumdisplay.php and search.php pages
-one addditional UPDATE in newthread.php
-two addditional UPDATE in newreply.php
-"mark forum read" works using one UPDATE
-and "mark all forums read" using one UPDATE for each forum :)
So, in theory forumdisplay.php will work little slower, but i can't notice it using eyes only :)

Icheb 12-28-2002 02:43 PM

Quote:

Originally posted by JohnWoo
-one additional SELECT (of 2 fields only) for each thread or subforum on forumdisplay.php and search.php pages
If you have 25 threads displayed per page that will add 25 queries, lol ;) . I am rather someone who sacrifices *some* features to get less neccessaire queries.

Ageel 12-28-2002 05:36 PM

Hey, as I know.... This is a good one.. BUT
it will add too much data that is not really needed to the database..

Why don't you make an Additional Table .. let's call it (thread_read)
and add 3 fields (userid, threadid, timestamp)
and then add to it so you can at least delete them from time to time especially if the topics are too old --> no need to specify who read it

I hope this would help ;)

thanx

Ageel 12-28-2002 05:41 PM

Quote:

Originally posted by Icheb


If you have 25 threads displayed per page that will add 25 queries, lol ;) . I am rather someone who sacrifices *some* features to get less neccessaire queries.

If using a new table, he could add a JOIN to the thread SELECT so it will be the same # of queries :)

JohnWoo 12-28-2002 06:08 PM

Hello !
Quote:

Originally posted by Ageel

it will add too much data that is not really needed to the database..

sorry, but i can't agree :) In theory on forum with 2000-3000 registered users, 25-30 always on-line users, common number 5 posts in each thread and common post length 80 words/400 bytes it will take about 3-4% of DB space :)

Quote:

Originally posted by Ageel

Why don't you make an Additional Table .. let's call it (thread_read) and add 3 fields (userid, threadid, timestamp)

Tried it already :) That way will use much more db\processor space\time. Actually i am thinking at that problem about year already... Checked code of most free\not free forums and had a lot of different attepts :)

Quote:

Originally posted by Icheb

If you have 25 threads displayed per page that will add 25 queries, lol . I am rather someone who sacrifices *some* features to get less neccessaire queries.

Sorry :) I still thinking at optimizing... Hope that somebody more clever will perform it with less db time\space :)

PS It was the only feature that i really missed in vb :)


All times are GMT. The time now is 09:53 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01008 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete