Active Topics Link - Posted (2850 Views)
Senior Member
leatherlips
Posts: 1838
1838
Currently, there is a link at the top of the forum that says "Active Topics". I would like to possibly add the number of new topics added since a users last visit. It would look something like this:

Active Topics (5)
The number would represent the additional topics that were new since a users last visit. It would change dependent on the actual number of active topics for that user. If no new topics were added then it would either look like:

Active Topics
or

Active Topics (0)
Does anyone know how to do this?
Of course the formatting of the way the link looks does not have to be limited to what I suggested. It could also look something like this:

5 Active Topics<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Senior Member
MaD2ko0l
Posts: 1053
1053
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=31252&SearchTerms=Active,Topics

been done many times ;-)<
© 1999-2010 MaD2ko0l
Posted
Senior Member
leatherlips
Posts: 1838
1838
Thanks.
I'm trying to add it but hava a problem. I am getting an error:

Code:
Type mismatch: 'getNewMemberNumber'

It is around this area in the code:

Code:
if rsForum.eof or rsForum.bof then
'nothing
else
i = 0
do until rsForum.Eof
ForumID = rsForum("FORUM_ID")
if ChkForumAccess(ForumID, getNewMemberNumber()) then
i = i + 1
if i = 1 Then
strSql = strSql & " AND ("
else
strSql = strSql & " OR "
end If
strSQL = strSQL & "F.FORUM_ID=" & ForumID
end if
rsForum.MoveNext
loop
rsForum.close
set rsForum = Nothing
if i > 0 Then
strSql = strSql & ") "
end If
end if
end If
strSql = strSql & "AND (T.T_LAST_POST > '" & lastDate & "'"
This mod is for an older version of Snitz. Can anyone update it for the current version? Here is the code it uses. I figured out that inc_functions.asp now is inc_func_common.asp and inc_top.asp is now inc_header.asp. Perhaps there are other sections in the code itself that need to be renamed to make it work with the current version of Snitz?<
Posted
Senior Member
leatherlips
Posts: 1838
1838
I just realized (blush) that in the statistics at the bottom of the forum, it already tells you how many active topics there are since your last visit. Perhaps that number can be added to the link in the header? How would I do that?<
Posted
Senior Member
MaD2ko0l
Posts: 1053
1053
http://mad2kool.co.uk/forum/faq.asp works fine on my site with no changes.
i put all the code into inc_header, just to test but if you wanted to do it proper then you woudl put the code in in_func_common.asp and then make the change in inc_header.asp to display the link.<
© 1999-2010 MaD2ko0l
Posted
Average Member
phy1729
Posts: 589
589
In inc_func_common.asp line 1373
[code] Case "members.asp"
strNewTitle = strForumTitle & " - Members"
Case "active.asp" ActiveTopicCount = 0
if not IsNull(Session(strCookieURL & "last_here_date")) then
if not blnHiddenForums then

'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE " &_
" FROM " & strTablePrefix & "TOPICS " &_
" WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))" &_
" AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"

set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn

if not rs.EOF then
ActiveTopicCount = rs("NUM_ACTIVE")
else
ActiveTopicCount = 0
end if

rs.close
set rs = nothing
end if
end if
strNewTitle = strForumTitle & " - Active Topics (" & ActiveTopicCount & ")"
Case "faq.asp"
strNewTitle = strForumTitle & " - Frequently Asked Questions"<
Posted
Senior Member
MaD2ko0l
Posts: 1053
1053
phy: that isnt quite what he wanted. but u coudl use that code in inc_header.
find this

Code:
	end if
Response.Write " |" & vbNewline & _
" <a href=""active.asp""" & dWStatus("See what topics have been active since your last visit...") & " tabindex=""-1""><acronym title=""See what topics have been active since your last visit..."">Active Topics</acronym></a>" & vbNewline

and replace it with this

Code:
	end if

ActiveTopicCount = 0
if not IsNull(Session(strCookieURL & "last_here_date")) then
if not blnHiddenForums then

'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE " &_
" FROM " & strTablePrefix & "TOPICS " &_
" WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))" &_
" AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"

set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn

if not rs.EOF then
ActiveTopicCount = rs("NUM_ACTIVE")
else
ActiveTopicCount = 0
end if

rs.close
set rs = nothing
end if
end if

Response.Write " |" & vbNewline & _
" <a href=""active.asp""" & dWStatus("See what topics have been active since your last visit...") & " tabindex=""-1""><acronym title=""See what topics have been active since your last visit..."">Active Topics (" & ActiveTopicCount & ")</acronym></a>" & vbNewline

thats another way to do it.
not to sure what the difference is/was between this and the 1 i posted earler.<
© 1999-2010 MaD2ko0l
Posted
Average Member
phy1729
Posts: 589
589
I thought he meant the title my bad. Oops.<
Posted
Senior Member
leatherlips
Posts: 1838
1838
I used the code you posted MaD2ko0l. The one in the mod you linked to gave me the error I posted above.
Yours is not giving me the error, however, it also displays new topics that I should not have access to such as private forums.
To test this, I made a post in a private forum that my test account does not have access to. Then I logged in with my test account and it shows that there is a new active topic. Of course if they click on the active topics link there are no new ones that it can see. But it still shows it in the active topics link.
Is there a way to take into consideration if the user has access to certain forums or not?<
Posted
Senior Member
MaD2ko0l
Posts: 1053
1053
and that would be why the 1st link i posted would filter out new posts in rivate forums.
have u changed the getNewMemberNumber or the ChkForumAccess functions??? as that may be a problem that you might need to add/change parameter to work properly<
© 1999-2010 MaD2ko0l
Posted
Senior Member
leatherlips
Posts: 1838
1838
I've not changed those functions as far as I know. However, anything is possible. blush
Here is my inc_func_common.txt file if you could take a look and see if there are any obvious errors.
The line that keeps giving the error is line 136:

Code:
if ChkForumAccess(ForumID, getNewMemberNumber()) then
Thanks.<
You Must enter a message