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)
 Including All Sticky Topics on Active Topics
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

stwilson
Junior Member

USA
385 Posts

Posted - 22 October 2004 :  09:52:45  Show Profile  Visit stwilson's Homepage
Has anyone modded up the Active Topics page to include all sticky topics, even if they have no new postings? The only reason I make topics sticky is to make sure they get looked at. BUT if they have no activity/new posts they are not seen on Active Topics. I would be interested in including all sticky topics (with or without new posts) on my Active Topics page. Any takers?

Shannon
RidingArizona.com

cripto9t
Average Member

USA
881 Posts

Posted - 22 October 2004 :  19:44:33  Show Profile
Displays sticky topics in active topics.
Only basic testing has been done, so if you find a bug let me know and I will do my best to fix it.

All code changes are in "active.asp" - Snitz version 3.4.04
The line numbers are approximate.

1. Find this code line 243
'## Forum_SQL - Get all active topics from last visit
strSql = "SELECT F.FORUM_ID, " & _
         "F.F_SUBJECT, " & _
	 "F.F_SUBSCRIPTION, " & _
	 "F.F_STATUS, " & _
         "C.CAT_ID, " & _
	 "C.CAT_NAME, " & _
	 "C.CAT_SUBSCRIPTION, " & _
	 "C.CAT_STATUS, " & _
	 "T.T_STATUS, " & _
	 "T.T_VIEW_COUNT, " & _
	 "T.TOPIC_ID, " & _
	 "T.T_SUBJECT, " & _
	 "T.T_AUTHOR, " & _
	 "T.T_REPLIES, " & _
	 "T.T_UREPLIES, " & _

ADD this line right after.
"T.T_STICKY, " & _



2. Find this code line 279
	 "AND (T.T_LAST_POST > '" & lastDate & "'"

REPLACE that with this.
if strStickyTopic = "1" then
                 strSql = strSql & "AND ((T.T_LAST_POST > '" & lastDate & "' OR T.T_STICKY = 1)"
         else
	         strSql = strSql & "AND (T.T_LAST_POST > '" & lastDate & "'"
         end if



3. Find this code line 285.
	if mlev = 3 and ModOfForums <> "" then
		strSql = strSql & " OR T.FORUM_ID IN (" & ModOfForums & ") "
	end if

ADD this right after.
if strStickyTopic = "1" then
                strSql = strSql & " OR T.T_STICKY = 1"
        end if



4. Find this code line 303.
strSql = strSql & " ORDER BY C.CAT_ORDER, C.CAT_NAME, F.F_ORDER, F.F_SUBJECT, T.T_LAST_POST DESC "

REPLACE that with this.
strSql = strSql & " ORDER BY C.CAT_ORDER, C.CAT_NAME, F.F_ORDER, F.F_SUBJECT, "
if strStickyTopic = "1" then
        strSql = strSql & "T.T_STICKY DESC, "
end if
strSql = strSql & "T.T_LAST_POST DESC "



5. Find this code line 434.
	fM_NAME = 15
	fT_LAST_POST_AUTHOR = 16
	fT_LAST_POST = 17
	fT_LAST_POST_REPLY_ID = 18
	fLAST_POST_AUTHOR_NAME = 19
	fF_PRIVATEFORUMS = 20
	fF_PASSWORD_NEW = 21

REPLACE that with this.
fT_STICKY = 15
	fM_NAME = 16
	fT_LAST_POST_AUTHOR = 17
	fT_LAST_POST = 18
	fT_LAST_POST_REPLY_ID = 19
	fLAST_POST_AUTHOR_NAME = 20
	fF_PRIVATEFORUMS = 21
	fF_PASSWORD_NEW = 22



6. Find this code line 459.
		Topic_UReplies = allActiveTopics(fT_UREPLIES,RowCount)

ADD this right after.
Topic_Sticky = allActiveTopics(fT_STICKY,RowCount)



7. Find this code line 510.
if Cat_Status <> 0 and Forum_Status <> 0 and Topic_Status <> 0 then
			' DEM --> Added code for topic moderation
			if Topic_Status = 2 then
				UnApprovedFound = "Y"
				Response.Write 	getCurrentIcon(strIconFolderUnmoderated,"Topic Not Moderated","hspace=""0""") & "</a>" & vbNewline
			elseif Topic_Status = 3 then
				HeldFound = "Y"
				Response.Write 	getCurrentIcon(strIconFolderHold,"Topic on Hold","hspace=""0""") & "</a>" & vbNewline
				' DEM --> end of code Added for topic moderation
			elseif lcase(strHotTopic) = "1" and Topic_Replies >= intHotTopicNum then
				Response.Write	getCurrentIcon(strIconFolderNewHot,"Hot Topic with New Posts","hspace=""0""") & "</a>" & vbNewline
			elseif Topic_Last_Post < lastdate then
				Response.Write	getCurrentIcon(strIconFolder,"No New Posts","") & "</a>" & vbNewline
			else
				Response.Write	getCurrentIcon(strIconFolderNew,"New Posts","") & "</a>" & vbNewline
			end if
		else
			if Cat_Status = 0 then
				strAltText = "Category"
			elseif Forum_Status = 0 then
				strAltText = "Forum"
			else
				strAltText = "Topic"
			end if
			if Topic_Last_Post < lastdate then
				Response.Write	getCurrentIcon(strIconFolderLocked,strAltText,"locked")
			else
				Response.Write	getCurrentIcon(strIconFolderNewLocked,strAltText,"locked")
			end if
			Response.Write	"</a>" & vbNewline
		end if

REPLACE that with this.
		if Cat_Status <> 0 and Forum_Status <> 0 and Topic_Status <> 0 then
			' DEM --> Added code for topic moderation
                        if Topic_Sticky and strStickyTopic = "1" then 
				if Topic_Last_Post > lastdate then
					Response.Write	getCurrentIcon(strIconFolderNewSticky,"New Sticky Topic","hspace=""0""")
				else
					Response.Write	getCurrentIcon(strIconFolderSticky,"Sticky Topic","hspace=""0""")
				end if
			else
			        if Topic_Status = 2 then
				        UnApprovedFound = "Y"
				        Response.Write 	getCurrentIcon(strIconFolderUnmoderated,"Topic Not Moderated","hspace=""0""") & "</a>" & vbNewline
			        elseif Topic_Status = 3 then
				        HeldFound = "Y"
				        Response.Write 	getCurrentIcon(strIconFolderHold,"Topic on Hold","hspace=""0""") & "</a>" & vbNewline
				        ' DEM --> end of code Added for topic moderation
			        elseif lcase(strHotTopic) = "1" and Topic_Replies >= intHotTopicNum then
			                Response.Write	getCurrentIcon(strIconFolderNewHot,"Hot Topic with New Posts","hspace=""0""") & "</a>" & vbNewline
			        elseif Topic_Last_Post < lastdate then
				        Response.Write	getCurrentIcon(strIconFolder,"No New Posts","") & "</a>" & vbNewline
			        else
				        Response.Write	getCurrentIcon(strIconFolderNew,"New Posts","") & "</a>" & vbNewline
			        end if
                        end if
		else
			if Cat_Status = 0 then
				strAltText = "Category"
			elseif Forum_Status = 0 then
				strAltText = "Forum"
			else
				strAltText = "Topic"
			end if
			if Topic_Last_Post < lastdate then
                                if Topic_Sticky and strStickyTopic = "1" then 
					Response.Write	getCurrentIcon(strIconFolderStickyLocked,strAltText,"hspace=""0""")
				else
				        Response.Write	getCurrentIcon(strIconFolderLocked,strAltText,"locked")
                                end if
			else
                                if Topic_Sticky and strStickyTopic = "1" then 
					Response.Write	getCurrentIcon(strIconFolderNewStickyLocked,strAltText,"hspace=""0""")
				else
				        Response.Write	getCurrentIcon(strIconFolderNewLocked,strAltText,"locked")
                                end if
			end if
			Response.Write	"</a>" & vbNewline
		end if

That's All :^)

    _-/Cripto9t\-_

Edited by - cripto9t on 22 October 2004 19:49:02
Go to Top of Page

billybobrob
Starting Member

7 Posts

Posted - 02 December 2004 :  20:15:25  Show Profile
I appear to be getting a syntax error pulling out on:

if strStickyTopic = "1" then
strSql = strSql & "AND ((T.T_LAST_POST > '" & lastDate & "' OR T.T_STICKY = 1)"
else
strSql = strSql & "AND (T.T_LAST_POST > '" & lastDate & "'"
end if

Can't see any reason for it. Anyone else having the same prob?
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 03 December 2004 :  10:20:08  Show Profile
quote:
Originally posted by billybobrob

I appear to be getting a syntax error pulling out on:

if strStickyTopic = "1" then
strSql = strSql & "AND ((T.T_LAST_POST > '" & lastDate & "' OR T.T_STICKY = 1)"
else
strSql = strSql & "AND (T.T_LAST_POST > '" & lastDate & "'"
end if

Can't see any reason for it. Anyone else having the same prob?


Did you fix this
I went back over it and everything looks ok. I've only tested on mySql.

If your forum is not live try adding
Response.Write strSql
Response.End
after the sql and check your () and spacing.

I did change one thing. I paired "sticky" with "status" like it is in "forum.asp"
It didn't change anything but it looks better .
Remove this code
if strStickyTopic = "1" then
                strSql = strSql & " OR T.T_STICKY = 1"
        end if

then replace this
if mlev <> 4 then
	strSql = strSql & " AND ((T.T_AUTHOR <> " & MemberID &_
			  " AND T.T_STATUS < 2)"  ' Ignore unapproved/held posts

with this
if mlev <> 4 then
	strSql = strSql & " AND ((T.T_AUTHOR <> " & MemberID 
        if strStickyTopic = "1" then
                strSql = strSql & " AND (T.T_STATUS < 2 OR T.T_STICKY = 1))"
        else
		strSql = strsql & " AND T.T_STATUS < 2)"  ' Ignore unapproved/held posts
        end if

    _-/Cripto9t\-_
Go to Top of Page

stwilson
Junior Member

USA
385 Posts

Posted - 11 December 2004 :  10:58:01  Show Profile  Visit stwilson's Homepage
Cripto9t,

I am just now getting around to trying the code you posted. Im was getting the same error as billybobrob. I made the secondary change you suggested and now I have a new error. I checked my spacing but no luck. I am on SQL. Here is a link to a txt version of my active.asp: http://www.ridingarizona.com/forum/active2.txt

Here is my beta page, so you can see the error: http://www.ridingarizona.com/forum/active2.asp

The error:
Microsoft OLE DB Provider for SQL Server error '80040e14'

Line 1: Incorrect syntax near ')'.

/forum/active2.asp, line 322


Line 322 looks like this: rs.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText

Any suggestions?

Shannon
RidingArizona.com
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 11 December 2004 :  14:21:21  Show Profile
I can't test with SQL, but I just tried it with Access and it works.
Your sql changes are wrong. The rest of the changes look fine.
There are 2 places to add this in "where". Steps 2 & 3 Above. The change I made was for step 3.
By the way, I tested both ways and they work.

Heres a link to a test forum.

Here's what I have
strSql = strSql & "AND F.F_TYPE = 0 " & _
	 "AND F.FORUM_ID = T.FORUM_ID " & _
	 "AND C.CAT_ID = T.CAT_ID " & _
	 "AND M.MEMBER_ID = T.T_AUTHOR "
	 if strStickyTopic = "1" then
                 strSql = strSql & "AND ((T.T_LAST_POST > '" & lastDate & "' OR T.T_STICKY = 1)"
         else
	         strSql = strSql & "AND (T.T_LAST_POST > '" & lastDate & "'"
         end if


' DEM --> if not an admin, all unapproved posts should not be viewed.
if mlev <> 4 then
	strSql = strSql & " AND ((T.T_AUTHOR <> " & MemberID 
        if strStickyTopic = "1" then
                strSql = strSql & " AND (T.T_STATUS < 2 OR T.T_STICKY = 1))"
        else
		strSql = strsql & " AND T.T_STATUS < 2)"  ' Ignore unapproved/held posts
        end if
	if mlev = 3 and ModOfForums <> "" then
		strSql = strSql & " OR T.FORUM_ID IN (" & ModOfForums & ") "
	end if
	strSql = strSql & "  OR T.T_AUTHOR = " & MemberID & ")"
end if

    _-/Cripto9t\-_

Edited by - cripto9t on 11 December 2004 14:23:04
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.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07