Author |
Topic |
|
e3stone
Average Member
USA
885 Posts |
Posted - 03 June 2001 : 04:34:01
|
How involved would it be to only allow people to edit their message for the first, say, 60 minutes that the message was posted? Also, I don't want the users to be able to delete their messages. (I'm going to have a News/Views section which might contain debates, etc, so I don't want people to come back days later and change their message and say "I didn't say that..", for example.)
I was going to check if someone else had done anything similar to this before I dig into the code.
Could anyone tell me what pages would need to be edited? would it be just topic.asp? then the admin page to be able to set the times, etc?
<-- Eric -->
http://insidewaco.com/forum/home.asp |
|
GBurch
Junior Member
United Kingdom
107 Posts |
|
e3stone
Average Member
USA
885 Posts |
Posted - 03 June 2001 : 13:46:24
|
found a bug...I'll repost later
Edited by - e3stone on 03 June 2001 13:47:04 |
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 03 June 2001 : 13:48:37
|
Ok, this might not be the best way to do it, but it works (as far as I know)
In post.asp, right after the </script> tag insert this code:
<% Err_Msg = "" if strRqMethod = "Edit" then editSQL = "SELECT " & strTablePrefix & "REPLY.R_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "REPLY" editSQL = editSQL & " WHERE " & strTablePrefix & "REPLY.REPLY_ID =" & Request.QueryString("REPLY_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("R_DATE")) > 3600 then 'Adjust this number for however many seconds you want the people to be able to edit Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if end if
If Err_Msg = "" Then 'if edit, then it has been under 60 minutes %>
then, at the bottom, right before the include for the footer, insert this code:
else %> <table align=center> <tr> <td align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><center> <ul> <% =Err_Msg %> </ul> </center></font> </td> </tr> </table> <% end if
%>
Because I'm using the Reply_ID field & the time inserted in that recordset, I'm not able to limit the time on the original message (the first one in the thread) does anyone know if this can be done? I'm not sure if I'm going to worry about it, though.
<-- Eric -->
http://insidewaco.com/forum/home.asp
<-- Eric -->
http://insidewaco.com/forum/home.asp
Edited by - e3stone on 03 June 2001 13:54:35 |
|
|
e3stone
Average Member
USA
885 Posts |
|
work mule
Senior Member
USA
1358 Posts |
Posted - 04 June 2001 : 02:56:24
|
quote:
Because I'm using the Reply_ID field & the time inserted in that recordset, I'm not able to limit the time on the original message (the first one in the thread) does anyone know if this can be done? I'm not sure if I'm going to worry about it, though.
I think the edit topic link has a different querystring than the edit reply link. Find the right one and then do the same thing you did above, but instead, topic uses T_DATE for the date the topic was posted.
The Writer Community
"Do not go where the path may lead, go instead where there is no path and leave a trail." -Ralph Waldo Emerson |
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 04 June 2001 : 03:34:14
|
Ok, here's the code to be able to edit BOTH the first message and all the other. It also allows the admin and moderators to edit messages at any time (even after 60 minutes)
replace this code: <% Err_Msg = "" if strRqMethod = "Edit" then editSQL = "SELECT " & strTablePrefix & "REPLY.R_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "REPLY" editSQL = editSQL & " WHERE " & strTablePrefix & "REPLY.REPLY_ID =" & Request.QueryString("REPLY_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("R_DATE")) > 3600 then 'Adjust this number for however many seconds you want the people to be able to edit Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if end if
If Err_Msg = "" Then 'if edit, then it has been under 60 minutes %>
with this code: <% IF strRqMethod = "EditTopic" or _ strRqMethod = "Edit" then Err_Msg = "" if strRqMethod = "EditTopic" then editSQL = "SELECT " & strTablePrefix & "TOPICS.T_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "TOPICS" editSQL = editSQL & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID=" & Request.QueryString("TOPIC_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("T_DATE")) > 3600 then Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if ELSEif strRqMethod = "Edit" then
editSQL = "SELECT " & strTablePrefix & "REPLY.R_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "REPLY" editSQL = editSQL & " WHERE " & strTablePrefix & "REPLY.REPLY_ID =" & Request.QueryString("REPLY_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("R_DATE")) > 3600 then Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if END IF
end if
If (Err_Msg = "") or (mlev = 3) or (mlev = 4) then 'if edit, then it has been under 60 minutes %>
<-- Eric -->
http://insidewaco.com/forum/home.asp |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 04 June 2001 : 06:01:45
|
e3stone,
This is a nice little mod you have here.. Works great.. Should stop (or start) a few fights from people saying stuff in the forums on my site and then saying that they didn't say it...
Good work..
quote:
Ok, here's the code to be able to edit BOTH the first message and all the other. It also allows the admin and moderators to edit messages at any time (even after 60 minutes)
replace this code: <% Err_Msg = "" if strRqMethod = "Edit" then editSQL = "SELECT " & strTablePrefix & "REPLY.R_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "REPLY" editSQL = editSQL & " WHERE " & strTablePrefix & "REPLY.REPLY_ID =" & Request.QueryString("REPLY_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("R_DATE")) > 3600 then 'Adjust this number for however many seconds you want the people to be able to edit Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if end if
If Err_Msg = "" Then 'if edit, then it has been under 60 minutes %>
with this code: <% IF strRqMethod = "EditTopic" or _ strRqMethod = "Edit" then Err_Msg = "" if strRqMethod = "EditTopic" then editSQL = "SELECT " & strTablePrefix & "TOPICS.T_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "TOPICS" editSQL = editSQL & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID=" & Request.QueryString("TOPIC_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("T_DATE")) > 3600 then Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if ELSEif strRqMethod = "Edit" then
editSQL = "SELECT " & strTablePrefix & "REPLY.R_DATE" editSQL = editSQL & " FROM " & strTablePrefix & "REPLY" editSQL = editSQL & " WHERE " & strTablePrefix & "REPLY.REPLY_ID =" & Request.QueryString("REPLY_ID") set rsTopicEdit = my_Conn.Execute (editSql) if (DateToStr(strForumTimeAdjust) - rsTopicEdit("R_DATE")) > 3600 then Err_Msg = "<li>Sorry, you cannot edit your message after 60 minutes</li><br><p><center><a href=""JavaScript:history.go(-1)"">Go Back</a></center></p>" end if END IF
end if
If (Err_Msg = "") or (mlev = 3) or (mlev = 4) then 'if edit, then it has been under 60 minutes %>
<-- Eric -->
http://insidewaco.com/forum/home.asp
Regards,
Webmaster @ Classic Motor Cycling Classic Motor Cycling |
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 06 June 2001 : 05:26:24
|
Excellent. I'm glad you like it
<-- Eric -->
InsideWaco.com |
|
|
|
Topic |
|