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

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 Add active poll count to stats
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

RebelTech
Average Member

USA
613 Posts

Posted - 08 November 2003 :  02:03:26  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I was thinking of adding the active poll count to the statistics found in the default .asp. Can anyone show me how to grab the active polls count?
For example, in Statistics have a row that reads:
"There are currently x active polls"

Like what is done with Active Topics.

Edited by - RebelTech on 08 November 2003 02:52:50

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 08 November 2003 :  09:34:04  Show Profile
How many active polls displayed depends on how haw many days back you want to check for active polls. Since the date is defaulted to active polls in last 30 days. But that can be changed by the users.

Unless you're saying how many active polls are there since the user last logged in.

I can't promise I will code something for you. But I'll see what i can do.

Support Snitz Forums
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 08 November 2003 :  15:05:57  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
quote:
Unless you're saying how many active polls are there since the user last logged in.


That's what I was trying to say, sorry about not being very clear. I was wanting to add a row in the stats at the bottom of the default .asp the just reported the number of active polls.
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 10 November 2003 :  11:06:26  Show Profile
Ok here goes. In your default.asp page, look for the following code (around line 865):
ActiveTopicCount = -1
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
Add this code below it:
'################################ Poll Mod ################################
ActivePollCount = -1
if not IsNull(Session(strCookieURL & "last_here_date")) then 
	if not blnHiddenForums then

		'## Forum_SQL - Get ActiveTopicCount from DB
		strSql = "SELECT COUNT(P.P_LASTVOTE) AS POLL_ACTIVE, COUNT(T.T_LAST_POST) AS POLL_ACTIVE2" &_
			 " FROM " & strTablePrefix & "POLLS P, " & strTablePrefix & "TOPICS T" &_
			 " WHERE P.TOPIC_ID = T.TOPIC_ID AND T.T_POLLSTATUS = 1" &_
			 " AND ((P.P_LASTVOTE > '"& Session(strCookieURL & "last_here_date") & "'" & _
			 " OR T.T_LAST_POST > '"& Session(strCookieURL & "last_here_date") & "'))"

		set rs = Server.CreateObject("ADODB.Recordset")
		rs.open strSql, my_Conn
			
		if not rs.EOF then
			ActivePollCount = rs("POLL_ACTIVE") + rs("POLL_ACTIVE2")
		else
			ActivePollCount = 0
		end if

		rs.close
		set rs = nothing
	end if
end if
'#############################################################################

Just a few lines down, (about 30 lines down) find this code:
if ShowLastHere then
	Response.Write	"5"
else
	Response.Write	"4"
end if
Change it to this:
if ShowLastHere then
	Response.Write	"6"
else
	Response.Write	"5"
end if
Then further down, find this bit of code:
	Response.Write	"</a></span> since you last visited."
elseif blnHiddenForums and (strLastPostDate > Session(strCookieURL & "last_here_date")) and ShowLastHere then
	Response.Write	" and there are <span class=""spnMessageText""><a href=""active.asp"">active topics</a></span> since you last visited."
elseif not(ShowLastHere) then
	Response.Write	"."
else
	Response.Write	" and no active topics since you last visited."
end if
Response.Write	"</font></td>" & vbNewline & _
		"              </tr>" & vbNewline
Below it, add this:
'########################### Poll Mod #################################
	Response.Write	"          <tr>"
	Response.Write	"            <td bgcolor=""" & strForumCellColor & """ colspan=""" & sGetColspan(6,5) &_
		""">" & _
		"<font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """ color=""" & strForumFontColor & """>There "
	if ActivePollCount = 1 then
		Response.Write	"is "
	else
		Response.Write	"are "
	end if
	Response.Write	" currently "
	if ActivePollCount > 0 then
		Response.Write	ActivePollCount
	else
		Response.Write	"no"
	end if
	if ActivePollCount > 0 then
		if ActivePollCount = 1 then
			Response.Write	" <span class=""spnMessageText""><a href=""active_polls.asp"">active poll</a></span>"
		else
			Response.Write	" <span class=""spnMessageText""><a href=""active_polls.asp"">active polls</a></span>"
		end if
	else
		Response.Write	" active polls"
	end if
	Response.Write	" since you last visited.</font>" & _
			"</td></tr>"
'#########################################################################
That's it.

Support Snitz Forums
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 11 November 2003 :  05:01:58  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Davio, I am sorry you had to do so much coding. But, I really thank you. It worked great. This helps to make the statistic area a little more useful! I have even added a visitor count there. Thank you again.
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 11 November 2003 :  05:14:04  Show Profile  Visit richfed's Homepage
Kudos, Davio!
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 11 November 2003 :  09:46:03  Show Profile
You're Welcome.

Support Snitz Forums
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.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07