Author |
Topic  |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 06 March 2006 : 19:48:20
|
I have a menu line in my header and when we post in a private room, it increases the count in the active topics on this menu line. The active topics mod does NOT show the private post, so my members are questioning why the menu line says three, say and active topics has two! This is not good as is hurting some feelings. Can somebody look at this code and tell me how or what's wrong so I can drop private forums from the count in this menu code? MUCH thanks if you can...
ActiveTopicCount = -1
if IsEmpty(Session(strCookieURL & "last_here_date")) then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTUserName)
end if
if not IsNull(Session(strCookieURL & "last_here_date")) then
if not blnHiddenForums then <this is only mentioned once, here... what's this?
'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))"
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"
strSql = strSql & " AND " & strTablePrefix & "FType <> 0"
set rs = my_Conn.Execute(strSql)
if not rs.EOF then
ActiveTopicCount = rs("NUM_ACTIVE")
else
ActiveTopicCount = 0
end if
end if
end if
rs.close
set rs = nothing
example of menu line: http://www.wethepeopleforum.com/forum/active.asp |
Edited by - golfmann on 06 March 2006 22:07:52 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 06 March 2006 : 22:05:19
|
in the private category, just turn off post count incrementing.
 |
|
 |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 07 March 2006 : 00:35:53
|
I did that and it still does it in this menu thing! That's what has me ?????? |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 07 March 2006 : 04:01:58
|
turning off post count won't work since the code golfmann is posting is actually doing a count on the db. to stop it you will need to adjust the where clause of the query so that is does not count topics from the hidden forum.
so just add a line like below to the end of the query
strSql = strSql & " AND " & strTablePrefix & "FORUM_ID <> XXXXX"
where XXXXX is your hidden forum id, if you have more than one, then do something like
strSql = strSql & " AND " & strTablePrefix & "FORUM_ID NOT IN (XXXX,YYYY,ZZZZ)"
|
 |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 07 March 2006 : 12:02:27
|
Thank you Huw. THAT'S what I was looking for.  that bool blnHiddenForums was worthless in this code it seems, anyway, did nuttin' dim'd or not
Thanks again! |
Edited by - golfmann on 07 March 2006 12:05:12 |
 |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 07 March 2006 : 12:22:16
|
ok, inserted the code and get this (which is what got me here in the first place trying things) Microsoft OLE DB Provider for SQL Server error '80040e14'
Invalid column name 'FORUM_FORUM_ID'.
/forum/inc_header.asp, line 703
using this code:
'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))"
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"
strSql = strSql & " AND " & strTablePrefix & "FORUM_ID NOT IN (12,15)"
what ignorance am I showing now!!!??? :)   |
Edited by - golfmann on 07 March 2006 20:39:29 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 March 2006 : 03:11:28
|
should be TOPICS.FORUM_ID not just FORUM_ID |
 |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 08 March 2006 : 11:09:05
|
Doh!  |
 |
|
golfmann
Junior Member
 
United States
450 Posts |
Posted - 08 March 2006 : 11:24:29
|
Works great! Thanks again Mr. R... Best thing since sliced bread.
BTW, what was the best thing BEFORE there was sliced bread? |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 March 2006 : 12:16:05
|
quote: Originally posted by golfmann
Works great! Thanks again Mr. R... Best thing since sliced bread.
BTW, what was the best thing BEFORE there was sliced bread?
unsliced bread  |
 |
|
|
Topic  |
|