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/O Code)
 Jump to the first unread post in topic
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

Webbo
Average Member

United Kingdom
982 Posts

Posted - 18 September 2015 :  02:39:57  Show Profile  Visit Webbo's Homepage  Reply with Quote
That could work as long as there are no new posts to the thread since the member's last visit. If new posts then the thread would need unmarking or remarking as 'new posts since last visit' and a link or button to take you to the first of the unread posts
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 18 September 2015 :  04:22:46  Show Profile  Reply with Quote
If you marked the topic (and specific replies) as having been read, but new replies were not marked, only the new replies would be shown as new. The requirement would, as HuwR indicated, be covered by a field for every topic/reply listing any user(s) who had read them.

I'll see if I can write something that will do it when I get back from the hospital, if nobody beats me to it.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 18 September 2015 :  05:02:42  Show Profile  Visit HuwR's Homepage  Reply with Quote
For high volume sites with many users it may be better from a performance perspective to normalize the hasread field into a separate table
A simple join in the retrieve posts query should grab the data you need though.
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 18 September 2015 :  22:34:28  Show Profile  Reply with Quote
OK- I wrote a mod that will do what you want. There may be a more efficient way of doing the same thing, but I'm tired. If someone else wants to rewrite it, feel free.

It requires two new fields in the database, one new image, and three small changes to files.

First, save the following in your forum directory as "dbs_trackviews.asp", and run Mod Setup from admin console.


Track Views 1.0

[ALTER]
TOPICS
ADD#T_VIEWLIST#MEMO#NULL#
[END]


[ALTER]
REPLY
ADD#R_VIEWLIST#MEMO#NULL#
[END]


Next, make the following changes to your existing files:

"default.asp"


Look for the following lines (appx 1039-1045):

		if (showicon = true) then DoLastPostLink = DoLastPostLink & getCurrentIcon(strIconLastpost,"Jump to Last Post","align=""absmiddle""") & "</a>"
	elseif ForumLastPostTopicID <> 0 then
		DoLastPostLink = "<a href=""topic.asp?TOPIC_ID=" & ForumLastPostTopicID & """>"
		if (showicon = true) then DoLastPostLink = DoLastPostLink & getCurrentIcon(strIconLastpost,"Jump to Last Post","align=""absmiddle""") & "</a>"
	else
		DoLastPostLink = ""
	end if

If keeping both "Jump to Last Post" link and "Unread Post" link, then change them to say:


		if (showicon = true) then DoLastPostLink = DoLastPostLink & getCurrentIcon(strIconLastpost,"Jump to Last Post","align=""absmiddle""") & "</a> "&DoLastUnreadLink
	elseif ForumLastPostTopicID <> 0 then
		DoLastPostLink = "<a href=""topic.asp?TOPIC_ID=" & ForumLastPostTopicID & """>"
		if (showicon = true) then DoLastPostLink = DoLastPostLink & getCurrentIcon(strIconLastpost,"Jump to Last Post","align=""absmiddle""") & "</a> "&DoLastUnreadLink
	else
		DoLastPostLink = ""
	end if
	'	## Track Views Above


Otherwise, if keeping only "Unread Post" link, then change them to say:


		if (showicon = true) then DoLastPostLink = DoLastUnreadLink
		'	##	Track Views Above


Look for the following line (appx 1034):

Function DoLastPostLink(showicon)

Below it, insert these:


	'	##	Track Views Below
	DoLastUnreadLink = ""
	strSqlUR="SELECT FORUM_ID, TOPIC_ID, T_VIEWLIST FROM " & strTablePrefix & "TOPICS WHERE FORUM_ID=" & ForumID & " ORDER BY TOPIC_ID DESC"
	Set rsUR = my_Conn.Execute(strSqlUR)
	If Not rsUR.EOF Then
		rsUR.MoveFirst
		Do While Not rsUR.EOF
			If rsUR("T_VIEWLIST") > "" Then
				If InStr(rsUR("T_VIEWLIST"), "|" & CStr(MemberID) & "|") = 0 Then
					Topic_UnreadID = rsUR("TOPIC_ID")
				End If
			Else
				Topic_UnreadID = rsUR("TOPIC_ID")
			End If
			rsUR.MoveNext
		Loop
		rsUR.Close
	End If
	Set rsUR = Nothing
	If Topic_UnreadID > 0 Then intTUI = CLng(Topic_UnreadID) Else intTUI = 0
	strSqlUR = "SELECT FORUM_ID, TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE FORUM_ID=" & ForumID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
	Set rsUR = my_Conn.Execute(strSqlUR)
	If Not rsUR.EOF Then
		rsUR.MoveFirst
		Do While Not rsUR.EOF
			If rsUR("R_VIEWLIST") > "" Then
				If InStr(rsUR("R_VIEWLIST"), "|" & CStr(MemberID) & "|") = 0 Then
					If rsUR("TOPIC_ID") < Topic_UnreadID Then Topic_UnreadID = rsUR("TOPIC_ID")
				End If
			Else
				If rsUR("TOPIC_ID") < Topic_UnreadID Then Topic_UnreadID = rsUR("TOPIC_ID")
			End If
			rsUR.MoveNext
		Loop
		rsUR.Close
	End If
	Set rsUR = Nothing



"topic.asp"


Look for the following lines (appx 79-81):

mypage = request("whichpage")
if ((Trim(mypage) = "") or (IsNumeric(mypage) = False)) then mypage = 1
mypage = cLng(mypage)

After those, insert these:


'	##	Track Views Below
Dim strViewed, intLSV, intFound
strViewed="":intLSV=0 : intFound = 0
If MemberID > 0 Then strMID = CStr(MemberID) Else strMID=""
strSqlVL = "SELECT TOPIC_ID, T_VIEWLIST FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID=" & TOPIC_ID
Set rsViewed = my_Conn.Execute(strSqlVL)
If Not (rsViewed.BOF Or rsViewed.EOF) Then
	strViewed = Trim(rsViewed("T_VIEWLIST"))
	If Len(strViewed) > 0 Then
		intLSV = Len(strViewed)
		If InStr(strViewed, "|" & strMid & "|") = 0 Then
			strViewed = strViewed & strMid & "|"
		Else
			intFound = 1
		End If
	Else
		strViewed = "|" & strMid & "|"
	End If
	rsViewed.Close
End If
Set rsViewed = Nothing
If strMid > "" Then
	If intFound = 0 Then
		strSqlTV = "UPDATE " & strTablePrefix & "TOPICS SET T_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID
		my_conn.Execute (strSqlTV),,adCmdText + adExecuteNoRecords
		strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
		Set rsViewed = my_Conn.Execute(strSqlRL)
		If Not rsViewed.EOF Then
			rsViewed.MoveFirst
			strViewed = ""
			Do While Not rsViewed.EOF
				strViewed = Trim(rsViewed("R_VIEWLIST"))
				If Len(strViewed) > 0 Then
					If InStr(strViewed, "|" & strMid & "|") = 0 Then
						strViewed = strViewed & strMid & "|"
					Else
						strViewed = "|" & strMid & "|"
					End If
				Else
					strViewed = "|" & strMid & "|"
				End If
				strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
				my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
				rsViewed.MoveNext
			Loop
			rsViewed.Close
		End If
		Set rsViewed = Nothing
	Else
		strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
		Set rsViewed = my_Conn.Execute(strSqlRL)
		If Not rsViewed.EOF Then
			rsViewed.MoveFirst
			strViewed = ""
			Do While Not rsViewed.EOF
				strViewed = Trim(rsViewed("R_VIEWLIST"))
				If Len(strViewed) > 0 Then
					If InStr(strViewed, "|" & strMid & "|") = 0 Then
						strViewed = strViewed & strMid & "|"
					Else
						strViewed = "|" & strMid & "|"
					End If
				Else
					strViewed = "|" & strMid & "|"
				End If
				strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
				my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
				rsViewed.MoveNext
			Loop
			rsViewed.Close
		End If
		Set rsViewed = Nothing
	End If
ElseIf intLSV = 0 And strMid > "" Then
	strViewed = "|" & strMid & "|"
	strSqlTV = "UPDATE " & strTablePrefix & "TOPICS SET T_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID
	my_conn.Execute (strSqlTV),,adCmdText + adExecuteNoRecords
	strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
	Set rsViewed = my_Conn.Execute(strSqlRL)
	If Not rsViewed.EOF Then
		rsViewed.MoveFirst
		strViewed = ""
		Do While Not rsViewed.EOF
			strViewed = Trim(rsViewed("R_VIEWLIST"))
			If Len(strViewed) > 0 Then
				If InStr(strViewed, "|" & strMid & "|") = 0 Then
					strViewed = strViewed & strMid & "|"
				Else
					strViewed = "|" & strMid & "|"
				End If
			Else
				strViewed = "|" & strMid & "|"
			End If
			strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
			my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
			rsViewed.MoveNext
		Loop
		rsViewed.Close
	End If
	Set rsViewed = Nothing
End If
'	##	Track Views Above



"inc_iconfiles.asp"


Look for the following line (appx 148):

Const strIconZap = "icon_zap.gif|16|16"

Below it, insert these:


'	##	Track Views Below
Const strIconUnread = "icon_unread.png|21|15"
'	##	Track Views Above



Finally, insert this icon (or some icon of your choice) into your images folder. It should be called "icon_unread.png" and dimensions should be 21x15 (or some multiple thereof). If dimensions do not match, you'll have to change the dimensions in "inc_iconfiles.asp".


Edited by - Carefree on 04 October 2015 16:01:10
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 19 September 2015 :  05:17:12  Show Profile  Visit Webbo's Homepage  Reply with Quote
Thanks Carefree, I'll add it and give it a try later today
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 19 September 2015 :  05:52:07  Show Profile  Visit HuwR's Homepage  Reply with Quote
@Carefree

This logic from topic.asp doesn't look right


If Len(strViewed) > 0 Then
		intLSV = Len(strViewed)
		If InStr(strViewed, "|" & strMid & "|") = 0 Then
			strViewed = strViewed & strMid & "|"
			intFound = 1
		Else
			strViewed = "|" & strMid & "|"
		End If
	Else
		strViewed = "|" & strMid & "|"
	End If

Shouldn't it be

If Len(strViewed) > 0 Then
		intLSV = Len(strViewed)
		If InStr(strViewed, "|" & strMid & "|") = 0 Then 
			'we didn't find it, so append to strViewed and set intViewed=0
			strViewed = strViewed & strMid & "|"
			intFound = 0
		Else
			we did find it, so set intFound = 1 
			strViewed = "|" & strMid & "|"We don't need to change strViewed here
			intFound = 1
		End If
	Else
		strViewed = "|" & strMid & "|"
	End If

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 19 September 2015 :  06:04:27  Show Profile  Visit HuwR's Homepage  Reply with Quote
I'm also not certain that having an R_VIEWLIST has much meaning, since there is no concept of having read a reply.

You could track topic pagenum maybe, but don't see how you decide if a reply has been read



MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 19 September 2015 :  15:35:18  Show Profile  Reply with Quote
R_Viewlist has a meaning. If a member reads a topic on X date, but later a reply is added that he/she has not seen, it will trigger new content notification.

@HuwR

Yes, just about correct on that change: We don't need the line crossed out since intFound was already set to 0.

quote:
Shouldn't it be


If Len(strViewed) > 0 Then
		intLSV = Len(strViewed)
		If InStr(strViewed, "|" & strMid & "|") = 0 Then 
			'we didn't find it, so append to strViewed and set intViewed=0
			strViewed = strViewed & strMid & "|"
			intFound = 0
		Else
			we did find it, so set intFound = 1 
			strViewed = "|" & strMid & "|"We don't need to change strViewed here
			intFound = 1
		End If

Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 19 September 2015 :  16:52:51  Show Profile  Visit golfmann's Homepage  Reply with Quote
I'm jumping in here again to offer an idea (again). I would do this but don't have the skills or patience to learn.

How about:
some sort of "Posts To You" and "REPLIES To you" on a per member basis alert in the header (sort of like the avatar approval mod)
The jump to last post thing works well enough for me to keep up on others posts (using the active.asp). Wouldn't this do for most?

BUT... a posts or replies to posts (or other replies) of a member has always been sorely missing, IMO
Any member would understand this pretty fast and most are self interested by nature anyway.

Plus a per member basis could be easier to track and smaller AND accessible across any device, would it not?

OK free 2 cents has been offered

Edited by - golfmann on 19 September 2015 16:55:17
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 19 September 2015 :  18:06:24  Show Profile  Reply with Quote
Already have this capability in Subscriptions....
Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 19 September 2015 :  20:59:23  Show Profile  Visit golfmann's Homepage  Reply with Quote
I thought subscriptions were emailed...
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 20 September 2015 :  03:39:25  Show Profile  Reply with Quote
They are. Not sure exactly what you want here. An indicator of topics with new replies BUT only those which you either created the topic or had previously replied to?
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 20 September 2015 :  04:03:06  Show Profile  Visit HuwR's Homepage  Reply with Quote
quote:
Originally posted by Carefree

R_Viewlist has a meaning. If a member reads a topic on X date, but later a reply is added that he/she has not seen, it will trigger new content notification.



Ok, got ya, however it may be better to populate r_viewlist on a page basis, so if I open a topic with say 3 pages and only read the first page, the other replies in the topic does not get flagged as read, slightly more work, but a more accurate reflection of what you have read maybe.

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 21 September 2015 :  00:33:38  Show Profile  Reply with Quote
OK. This is untested, but should do it.

"topic.asp" code


'	##	Track Views Below
Dim strViewed, intLSV, intFound
strViewed="":intLSV=0 : intFound = 0
If MemberID > 0 Then strMID = CStr(MemberID) Else strMID=""
strSqlVL = "SELECT TOPIC_ID, T_VIEWLIST FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID=" & TOPIC_ID
Set rsViewed = my_Conn.Execute(strSqlVL)
If Not (rsViewed.BOF Or rsViewed.EOF) Then
	strViewed = Trim(rsViewed("T_VIEWLIST"))
	If Len(strViewed) > 0 Then
		intLSV = Len(strViewed)
		If InStr(strViewed, "|" & strMid & "|") = 0 Then
			strViewed = strViewed & strMid & "|"
		Else
			intFound = 1
		End If
	Else
		strViewed = "|" & strMid & "|"
	End If
	rsViewed.Close
End If
Set rsViewed = Nothing
If strMid > "" Then
	If intFound = 0 Then
		strSqlTV = "UPDATE " & strTablePrefix & "TOPICS SET T_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID
		my_conn.Execute (strSqlTV),,adCmdText + adExecuteNoRecords
		strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
		Set rsViewed = my_Conn.Execute(strSqlRL)
		If Not rsViewed.EOF Then
			If Request("whichpage") > "" Then 
				reViewed.Move(25 * whichpage)
			Else
				rsViewed.MoveFirst
			End If
			strViewed = "" : intI = 0
			Do While Not rsViewed.EOF
				intI = intI + 1
				If intI = 26 Then Exit Do
				strViewed = Trim(rsViewed("R_VIEWLIST"))
				If Len(strViewed) > 0 Then
					If InStr(strViewed, "|" & strMid & "|") = 0 Then
						strViewed = strViewed & strMid & "|"
					Else
						strViewed = "|" & strMid & "|"
					End If
				Else
					strViewed = "|" & strMid & "|"
				End If
				strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
				my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
				rsViewed.MoveNext
			Loop
			rsViewed.Close
		End If
		Set rsViewed = Nothing
	Else
		strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
		Set rsViewed = my_Conn.Execute(strSqlRL)
		If Not rsViewed.EOF Then
			If Request("whichpage") > "" Then 
				reViewed.Move(25 * whichpage)
			Else
				rsViewed.MoveFirst
			End If
			strViewed = "" : intI = 0
			Do While Not rsViewed.EOF
				intI = intI + 1
				If intI = 26 Then Exit Do
				strViewed = Trim(rsViewed("R_VIEWLIST"))
				If Len(strViewed) > 0 Then
					If InStr(strViewed, "|" & strMid & "|") = 0 Then
						strViewed = strViewed & strMid & "|"
					Else
						strViewed = "|" & strMid & "|"
					End If
				Else
					strViewed = "|" & strMid & "|"
				End If
				strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
				my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
				rsViewed.MoveNext
			Loop
			rsViewed.Close
		End If
		Set rsViewed = Nothing
	End If
ElseIf intLSV = 0 And strMid > "" Then
	strViewed = "|" & strMid & "|"
	strSqlTV = "UPDATE " & strTablePrefix & "TOPICS SET T_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID
	my_conn.Execute (strSqlTV),,adCmdText + adExecuteNoRecords
	strSqlRL = "SELECT TOPIC_ID, REPLY_ID, R_VIEWLIST FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & TOPIC_ID & " ORDER BY TOPIC_ID DESC, REPLY_ID DESC"
	Set rsViewed = my_Conn.Execute(strSqlRL)
	If Not rsViewed.EOF Then
		If Request("whichpage") > "" Then 
			reViewed.Move(25 * whichpage)
		Else
			rsViewed.MoveFirst
		End If
		strViewed = "" : intI = 0
		Do While Not rsViewed.EOF
			intI = intI + 1
			If intI = 26 Then Exit Do
			strViewed = Trim(rsViewed("R_VIEWLIST"))
			If Len(strViewed) > 0 Then
				If InStr(strViewed, "|" & strMid & "|") = 0 Then
					strViewed = strViewed & strMid & "|"
				Else
					strViewed = "|" & strMid & "|"
				End If
			Else
				strViewed = "|" & strMid & "|"
			End If
			strSqlRV = "UPDATE " & strTablePrefix & "REPLY SET R_VIEWLIST='" & strViewed & "' WHERE TOPIC_ID = " & Topic_ID & " AND REPLY_ID=" & rsViewed("REPLY_ID")
			my_conn.Execute (strSqlRV),,adCmdText + adExecuteNoRecords
			rsViewed.MoveNext
		Loop
		rsViewed.Close
	End If
	Set rsViewed = Nothing
End If
'	##	Track Views Above
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 26 September 2015 :  02:15:20  Show Profile  Visit Webbo's Homepage  Reply with Quote
Just letting you all know I'm not ignoring you
Had a busy week with one thing and another so not had any time to implement this
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07