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
<