Author |
Topic |
|
rasure
Junior Member
289 Posts |
Posted - 17 January 2005 : 13:23:39
|
Has anyone got this to work with the latest version of snitz (Richard maybe?) downloaded and had a look at pop_delete.zip but having trouble finding the code changes for latest snitz code
Thanks in advance |
Psychic & Spiritual Development Resources |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 18 January 2005 : 04:53:06
|
I've just downloaded Richard's file as I'm just about to start working on something similar meself. If I get it working, I'll post back with the necessary code changes.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
rasure
Junior Member
289 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 18 January 2005 : 06:40:08
|
OK, here goes! Please bear in mind that this has not been tested extensively, yet; just a few quickies with a MySQL database so please, if you have a test site, run it on that for a couple of days before adding it to your active site. If you do not have a test site then it is very important that you take a backup of your database and pop_delete.asp file before implementsing this changes.
The following changes and line references are for an unmodded pop_delete.asp for Snitz v3.4.04/3.4.05.
Beginning on line 83 find the following:strSql = "SELECT R_STATUS"
strSql = strSql & " FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE REPLY_ID = " & Reply_ID
set rs = my_Conn.Execute (strSql)
Reply_Status = rs("R_STATUS")
rs.close
set rs = nothing
'## Forum_SQL - Delete reply
strSql = "DELETE FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE REPLY_ID = " & Reply_ID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords Replace the whole thing with the following (changes highlighted in green):strSql = "SELECT R_STATUS,R_AUTHOR"
strSql = strSql & " FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE REPLY_ID = " & Reply_ID
set rs = my_Conn.Execute (strSql)
Reply_Status = rs("R_STATUS")
Reply_Author = rs("R_AUTHOR")
rs.close
set rs = nothing
my_Conn.Execute ("UPDATE "&strMemberTablePrefix&"MEMBERS SET M_POSTS=M_POSTS-1 WHERE MEMBER_ID="&Reply_Author),,adCmdText+adExecuteNoRecords
'## Forum_SQL - Delete reply
strSql = "DELETE FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE REPLY_ID = " & Reply_ID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords That'll update the count when you delete a reply.
To update the post counts of the topic author and everyone who's replied when deleting a topic, find the following, beginning on line 232:'## Forum_SQL - get topic status so you know if the counts need to be updated
set rs = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT T_STATUS "
strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i))
rs.Open strSql, my_Conn
Topic_Status = rs("T_STATUS")
rs.close
set rs = nothing Replace the lot with the following:'## Forum_SQL - get topic status so you know if the counts need to be updated
set rs = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT T_STATUS,T_AUTHOR "
strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i))
rs.Open strSql, my_Conn
Topic_Status = rs("T_STATUS")
Topic_Author = rs("T_AUTHOR")
rs.close
set rs = nothing
my_Conn.Execute ("UPDATE "&strMemberTablePrefix&"MEMBERS SET M_POSTS=M_POSTS-1 WHERE MEMBER_ID="&Topic_Author),,adCmdText+adExecuteNoRecords
if risposte>0 then
set rsReplies=server.createobject("ADODB.Recordset")
rsReplies.open "SELECT DISTINCT M.MEMBER_ID,COUNT(R.R_AUTHOR) AS intCount FROM "&strMemberTablePrefix&"MEMBERS M,"&strActivePrefix&"REPLY R WHERE R.TOPIC_ID="&Topic_ID&" AND R.R_AUTHOR=M.MEMBER_ID GROUP BY R.R_AUTHOR ORDER BY M.MEMBER_ID ASC",my_Conn,adOpenForwardOnly,adLockReadOnly,adCmdText
intCount=-1
if not rsReplies.eof then
arrAuthors=rsReplies.getrows(adGetRowsRest)
intCount=ubound(arrAuthors,2)
end if
rsReplies.close
set rsReplies=nothing
if intCount>-1 then
for intAuthors=0 to intCount
Reply_Author=arrAuthors(0,intAuthors)
Reply_Count=arrAuthors(1,intAuthors)
my_Conn.execute("UPDATE "&strMemberTablePrefix&"MEMBERS SET M_POSTS=M_POSTS-"&Reply_Count&" WHERE MEMBER_ID="&Reply_Author),,adCmdText+adExecuteNoRecords
next
end if
end if That should do the trick for you but, as I said, be very, very careful when implementing it as it was only tested on an already highly modified pop_delete.asp.
A couple things you'll notice in the code above is that there is no check to see if the forum the posts are being deleted from is set not to increment post counts, there is no code to handle the update of members posts when deleting forums or categories and there is no code to update post stamps, if you have that mod installed. I'll be working on these later on in the week when I, hopefully, have a bit more time on my hands.
18-01-05 12:29 - Updated to fix a typo 18-01-05 12:57 - Fixed some more typos
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 18 January 2005 08:04:36 |
|
|
rasure
Junior Member
289 Posts |
Posted - 18 January 2005 : 07:31:28
|
thanks shaggy, just getting this error...
Microsoft VBScript compilation error '800a03ee'
Expected ')'
/forums/pop_delete.asp, line 173
my_Conn.Execute ("UPDATE "&strMemberTablePrefix")MEMBERS SET M_POSTS=M_POSTS-1 WHERE MEMBER_ID="&Reply_Author),,adCmdText+adExecuteNoRecords
-----------------------------------------------^
|
Psychic & Spiritual Development Resources |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 18 January 2005 : 07:35:34
|
Ooop, typical me, always with the typos! On line 173, add an & immediately after strMemberTablePrefix, before the double quote.
<edit> code above has been updated to correct this error </edit>
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 18 January 2005 07:37:09 |
|
|
rasure
Junior Member
289 Posts |
Posted - 18 January 2005 : 07:59:45
|
There are quite a few errors similar to the above with the missing & I have fixed them in my code but then get this...
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/forums/pop_delete.asp, line 331
rsReplies.open "SELECT DISTINCT M.MEMBER_ID,COUNT(R.R_AUTHOR) AS intCount FROM "&strMemberTablePrefix&"MEMBERS M,"&strActivePrefix&"REPLY R WHERE R.TOPIC_ID="&Topic_ID&" AND R.R_AUTHOR=M.MEMBER_ID GROUP BY R.R_AUTHOR ORDER BY M.MEMBER_ID ASC"),my_Conn,adOpenForwardOnly,adLockReadOnly,adCmdText
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^
I think it maybe because I'm using access 2000? |
Psychic & Spiritual Development Resources |
Edited by - rasure on 18 January 2005 08:00:03 |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 18 January 2005 : 08:05:33
|
Shouldn't have a problem using Access.
That last error can be solve by removing the ) at the end of the SQL query that the arrow is pointing to.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
rasure
Junior Member
289 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 18 January 2005 : 08:50:42
|
Glad to help And I'll be back later in the week with the additional changes.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
rasure
Junior Member
289 Posts |
Posted - 18 January 2005 : 09:12:48
|
All working ok now with your above code, thanks once again shaggy for your time and help, much appreciated |
Psychic & Spiritual Development Resources |
Edited by - rasure on 18 January 2005 09:13:16 |
|
|
|
Topic |
|