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)
 My Recent Posts for default.asp page
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bax
Junior Member

141 Posts

Posted - 20 August 2002 :  06:19:59  Show Profile
I wanted to be able to have my users see their recent posts without having to dig into their members detail stuff, and without having to go to a mySnitz.asp page (there is a my.asp mod floating around somewhere that is quite robust and useful).

anyway, I wrote this today to allow you to include users' most recent posts on the default.asp page. I have the luxury of knowing users will be logged in - if you don't, you'd need to add a couple lines of code to ensure that.

Comments, please let me know. To integrate it, just call WriteRecentTopics write above where it says WriteStatistics. Could be made more modular - the SQL is duplicated in the pop_profile.asp page. Probably should be an interface to some type of member object that would get that SQL and keep it all in one place.

Sincerely,

Bryan Ax


sub WriteRecentTopics()

if strRecentTopics = "1" then
strStartDate = DateToStr(dateadd("d", -30, strForumTimeAdjust))

'## Forum_SQL - Find all records for the member
strsql = "SELECT F.FORUM_ID"
strSql = strSql & ", T.TOPIC_ID"
strSql = strSql & ", T.T_SUBJECT"
strSql = strSql & ", T.T_STATUS"
strSql = strSql & ", T.T_LAST_POST"
strSql = strSql & ", T.T_REPLIES "
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM F LEFT JOIN " & strTablePrefix & "TOPICS T"
strSql = strSql & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strTablePrefix & "REPLY R"
strSql = strSql & " ON T.TOPIC_ID = R.TOPIC_ID) "
strSql = strSql & " WHERE (T_DATE > '" & strStartDate & "') "
strSql = strSql & " AND (T.T_AUTHOR = " & MemberID
strSql = strSql & " OR R.R_AUTHOR = " & MemberID & ")"
strSql = strSql & " AND (T_STATUS < 2 OR R_STATUS < 2)"
strSql = strSql & " AND F.F_TYPE = 0"
strSql = strSql & " ORDER BY T.T_LAST_POST DESC, T.TOPIC_ID DESC"

set rs2 = my_Conn.Execute(strsql)

Response.Write " <tr>" & vbNewline & _
" <td bgcolor=""" & strCategoryCellColor & """ colspan=""7""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """><b>My Recent Topics</b></font></td>" & vbNewline & _
" </tr>"

if rs2.EOF or rs2.BOF then
Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""" & strPopUpTableColor & """ colspan=""2""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """> <br /> <b>No Matches Found...<br /> </b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
else
currTopic = 0
TopicCount = 0
do until rs2.EOF or (TopicCount = 10)
if chkForumAccess(rs2("FORUM_ID"),MemberID,false) then
if currTopic <> rs2("TOPIC_ID") then

Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <a href=""topic.asp?TOPIC_ID=" & rs2("TOPIC_ID") & """>"
if rs2("T_STATUS") <> 0 then
if strHotTopic = "1" then
if rs2("T_LAST_POST") > Session(strCookieURL & "last_here_date") then
if rs2("T_REPLIES") >= intHotTopicNum then
Response.Write getCurrentIcon(strIconFolderNewHot,"Hot Topic","align=""absmiddle""") & "</a></td>" & vbNewLine
else
Response.Write getCurrentIcon(strIconFolderNew,"New Topic","align=""absmiddle""") & "</a></td>" & vbNewLine
end if
else
if rs2("T_REPLIES") >= intHotTopicNum then
Response.Write getCurrentIcon(strIconFolderHot,"Hot Topic","align=""absmiddle""") & "</a></td>" & vbNewLine
else
Response.Write getCurrentIcon(strIconFolder,"","align=""absmiddle""") & "</a></td>" & vbNewLine
end if
end if
else
if rs2("T_LAST_POST") > Session(strCookieURL & "last_here_date") then
Response.Write getCurrentIcon(strIconFolderNew,"New Topic","align=""absmiddle""") & "</a></td>" & vbNewLine
else
Response.Write getCurrentIcon(strIconFolder,"","align=""absmiddle""") & "</a></td>" & vbNewLine
end if
end if
else
if rs2("T_LAST_POST") > Session(strCookieURL & "last_here_date") then
Response.Write getCurrentIcon(strIconFolderNewLocked,"Topic Locked","align=""absmiddle""") & "</a></td>" & vbNewLine
else
Response.Write getCurrentIcon(strIconFolderLocked,"Topic Locked","align=""absmiddle""") & "</a></td>" & vbNewLine
end if
end if
'now write the cell for the Topic Description.
Response.Write " <td bgcolor=""" & strForumCellColor & """ align=""left"" valign=""middle"" colspan=""6""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """> <a href=""topic.asp?TOPIC_ID=" & rs2("TOPIC_ID") & """>" & ChkString(rs2("T_SUBJECT"),"display") & "</a> </font></td>" & vbNewLine & _
" </tr>" & vbNewLine
TopicCount = TopicCount + 1
end if
currTopic = rs2("TOPIC_ID")
end if
rs2.MoveNext
loop
end if
rs2.close
set rs2 = nothing
end if
end sub

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 August 2002 :  06:57:24  Show Profile  Send ruirib a Yahoo! Message
Just so that you now, there was a 3.3.x mod to do something like this, that posts not only recent topics, but also replies.

Here is a link: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=26577

At the end there is code for a stored procedure that gives you the 10 most recent posts for a user:

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=26577&whichpage=3#124994


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

bax
Junior Member

141 Posts

Posted - 20 August 2002 :  07:45:43  Show Profile
Ruirib:

This appears to be similar - however, it's where it appears that I changed, not the information itself. I wanted this directly on the default.asp page, with formatting the same as the other stuff on default.asp - not trying to take away your cool mod, just put it on the default page with default page formatting.
Go to Top of Page

Aaron S.
Average Member

USA
985 Posts

Posted - 20 August 2002 :  07:47:22  Show Profile  Visit Aaron S.'s Homepage
Check the link in my signature for the final Recent Posts code that Rui and I came up with (there is a different version based on the Db you are using).

--Aaron

DOWNLOAD GREAT NEW MODS HERE
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 August 2002 :  07:52:49  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by bax

Ruirib:

This appears to be similar - however, it's where it appears that I changed, not the information itself. I wanted this directly on the default.asp page, with formatting the same as the other stuff on default.asp - not trying to take away your cool mod, just put it on the default page with default page formatting.


I was not worried that you were replicating the existing MOD (it's really Aaron's mod, I just gave a small help with the SQL). I was just alerting to its existence, if you wanted to use it, because you can use it, or part of it, to obtain both topics and replies by authored by the user. I did this because your mod only uses topics authored by the user, not replies.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

bax
Junior Member

141 Posts

Posted - 20 August 2002 :  07:54:37  Show Profile
Gotcha - thanks - I'll have a look at it tomorrow.
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.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07