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 DEV-Group
 DEV Bug Reports (Open)
 Bug + fix: pop_subscription.asp
 New Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 January 2008 :  10:04:36  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
The function CheckSubscriptionCount, meant to avoid repeated subscriptions due to already existing higher level subscriptions, never returns the correct value. This results from the fact that on line# 264, the value to be returned is assigned to the wrong function name.

In fact, the function has other issues, that stop you, for example, from subscribing to a forum if you already have a subscription to one of the forum topics. So I'm proposing a complete replacement for the function code.

In red you have the parts of the function that have changed.

At line#240, where you now have

function CheckSubscriptionCount(Level, Member_ID, CatID, ForumID, TopicID)
	' --- Count the number of subscriptions at the appropriate sublevel.
	dim SubCount
	StrSql = "SELECT Count(*) as RecordCount from " & strTablePrefix & "SUBSCRIPTIONS S"
	StrSql = StrSql & " WHERE S.MEMBER_ID = " & Member_ID
	if Level = "CAT" then
		StrSql = StrSQL & " AND S.CAT_ID = " & CatID
	elseif Level = "FORUM" then
		StrSql = StrSQL & " AND S.FORUM_ID = " & ForumID
	elseif Level = "TOPIC" then
		StrSql = StrSQL & " AND S.TOPIC_ID = " & TopicID
	else ' BOARD-level
		StrSql = StrSQL & " AND S.CAT_ID = 0 "
		StrSql = StrSQL & " AND S.FORUM_ID = 0 "
		StrSql = StrSQL & " AND S.TOPIC_ID = 0 "
	end if
	set rs1 = my_Conn.Execute (strSql)
	if rs1.EOF or rs1.BOF then
		SubCount = 0
	else
		SubCount = rs1("RecordCount")
	end if
	rs1.Close
	set rs1 = nothing
	CheckSubscriptionCount = SubCount
end function

Replace it by

function CheckSubscriptionCount(Level, Member_ID, CatID, ForumID, TopicID)
	' --- Count the number of subscriptions at the appropriate sublevel.
	dim SubCount
	StrSql = "SELECT Count(*) as RecordCount from " & strTablePrefix & "SUBSCRIPTIONS S"
	StrSql = StrSql & " WHERE S.MEMBER_ID = " & Member_ID
	if Level = "CAT" then
		StrSql = StrSQL & " AND S.CAT_ID = " & CatID & " AND FORUM_ID=0 AND TOPIC_ID=0 "
	elseif Level = "FORUM" then
		StrSql = StrSQL & " AND S.FORUM_ID = " & ForumID & " AND TOPIC_ID=0 "
	elseif Level = "TOPIC" then
		StrSql = StrSQL & " AND S.TOPIC_ID = " & TopicID
	else ' BOARD-level
		StrSql = StrSQL & " AND S.CAT_ID = 0 "
		StrSql = StrSQL & " AND S.FORUM_ID = 0 "
		StrSql = StrSQL & " AND S.TOPIC_ID = 0 "
	end if
	set rs1 = my_Conn.Execute (strSql)
	if rs1.EOF or rs1.BOF then
		SubCount = 0
	else
		SubCount = rs1("RecordCount")
	end if
	rs1.Close
	set rs1 = nothing
	CheckSubscriptionCount = SubCount

end function


<


Snitz 3.4 Readme | Like the support? Support Snitz too

Podge
Support Moderator

Ireland
3775 Posts

Posted - 18 January 2008 :  10:25:39  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
Thanks Rui.<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 January 2008 :  10:26:58  Show Profile  Send ruirib a Yahoo! Message
Initial post has been changed, because there were other issues with the function and it's easier to change it all.

I will add a new bug fix to avoid repeated topic subscriptions, affecting another part of this file's code.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000 Version 3.4.07