Decrease members post count on post deletion - Posted (5720 Views)
Average Member
modifichicci
Posts: 787
787
Using antispam mod checking for a number of posts to allow sending mail or PM, if a memeber post and delete his posts can raise the count and then begin to spam..
But snitz code doesn't update member post count if post is deleted.
So I have modified pop_delete to update count when deleting topics, replies, forum and cat.
This is the pop_delete modified in an original snitz 06 file. Changing are marked by
' #### post count update modifichicci mod #####

and

' #### post count update modifichicci mod ##### END

pop_delete mod
It works on my sql forum, but I think no problem with access also

save file as pop_delete.asp and if you haven't made changes overwrite the old file, or compare files..
Title changed by ruirib<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Average Member
modifichicci
Posts: 787
787
I have checked the dates
with
if DataUltimoPostR > DataUltimoPostRA then
response.write "DataUltimoPostR" & DataUltimoPostR
else
response.write "Dati non corrispondenti"
end if
response.write "DataUltimoPostT" & DataUltimoPostT
response.write "DataUltimoPostRA" & DataUltimoPostRA
response.write "DataUltimoPostTA" & DataUltimoPostTA

and dates are selected correctly, and when there is no reply or topics from the author the value is null. But the if statement
if DataUltimoPostR > DataUltimoPostRA then
with DataUltimoPostR = 20080423223022
and DataUltimoPostRA = "" isn't verify and I get always "Dati non corrispondenti"
near the goal but so far..



<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
A null date is not comparable, you need to test it with IsNull(DataUltimoPostRA) or whatever variable you want to test for Null.<
Posted
Average Member
modifichicci
Posts: 787
787
I think I have solved:
here is the new pop_delete.asp

pop_delete.asp
I have changed the function to:
Code:

function getultimopost(strUpLastPost)
strControllo = "00000000000000"
strSql = "SELECT MAX(T_DATE) AS T_VALUE FROM " & strTablePrefix & "TOPICS WHERE T_AUTHOR = " & strUpLastPost
set rs = my_Conn.Execute (strSql)
if not(rs.eof or rs.bof) then
DataUltimoPostT = trim(rs("T_VALUE"))
if IsNull(DataUltimoPostT) then DataUltimoPostT = strControllo
else
DataUltimoPostT = strControllo
end if
rs.close
set rs = nothing
strSql = "SELECT MAX(R_DATE) AS T_VALUE FROM " & strTablePrefix & "REPLY WHERE R_AUTHOR = " & strUpLastPost
set rs = my_Conn.Execute (strSql)
if not(rs.eof or rs.bof) then
DataUltimoPostR = trim(rs("T_VALUE"))
if IsNull(DataUltimoPostR) then DataUltimoPostR = strControllo
else
DataUltimoPostR = strControllo
end if
rs.close
set rs = nothing
strSql = "SELECT MAX(R_DATE) AS T_VALUE FROM " & strTablePrefix & "A_REPLY WHERE R_AUTHOR = " & strUpLastPost
set rs = my_Conn.Execute (strSql)
if not(rs.eof or rs.bof) then
DataUltimoPostRA = trim(rs("T_VALUE"))
if IsNull(DataUltimoPostRA) then DataUltimoPostRA = strControllo
else
DataUltimoPostRA = strControllo
end if
rs.close
set rs = nothing
strSql = "SELECT MAX(T_DATE) AS T_VALUE FROM " & strTablePrefix & "A_TOPICS WHERE T_AUTHOR = " & strUpLastPost
set rs = my_Conn.Execute (strSql)
if not(rs.eof or rs.bof) then
DataUltimoPostTA = trim(rs("T_VALUE"))
if IsNull(DataUltimoPostTA) then DataUltimoPostTA = strControllo
else
DataUltimoPostTA = strControllo
end if
rs.close
set rs = nothing
if StrComp(DataUltimoPostT, DataUltimoPostR) = 1 then
DUpost = DataUltimoPostT
else
DUpost = DataUltimoPostR
end if

if StrComp(DataUltimoPostTA, DataUltimoPostRA) = 1 then
DUpostA = DataUltimoPostTA
else
DUpostA = DataUltimoPostRA
end if
if StrComp(DUpost, DUpostA) = 1 then
getultimopost = DUpost
else
getultimopost = DUpostA
end if
if getultimopost = strControllo then getultimopost = ""
end function

and changed the Ruirib routine to
Code:

strUpLastPost = Reply_Autore ' or Topic etc in different section
DataUltimoPost = getultimopost(strUpLastPost)
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & DataUltimoPost & "'"
strSql = strSql & " WHERE MEMBER_ID = " & strUpLastPost
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

If someone knows how to optimize the function, he is welcome.<
Posted
Starting Member
natty
Posts: 31
31
very nice<
-------------------
http://www.sumwebdesign.com
http://www.tppsych.net
You Must enter a message