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, post_info.asp
 New Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 January 2008 :  11:42:17  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
When subscribing to a topic that you have posted to, by checking the subscribe to this topic checkbox, no current check is done to find if there is already an existing subscription to the topic or to a higher subscription level including the topic. To fix that, a change to AddSubscription is needed. I'm including the complete code, just replace the existing function by the new one_

Find this code (around line#1982)

sub AddSubscription(SubLevel, MemberID, CatID, ForumID, TopicID)
' --- Insert the appropriate sublevel subscription
StrSql = "INSERT INTO " & strTablePrefix & "SUBSCRIPTIONS"
StrSql = StrSql & "(MEMBER_ID, CAT_ID, FORUM_ID, TOPIC_ID) VALUES (" & MemberID & ", "
if sublevel = "BOARD" then
StrSql = StrSql & "0, 0, 0)"
elseif sublevel = "CAT" then
StrSql = StrSql & CatID & ", 0, 0)"
elseif sublevel = "FORUM" then
StrSql = StrSql & CatID & ", " & ForumID & ", 0)"
else
StrSql = StrSql & CatID & ", " & ForumID & ", " & TopicID & ")"
end if
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub


and replace it by

sub AddSubscription(SubLevel, MemberID, CatID, ForumID, TopicID)

'--- Added a check before a subscription is added, to avoid duplicate subscriptions to the same topics
'A single check should be enough to query for existing subscriptions at the differente levels...
' Reasoning is simple: if there are overlapping cat subs, forum subs, no topic subs will be allowed; if there is already an existing subscription to the same topic, do not allow it
'This works on the presumption that this function is used only for adding topic level subscriptions, which is correct for 3.4.06



strsql = "SELECT COUNT(Subscription_ID) As Total FROM " & strTablePrefix & "SUBSCRIPTIONS" & _
" WHERE (MEMBER_ID=" & MemberID & " AND TOPIC_ID=" & TopicID & ") OR " & _
" (MEMBER_ID=" & MemberID & " AND FORUM_ID=" & ForumID & " AND CAT_ID=" & CAT_ID & " AND TOPIC_ID=0) OR " & _
" (MEMBER_ID=" & MemberID & " AND CAT_ID=" & CatID & " AND FORUM_ID=0 AND TOPIC_ID=0) OR " & _
" (MEMBER_ID=" & MemberID & " AND FORUM_ID=0 AND CAT_ID=0 AND TOPIC_ID=0)"


Set rsSubs = my_conn.Execute(strSql)

If Not rsSubs.EOF Then
totalSubs = rsSubs("Total")
Else
totalSubs = -1
End If

rsSubs.Close
Set rsSubs = Nothing

If TotalSubs <= 0 Then

' --- Insert the appropriate sublevel subscription
StrSql = "INSERT INTO " & strTablePrefix & "SUBSCRIPTIONS"
StrSql = StrSql & "(MEMBER_ID, CAT_ID, FORUM_ID, TOPIC_ID) VALUES (" & MemberID & ", "
if sublevel = "BOARD" then
StrSql = StrSql & "0, 0, 0)"
elseif sublevel = "CAT" then
StrSql = StrSql & CatID & ", 0, 0)"
elseif sublevel = "FORUM" then
StrSql = StrSql & CatID & ", " & ForumID & ", 0)"
else
StrSql = StrSql & CatID & ", " & ForumID & ", " & TopicID & ")"
end if
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

End If

end sub


Snitz 3.4 Readme | Like the support? Support Snitz too

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 18 January 2008 :  12:25:10  Show Profile  Visit HuwR's Homepage
are you sure rui ?

if you reply to a topic you are already subscribed too, the check box should be to un-subscribe you rather than subcribe you.

<
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 January 2008 :  12:29:04  Show Profile  Send ruirib a Yahoo! Message
Ah... maybe it's something that Bobby did, then. I did fix it on his code and the check box remained the same, but now that you mention it...

Of course, the extra code won't do any harm, but if the checkbox remains unchanged, the extra checks I added won't bring any advantage.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 18 January 2008 :  12:32:22  Show Profile  Visit HuwR's Homepage
but you can't get duplicate subscriptions to the same topic (not unless you hack it) since checking the subscription checkbox a second time removes your subscription, so changing any code that relates to the checkbox may in fact break it.<
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 January 2008 :  12:35:21  Show Profile  Send ruirib a Yahoo! Message
I suppose it must have been something related to the checkbox. Better check that.

That being the case, this is really a non necessary change to the default code.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 27 February 2009 :  12:00:50  Show Profile
quote:
Originally posted by HuwR

but you can't get duplicate subscriptions to the same topic (not unless you hack it) since checking the subscription checkbox a second time removes your subscription, so changing any code that relates to the checkbox may in fact break it.

I delete duplicate subscriptions all the time in our forums. Should I apply ruirib's fixes from both this topic and the "Bug + fix: pop_subscription.asp" topic?

If it matters, we have the "delete multiple subscriptions" mod on our forum.<
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 12 March 2009 :  14:45:57  Show Profile
rui, should I replace the "sub AddSubscription(SubLevel, MemberID, CatID, ForumID, TopicID)" routine in pop_subscription.asp as well?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 12 March 2009 :  14:58:37  Show Profile  Send ruirib a Yahoo! Message
I guess so, but I really didn't test it.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 12 March 2009 :  15:00:35  Show Profile
I'll let you know.

Thanks for the quick response!
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 05 April 2009 :  10:08:50  Show Profile  Visit richfed's Homepage
So, what is the end result here? Should this fix be applied or not? [patched] Version ...3.05 ...
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 05 April 2009 :  20:36:08  Show Profile  Send ruirib a Yahoo! Message
Do you have problems?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 05 April 2009 :  20:42:09  Show Profile  Visit richfed's Homepage
Not that I am aware of, Ruirib ... I was just wondering if this, in conjunction with the fix in the other related thread, might prevent one down the road. I mean, applying both patches won't "break" anything right?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 April 2009 :  05:59:56  Show Profile  Send ruirib a Yahoo! Message
This just avoids repeated subscriptions, in case they are occurring. If you don't have the issue, I'd say not to worry, but adding the fixes won't break anything.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 06 April 2009 :  06:51:50  Show Profile  Visit richfed's Homepage
Thanks, as always.

Wondering: Are these fixes included in the new version, 3.4.07?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 April 2009 :  09:21:05  Show Profile  Send ruirib a Yahoo! Message
Don't think so.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 06 April 2009 :  12:47:40  Show Profile  Visit AnonJr's Homepage
No, they didn't make it.
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.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07