Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Dynamically Marking Read Topics
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

nyquist
Starting Member

Italy
6 Posts

Posted - 04 May 2004 :  18:01:09  Show Profile
Mark Topics Read by nyquist
date: 5th may, 2004

WARNING THIS IS AN ALPHA RELEASE

Features:

This MOD marks as read all topic viewed by a user untill he logs out. While a member browse the board the viewed topics (those marked with yellow folders) changes each time he views a new topic. The technique used to understand if a Topic has been viewed is based on the value of the field LASTHEREDATE of the member and elements of a new table. The installation is quite simple and can be done with a dbs file and by modifying 4 files.

Performances:

This mod requires one database access each time a topic is viewed (to store a new record in the new table TOPIC_VIEWED). It also requires only 1 more database access each time a forum page is opened to read all topics viewed by the user. Finally it requires one more database access when a member logs out to delete all member's entries in the TOPIC_VIEWED table. IMO the only real drawback of this mod is that if a member doesn't log out then his entries in the new table grows indefinitely. For this reason i'm thinking about implementing the mod using cookies instead of a database table.

Installation:

First we have to create the table. This step can be done with a dbs file. Write the following code in a text file:
------------------------copy---------------------
Mark Posts Read by Nyquist
[CREATE]
TOPIC_VIEWED

TV_MEMBER#int##
TV_TOPIC#int##
[End]
-----------------------end copy---------------------

save the file as dbs_markpostread.asp, upload it to your forum directory, login as admin and choose 'MOD setup'. In the list choose
Mark Posts Read by Nyquist

Once the database is created it can be easily deleted with the following dbs code:

------------------------copy---------------------
Uninstall Mark Posts Read by Nyquist
[DROP]
TOPIC_VIEWED
[End]
-----------------------end copy---------------------

Now we have to change 4 files:

topic.asp:

around line 97 find:

if strSignatures = "1" and strDSignatures = "1" then
	if ViewSig(MemberID) <> "0" then
		CanShowSignature = 1
	end if
end if


directly after add this:

'## Mark topic read code
if MemberID <> -1 then
	strSqlTopViewed = "INSERT INTO " & strActivePrefix & "TOPIC_VIEWED (TV_MEMBER, TV_TOPIC)"
	strSqlTopViewed = strSqlTopViewed & " VALUES ("
	strSqlTopViewed = strSqlTopViewed & cLng(MemberID) & ", "
	strSqlTopViewed = strSqlTopViewed & Topic_ID & ")"
	my_Conn.Execute (strSqlTopViewed),,adCmdText + adExecuteNoRecords
end if
'## End Mark topic read code


inc_func_common.asp:

around line 991 find

sub ClearCookies()


directly under that add:

	'##mark topic read by nyquist
	'update last access date-time:
	strMyForumTimeAdjust = DateAdd("h", strTimeAdjust , Now())
	strMyUserName = Request.Cookies(strUniqueID & "User")("Name")
	UpdateLastHereDate DateToStr(strMyForumTimeAdjust),strMyUserName
	'delete entries of Member from table TOPIC_VIEWED:
	MyMemberID = cLng(getMemberID(strMyUserName))
	MyStrSql = "DELETE FROM " & strTablePrefix & "TOPIC_VIEWED"
	MyStrSql = MyStrSql & " WHERE TV_MEMBER = " & MyMemberID
	my_conn.Execute (MyStrSql),,adCmdText + adExecuteNoRecords
	'##mark topic read by nyquist end


forum.asp:

around line 439 find:

if iTopicCount = "" then
	Response.Write	"              <tr>" & vbNewLine & _
			"                <td colspan=""7"" bgcolor=""" & strForumCellColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><b>No Topics Found</b></font></td>" & vbNewLine & _
			"              </tr>" & vbNewLine
else


directly after that add:

	'##mark topic read by nyquist
	strSqlTV = "SELECT TV_TOPIC FROM " & strMemberTablePrefix
	strSqlTV = strSqlTV & "TOPIC_VIEWED WHERE TV_MEMBER = "
	strSqlTV = strSqlTV & cLng(MemberID)
	set TVrs = Server.CreateObject("ADODB.Recordset")
	TVrs.cachesize = strPageSize
	TVrs.open strSqlTV, my_Conn, adOpenStatic
	if not TVrs.EOF then
		elencoTV = TVrs.GetRows
		nroTV = UBound(arrTopicData, 2)
	else 
		nroTV = 0
	end if
	TVrs.Close
	set TVrs = nothing
	'##end mark post read


around line 487 find

		Topic_ID = arrTopicData(tTOPIC_ID, iTopic)


directly after that add:

		'##mark topic read by nyquist
		TVcount = 0
		if nroTV > 0 then
			for Each singoloTV in elencoTV
				if cLng(Topic_ID) = cLng(singoloTV) then
					TVcount = 1
					exit for
				end if
			next
		end if
		'##mark topic read by nyquist end


around line 525 find

			if Topic_Sticky and strStickyTopic = "1" then 
				if Topic_LastPost > Session(strCookieURL & "last_here_date") then


change the second line to to

				'##mark topic read by nyquist  line changed
				if Topic_LastPost > Session(strCookieURL & "last_here_date") and TVcount <> 1 then
				'##mark topic read by nyquist line changed end


around line 560 find

			if ArchiveView = "true" then 
				Response.Write	getCurrentIcon(strIconFolderArchived,"Archived Topic","hspace=""0""")
			elseif Topic_LastPost > Session(strCookieURL & "last_here_date") then


change the last line to :

			'##mark topic read by nyquist line modified
			elseif Topic_LastPost > Session(strCookieURL & "last_here_date") and TVcount <> 1 then
			'##mark topic read by nyquist line modified end


inc_func_chknew.asp:

around line 72 find

Function ChkIsNew2(dt)
	if Topic_Replies = "" then Topic_Replies = rs("T_REPLIES")
	if dt > Session(strCookieURL & "last_here_date") then


change last line to:

'##mark topic read by nyquist line modified
	if dt > Session(strCookieURL & "last_here_date") and TVcount <> 1 then
'##mark topic read by nyquist line modified end


here you go, that's it

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 04 May 2004 :  18:07:39  Show Profile  Visit PeeWee.Inc's Homepage
al-la PHPBB

I'll try it out in the morning. Something i've wanted for ages.

When all the bugs are sorted (if there are any) and it's outta ALPHA, this should be added to the base code, as this is one thing PHPBB has over Snitz.

De Priofundus Calmo Ad Te Damine
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 04 May 2004 :  18:18:42  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Very interesting, I like the idea, but I agree there should be a solution without additional database hits.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 04 May 2004 :  18:22:54  Show Profile  Visit PeeWee.Inc's Homepage
You could do it with the cookies.

However, i think i would keep it as it is, but add some code so that the table is cleared every 30 days or something.

De Priofundus Calmo Ad Te Damine
Go to Top of Page

ajhvdb
Junior Member

Netherlands
392 Posts

Posted - 05 May 2004 :  15:26:20  Show Profile
I just finished the same mod http://forum.snitz.com/forum/topic.asp?TOPIC_ID=51723 2 months ago. I used the "who read topic" Mod and added the clearing of the whoread table. In a small community this kind of mod does work without any performance problems.
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 05 May 2004 :  15:29:17  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Must have missed that one, ajhvdb!
Will give it a try.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

nyquist
Starting Member

Italy
6 Posts

Posted - 05 May 2004 :  17:03:37  Show Profile
quote:
Originally posted by ajhvdb

I just finished the same mod http://forum.snitz.com/forum/topic.asp?TOPIC_ID=51723 2 months ago. I used the "who read topic" Mod and added the clearing of the whoread table. In a small community this kind of mod does work without any performance problems.


i must have have missed that one too
looking at your mod i've seen you've also add a feature to recognize new replies to a 'yet read' topic, interesting

the only think i don't agree to is the need of performances loss. Maybe the ADMIN should choose wether to use cookies or database tables. I'll be working on this ASAP, unfortunately i don't have much time till the next week.
Go to Top of Page

ajhvdb
Junior Member

Netherlands
392 Posts

Posted - 06 May 2004 :  03:52:18  Show Profile
Note that with cookies you are limited to 4 Kb. Also when a topic is opened a counter is updated "total read topic". This is standard snitz and if you delete that peace of code there won't be any performance loss.

Can you see the irony. You are looking for a Mod to prevent missing topics to read, but you can't find it because...

Edited by - ajhvdb on 06 May 2004 03:59:18
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07