PDA

View Full Version : Real "read/not read" threads and "new messages in forum" highlighting v1.2


JohnWoo
03-20-2004, 10:00 PM
Hello all!

It is just a vb3 version of old hack
https://vborg.vbsupport.ru/showthread.php?t=47101
And with same weak sides.

Features:
- Thread on forumdisplay highlighted for user as read only if that user saw last post in that thread or if last post in that thread is older then user defined (from user CP profile) amount of time (from 1 to 999 hours and infinity)
- Forums on index page and subforums on forumdisplay pages will be highlited as "have no new posts" only if user saw last post in that forum or subforum
- Highliting system is completly cookie-free
- System will require extra Database space (2-4% on large forums and 5-6% on small)
- Sytem will add some extra queries to scripts

-one addditional UPDATE is showthread.php (if there are new posts since your last visit of that thread)
-one additional SELECT (of 2 fields only) for each subforum on forumdisplay.php
-one additional SELECT (of 2 fields only) for each forum on index.php
-one addditional UPDATE in newreply.php
-"mark forum read" works using one extra UPDATE
-and "mark all forums read" using one extra UPDATE for each forum :)


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 "thread" 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". 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 string in that view field 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 "view" field of thread will be deleted.
On forum home page script looks for userid number in "view" field of last thread in each forum and if it found, display that there were no new posts in that forum.

Additionally read\unread marking can be time based (new field ) "marktime" in users custom fields. 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 profile settings.
And at last to mark forum (or all forums) read we just mark read last thread in that forum (or in all forums:)

History:
v.1.2
Fixed moved threads highlighting.
some changes in functions.php and functions_forumdisplay.php

v.1.1
Fixed SQL request. If you tried to install v 1.0 already, better drop view field
ALTER TABLE `thread` DROP `view`
and recreate it again
ALTER TABLE `thread` ADD `view` TEXT NOT NULL

Sorry for my English and please ask questions if you don't understand something :)

assassingod
03-21-2004, 08:19 PM
An attachment would be great;) :up:

JohnWoo
03-21-2004, 08:21 PM
sorry - absolutely forgot about attachment :)

FleaBag
03-21-2004, 11:31 PM
I like this. I like it a lot.

MrNase
03-23-2004, 05:47 PM
Doesn't work. Nothing is marked as read :(

I tested it with a fresh vB3 gold installation. Not even forumdisplay.php?do=markread works properly:(

I have to users, each made 2 threads. 2 threads (made by user 1) have '1 2' in the database and the other 2 (made by user 2) have 'null' in the database.

The first 2 threads are marked as read.

search.php?do=getnew doesn't find any threads but there are 2 marked as unread :(

gmarik
03-23-2004, 06:21 PM
Nice. Any demo site?

codemonkey
03-23-2004, 06:45 PM
Nice. Any demo site?

ohh I don't think that it's nice, if it does not work :ermm:

JohnWoo
03-23-2004, 09:23 PM
Sorry, but I just checked and rechecked everything 3 times on fresh forums and found nothing wrong except line numbers for search.php :)
So just now i can suggest only checking scripts changes again :)
Uploading fixed txt with correct line numbers ans visual framed HTML example of changes in two longest scripts (but that examples for this hack together with fulltext search hack - sorry :)
Is there somebody why saw it working after installing ?

codemonkey
03-24-2004, 07:14 AM
Why dont you include your hack in your yB so that we all can see the result? :tired:

jluerken
03-24-2004, 09:48 AM
Why dont you include your hack in your yB so that we all can see the result? :tired:

Yes, especially the 'new messages in forum" highlighting ' I would like to see in action.
This sounds to me like a feature I know from my old UBBT.

JohnWoo
03-24-2004, 09:54 AM
Sorry, but I can't show, because I have no "my vB" outside http://localhost:80/ :) I worked long time ago in one company as vB administrator and since that time it is just a fun for me :)
But you may find screenshot image for that hack in old 2.2.x thread.

jluerken
03-24-2004, 10:05 AM
Sorry, but I can't show, because I have no "my vB" outside http://localhost:80/ :) I worked long time ago in one company as vB administrator and since that time it is just a fun for me :)
But you may find screenshot image for that hack in old 2.2.x thread.
I don't see a screen there that really shows what this hack is doing.

JohnWoo
03-24-2004, 10:12 AM
<a href="https://vborg.vbsupport.ru/attachment.php?attachmentid=9718" target="_blank">https://vborg.vbsupport.ru/attac...achmentid=9718</a>
?

MrNase
03-24-2004, 10:16 AM
This hack doesn't work and it's not just me. A friend of mine tested that hack before i did and he had the same problems as me.

Somebody else should test it, too.

JohnWoo
03-24-2004, 10:49 AM
This hack doesn't work and it's not just me. A friend of mine tested that hack before i did and he had the same problems as me.

Somebody else should test it, too.

I have nothing to say - sorry :)
But in last 2 days i tested it may be 12 or 15 times and now i am 99.9% sure that it works :)
PS Looks like we have different base scripts..
PPS Here is new one screen for vb3

MrNase
03-24-2004, 11:45 AM
i must be too stupid. I installed this hack 3 times and it still doesn't work.

It must be something with the database because the entry in the database is still 'null' but i visited that thread with both accounts and it must be '1 2' and not 'null' :(


After i replied to that thread it gets marked as read.

boardster
03-24-2004, 11:57 AM
Hi JohnWoo,

thank you for this great hack.

Unfortunately I've problems to install this hack. Maybe I dont follow all instructions exactly.

Can you upload the files you have changed, please?

JohnWoo
03-24-2004, 01:07 PM
Seems that i found problem :)
Feel myself stupid :) I couldn't found it for so long time because was looking at scripts changes and missed one small word in sql request...
Sorry :)

boardster
03-24-2004, 01:28 PM
Fixed SQL request. If you tried to install v 1.0 already, better drop view field
ALTER TABLE `thread` DROP `view`
and recreate it again
ALTER TABLE `thread` ADD `view` TEXT NOT NULL

Now it works fine!!

Thank you very much, JohnWoo. =)

codemonkey
03-24-2004, 02:18 PM
no it doesnt work here. in boardsters board it doesnt work too.
http://www.boardunity.de <- here you can see it.

codemonkey
03-24-2004, 02:47 PM
ohh now it works fine. there is only one problem: The "mark all forums as read" function doenst work.

JohnWoo
03-24-2004, 03:45 PM
"mark all forums as read" must mark as read last thread in each forum. After all forums on index.php must not be highlighted. It don't work? Or may be you want to be marked as read all threads in all forums? If yes? then there is no way to mark all threads in all forums as read (because it will update all threads in database ) - sorry.

codemonkey
03-24-2004, 04:30 PM
"mark all forums as read" must mark as read last thread in each forum. After all forums on index.php must not be highlighted. It don't work? Or may be you want to be marked as read all threads in all forums? If yes? then there is no way to mark all threads in all forums as read (because it will update all threads in database ) - sorry.

But then your hack makes no sense. sorry but why will not every thread mark as read? Like in phpBB or something else.

JohnWoo
03-24-2004, 04:48 PM
I know nothing about phpBB, but lets say that you have board with 100.000 threads and 10.000 members. Then when some member will deside to "mark all threads read", vB will have to run query with 100.000 affected rows. And update of text field in 100.000 rows at once will kill your MySQL server, and if it will be still alive, what if 200 members at once will decide to do same thing? So I am sure that it will never be possible in that highlighting scheme. Besides i don't understand what for do you need it - sorry :)

enginethatcan't
03-26-2004, 01:48 AM
installed but problem.....

everything is lit up as if there were new replys to everything. but only one thread has been made. Everything is bold. did I need to change something? and where?

JohnWoo
03-26-2004, 05:05 AM
sorry, but i am not sure that i understand :)
If somebody post reply to thread that was marked as read ( marked for you) it must become bold (unread) because it means that you have not read it yet completely?
Or all threads become unread after reply to one single thread? If first, it was supposed to be so, and if second, you need to check changes in newreply.php :)

enginethatcan't
03-26-2004, 09:03 AM
no replies whatsoever right now

JohnWoo
03-26-2004, 09:17 AM
Still understand nothing - sorry :)
You always see all threads as unread or you never tried to open that threads or they all turn to unread after one single reply ?

enginethatcan't
03-26-2004, 05:38 PM
I'm sorry but I really don't understand what you don't get from my pics and explination.

I installed this. EVERYTHING shows up as UNREAD no matter what!

JohnWoo
03-26-2004, 08:39 PM
then if you completely sure that scripts were changed correctly, extra field was created as
NOT NULL
(it was fixed in v.1.1) and you have no NULL values in that field for all posts, I have no ideas - sorry... It works on my side.

mzenner
04-17-2004, 12:07 PM
ohh now it works fine. there is only one problem: The "mark all forums as read" function doenst work.

same problem here :(
can you make if they click on make all forums read that all is marked as read (even if it has to check all database ;)


new users have to read everything to mark as read?

can you solve this last so that new users don't get everything marked as to be read ?

JohnWoo
04-17-2004, 12:19 PM
sorry, but is still can't understand why it is problem and what for you need to mark everything ? :)
When user click "mark all forums read" all forums become not highlighted ("no new messages in forum" icon), and i can't see why you need to lose all read-not read information for all threads in all forums? In any way each user may set highliting time to for example to 1 hour in his user CP and all threads older then 1 hour will have "read" highlight :)

mzenner
04-17-2004, 02:22 PM
for me it is ok now :-)

i set default to 48h se new members when they activate they see post from last 48h mark to be read

GoHa
05-19-2004, 08:32 AM
Tried.
Mark all readed, and mark thread readed is not working. It is a problem

Debugged:

in this function, when it will be called from MARK ALL READED action, input parameter $threadid is zero, but $forumcache["$forumid"]['lastthreadid'] is not working:

function mark_thread_read($threadid,$forumid=0,$unique=0) {
global $DB_site,$forumcache,$bbuserinfo;
$m_thread = intval($threadid);
if ($m_thread == 0 && $forumid > 0) {
$m_thread = intval($forumcache["$forumid"]['lastthreadid']);
}
echo("$m_thread $forumid.<br>");

$m_thread is always zero. As a result follows (next lines in listed function) SQL query will never works.

Can you advise please?

P.S. I am using 3.0.1

Cyberhouse
06-08-2004, 06:33 PM
Hi and thanks for a great hack!

I have one problem thou ;) The problem is that if there is a new post in one of my subforums it doesn?t indicates as new posts in the main forum. But if I enter that main forum and see all the sub forums it indicates there that there are new posts. Any idea how this can be fixed?

Cyberhouse
06-17-2004, 05:47 AM
Hi and thanks for a great hack!

I have one problem thou ;) The problem is that if there is a new post in one of my subforums it doesn?t indicates as new posts in the main forum. But if I enter that main forum and see all the sub forums it indicates there that there are new posts. Any idea how this can be fixed?


anyone?

Berethorn
07-08-2004, 12:28 AM
What happened to this? It had so much promise! I'm going to try my luck with it, and see what happens. I'm desperate for this hack to work. :)

EDIT: It seems to work great, except for the inability to mark forums read, which is really an important flaw. I'll see if there's a cure.

Berethorn
07-08-2004, 01:44 AM
Ok, I can't figure it out - I don't know PHP. It must be something easy though, because there is only so much code changed for this hack. If one of the people who are knowledgable in such things could take a look at it, that would be appreciated. Thanks. :)

pie
07-19-2004, 03:52 PM
When i hit MARK FORUMS AS READ it doesnt work. I have edited the code to see the relevant bits are parsing and they are.

JohnWoo
07-20-2004, 09:34 AM
Hello!
It is little server sensitive solution, but try to say
cache_ordered_forums(1, 1);
before each call of
mark_thread_read(0,$forumid);
function :)

Cheertobi
11-03-2004, 12:28 PM
Hi,

does this also work with VB3.0.3?

Regards,

Tobi

GoHa
11-03-2004, 05:26 PM
I've tried everything, but was unable to make it works.
Have 3.0.3, have linux, all latest php, mysql and others..

I gave up on this hack. Sorry.

oneglory
09-15-2006, 03:26 AM
does this hack work with newer versions of vB?

oneglory
09-16-2006, 02:54 AM
anybody?