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 MOD-Group
 MOD Add-On Forum (W/Code)
 Edit time limit mod
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

cripto9t
Average Member

USA
881 Posts

Posted - 05 October 2004 :  08:37:23  Show Profile
I've seen this asked for a few times and thought I'd try it.
The mod allows admins. to set a time limit for editing posts.

1. Time limit is set in admin options > configure features.
2. Time limit is in days. (I wasn't sure the best way to do the time so I did it lke this)
If you can do the math you can get it down to exact seconds.

7 = 1 week
1 = 1 day
.5 = 12 hrs.
.25 = 6 hrs.
.125 = 3 hrs.
.0625 = 1.5 hrs.
0 = no editing

Notes: I never had time to write the help pages.

Edit 1: I made a few changes and added this to pop_delete.asp.
It works, but I did it real quick and there might be a better place to put it in the file.
It uses the same time limit.
edit 2: I forgot some code
edit 3: 10/29/04 Bug fix in post.asp
edit 4: 10/29/04 Bug fix in pop_delete.asp



Heres the code

edit 2
In config.asp

Find this code
Dim SubCount, MySubCount

Under that add this
Dim strEditPost, strEditTime

Find this code
strShowSmiliesTable = Application(strCookieURL & "STRSHOWSMILIESTABLE")
strShowQuickReply = Application(strCookieURL & "STRSHOWQUICKREPLY")

Under that add this
strEditPost = Application(strCookieURL & "STREDITPOST")
strEditTime = Application(strCookieURL & "STREDITTIME")

End edit 2

In admin_config_features

find this code
	if strModeration = "1" and Request.Form("strModeration") = "0" then
        	if CheckForUnmoderatedPosts("BOARD", 0, 0, 0) > 0 then
			Err_Msg = Err_Msg & "<li>Please Approve or Delete all UnModerated/Held posts before turning Moderation off.</li>"
		end if
	end if

Under that add this
'## Edit Time Mod ### ADD code below ####################################################################################################
        
        if strEditPost = "1" or Request.Form("strEditPost") = "1" then
                if IsNumeric(Request.Form("strEditTime")) = "False" then
                        Err_Msg = Err_Msg & "<li>Edit time must be a number.</li>"
                elseif left(Request.Form("strEditTime"), 1) = "-" then
                        Err_Msg = Err_Msg & "<li>Edit time must be a positive number</li>"
                end if
        end if

'## End code add on #####################################################################################################################

Find this code
			"              <tr valign=""middle"">" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Show Quick Reply:</b> </font></td>" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
			"                On:<input type=""radio"" class=""radio"" name=""strShowQuickReply"" value=""1""" & chkRadio(strShowQuickReply,0,false) & "> " & vbNewLine & _
			"                Off:<input type=""radio"" class=""radio"" name=""strShowQuickReply"" value=""0""" & chkRadio(strShowQuickReply,0,true) & ">" & vbNewLine & _
			"                <a href=""JavaScript:openWindow3('pop_config_help.asp?mode=features#ShowQuickReply')"">" & getCurrentIcon(strIconSmileQuestion,"","") & "</a></td>" & vbNewLine & _
			"              </tr>" & vbNewLine & _

Under that add this
"              <tr valign=""middle"">" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Edit Time Limit:</b> </font></td>" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
			"                On:<input type=""radio"" class=""radio"" name=""strEditPost"" value=""1""" & chkRadio(strEditPost,0,false) & "> " & vbNewLine & _
			"                Off:<input type=""radio"" class=""radio"" name=""strEditPost"" value=""0""" & chkRadio(strEditPost,0,true) & ">" & vbNewLine & _
                        "                <input type=""text"" name=""strEditTime"" size=""3"" maxLenght=""3"" value=""" & chkExistElse(strEditTime,0) & """>" & vbNewLine & _
                        "                <a href=""JavaScript:openWindow3('pop_config_help.asp?mode=features#Edittime')"">" & getCurrentIcon(strIconSmileQuestion,"","") & "</a> </td>" & vbNewLine & _
			"              </tr>" & vbNewLine & _

In post.asp

Find this code
if strRqMethod = "EditForum" then
	if (mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1") then
		'## Do Nothing
	else
		Go_Result "Only moderators and administrators can edit forums"
	end if
end if

Under that add this
Edit:3 - 10/29/04 change (if strRqMethodType = "Edit" then) to (if strRqMethod = "Edit" then) in code below.
'## Edit time restiction
if strEditPost = 1 then
       if mlev < 3 and (strRqMethod = "Edit" or strRqMethod = "EditTopic") then
               dim intTime : intTime = int(strEditTime * -86400)
               if strRqMethod = "Edit" then
                       strTable = "R"
                       strType = "Reply"
                       strSql = "SELECT R_DATE "
                       strSql = strSql & " FROM " & strActivePrefix & "REPLY"
                       strSql = strSql & " WHERE REPLY_ID = " & strRqReplyID
               else
                       strTable = "T"
                       strType = "Topic"
                       strSql = "SELECT T_DATE "
                       strSql = strSql & " FROM " & strActivePrefix & "TOPICS"
                       strSql = strSql & " WHERE TOPIC_ID = " & strRqTopicID
               end if

               set rsTimesup = my_Conn.Execute(strSql)


               if rsTimesup(strTable & "_DATE") < DateToStr(DateAdd("s",intTime,strForumTimeAdjust)) then
                       dim strMin, strHr, strDay, strTime
                       dim intSec : intSec = int(replace(intTime, "-", ""))
                       dim intMin : intMin = int(intSec/60)
                       dim intHr : intHr = int(intMin/60)
                       dim intDay : intDay = int(intHr/24)
                       select case intDay
                               case 0
                                       strDay = ""
                               case 1
                                       strDay = intDay & " day "
                               case else
                                       strDay = intDay & " days "
                       end select
                       strHr = intHr mod 24
                       select case strHr
                               case 0
                                       strHr = ""
                               case 1
                                       strHr = strHr & " hr. "
                               case else
                                       strHr = strHr & " hrs. "
                       end select
                       strMin = intMin mod 60
                       select case strMin
                               case 0
                                       strMin = ""
                               case 1
                                       strMin = strMin & " min."
                               case else
                                       strMin = strMin & " mins."
                       end select
                       if strDay = "" and strHr = "" and strMin = "" then
                               strTime = "Editing time has been set to 0 by the Forum Admin."
                       else
                               strTime = "The set time limit of " & strDay & strHr & strMin & " has been exceeded." 
                       end if  
                       Go_Result "This " & strType & " cannot be edited,<br />" & strTime & "<br />Contact forum administrator or moderator for more information."
               else
                       rsTimesup.close
	               set rsTimesup = nothing
               end if
       end if
end if

edit 1
This is for deleting

In pop_delete.asp
Find this code
if request("ARCHIVE") = "true" then
	strActivePrefix = strTablePrefix & "A_"
	ArchiveView = "true"
	ArchiveLink = "ARCHIVE=true&"
else

	strActivePrefix = strTablePrefix
	ArchiveView = ""
	ArchiveLink = ""
end if

Under that add this
Edit 4: Bug fix- 11/01/04 Changed (if strRqMethodType = "Edit" then
) to (if Mode_Type = "DeletReply" then) in the code below.

'## Edit time restiction
if strEditPost = 1 then
       if mlev < 3 and (Mode_Type = "DeleteTopic" or Mode_Type = "DeleteReply") then
               dim strTable, strType
               dim intTime : intTime = int(strEditTime * -86400)
               if Mode_Type = "DeleteReply" then
                       strTable = "R"
                       strType = "Reply"
                       strSql = "SELECT R_DATE "
                       strSql = strSql & " FROM " & strActivePrefix & "REPLY"
                       strSql = strSql & " WHERE REPLY_ID = " & Reply_ID
               else
                       strTable = "T"
                       strType = "Topic"
                       strSql = "SELECT T_DATE "
                       strSql = strSql & " FROM " & strActivePrefix & "TOPICS"
                       strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID
               end if

               set rsTimesup = my_Conn.Execute(strSql)


               if rsTimesup(strTable & "_DATE") < DateToStr(DateAdd("s",intTime,strForumTimeAdjust)) then
                       dim strMin, strHr, strDay, strTime
                       dim intSec : intSec = int(replace(intTime, "-", ""))
                       dim intMin : intMin = int(intSec/60)
                       dim intHr : intHr = int(intMin/60)
                       dim intDay : intDay = int(intHr/24)
                       select case intDay
                               case 0
                                       strDay = ""
                               case 1
                                       strDay = intDay & " day "
                               case else
                                       strDay = intDay & " days "
                       end select
                       strHr = intHr mod 24
                       select case strHr
                               case 0
                                       strHr = ""
                               case 1
                                       strHr = strHr & " hr. "
                               case else
                                       strHr = strHr & " hrs. "
                       end select
                       strMin = intMin mod 60
                       select case strMin
                               case 0
                                       strMin = ""
                               case 1
                                       strMin = strMin & " min."
                               case else
                                       strMin = strMin & " mins."
                       end select
                       if strDay = "" and strHr = "" and strMin = "" then
                               strTime = "Editing time has been set to 0 by the Forum Admin."
                       else
                               strTime = "The set time limit of " & strDay & strHr & strMin & " has been exceeded." 
                       end if  
                       Response.write 	"      <br /><div align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiliteFontColor & """>This " & strType & " cannot be edited,<br />" & strTime & "<br />Contact forum administrator or moderator for more information.</font></div>" &_
			                "      <br />"
	               WriteFooterShort
	               Response.end
               else
                       rsTimesup.close
	               set rsTimesup = nothing
               end if
       end if
end if

End edit
That's it .

    _-/Cripto9t\-_

Edited by - cripto9t on 01 November 2004 18:38:54

timcadieux
Starting Member

Belarus
45 Posts

Posted - 05 October 2004 :  10:05:17  Show Profile
I'll give this a try, been looking for something like that for a while now!

quote:
why did you not post this at Snitz?


The main reasons why this was not posted at Snitz and why I might not post the bugs I find
directly at Snitz anymore are the ways "ruirib and HuwR" take pleasure to criticize just about
anything I post and seem to resent the fact that I want to improve and correct Snitz which, I agree,
serve as the original base for my own Forum.

These are some of the actions I find unacceptable:
ruirib and HuwR take fun to Delete some of my topics, of my replies, locked or move my topic.

A topic posted last week from me to Davio in "Help: MOD Implementation" Forum as been deleted.

Two replies in my topic as been deleted about a bug on snitz topic page:
http://forum.snitz.com/forum/topic.asp?whichpage=5.96&TOPIC_ID=44136#372029

A Fix to texanman as been deleted (first reply to texanman subject):
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=66162

One of my Multi-Language Topic on Snitz has disappeared last night
Multi-Language and Multi-Language Skin3D
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=40765

etc...

3 times I changed my password and the day after the same game start.

Since I send to HuwR a donation of $200 on December 22, 2006
this guy HuwR has never stop to pick on every thing I post on the Snitz Forum.
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 05 October 2004 :  17:27:41  Show Profile
I forgot some code for "config.asp". I edited the first post to include it.
Look at edit 2

    _-/Cripto9t\-_
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 11 October 2004 :  19:15:46  Show Profile  Visit Gargoyle's Homepage
Will this work with MySql ??

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 13 October 2004 :  10:42:20  Show Profile  Visit Gargoyle's Homepage
Also since its a cookie wouldn't clearing cookies over-ride this ?

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 13 October 2004 :  12:38:20  Show Profile
quote:
Originally posted by Gargoyle

Will this work with MySql ??


Yes, that's what I test with.
quote:
Originally posted by Gargoyle

Also since its a cookie wouldn't clearing cookies over-ride this ?


It's not a cookie . It uses the T_DATE and R_DATE in the topics and reply database tables.



    _-/Cripto9t\-_

Edited by - cripto9t on 13 October 2004 12:52:32
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 13 October 2004 :  21:17:56  Show Profile  Visit Gargoyle's Homepage
Oh thanks a ton for the info Cripto9t!!

I will be implementing this shortly then.

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 13 October 2004 :  21:57:03  Show Profile  Visit Gargoyle's Homepage
Where is the code for pop_config_help.asp ?? If you found the time to do the file I mean.

Also it works perfectly on my MySql forum! Thanks a lot for sharing the code!

Here is a link to my Snitz powered Drag Racing site.

Edited by - Gargoyle on 13 October 2004 22:10:36
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 16 October 2004 :  16:20:56  Show Profile  Visit Gargoyle's Homepage
Alright here is a bit of code to go into pop_config_help.asp
Just place it at the bottom of case="features" in your pop_config_help.asp file

And don't forget to add the & _ in the proper place.

"              <tr>" & vbNewLine & _
				"                <td bgcolor=""" & strCategoryCellColor & """><a name=""EditTime""></a><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """ ><b>What Does Edit Time Do?</b></font></td>" & vbNewLine & _
				"              </tr>" & vbNewLine & _
				"              <tr>" & vbNewLine & _
				"                <td bgcolor=""" & strForumCellColor & """><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """ color=""" & strForumFontColor & """>" & vbNewLine & _
				"                The edit time setting allows you to set the number of days a topic or reply can exsist before it can no longer be edited or deleted. This feature is useful to stop users from getting angry and deleting all of their posts." & vbNewLine & _
				"                <br /><br /><b><font color=""" & strHiLiteFontColor & """>Set the value to 7 for one week, 1 for a day and so on.</font></b>" & vbNewLine & _
				"                <br /><br />if you can do the math you can even get it down to hours. Here are some example settings for lower time limits.</b>" & vbNewLine & _
				"                <br /><br /><b><font color=""" & strHiLiteFontColor & """>(.5 = 12 hours) (.25 = 6 hours) (.125 = 3 hours)<br />(.0625 = 1.5 hours) (0 = No Editing Allowed)</font></b>" & vbNewLine & _
				"                <a href=""#top"">" & getCurrentIcon(strIconGoUp,"Go To Top Of Page","align=""right""") & "</a></font></td>" & vbNewLine & _
				"              </tr>" & vbNewLine

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 17 October 2004 :  15:47:35  Show Profile
Thanks Gargoyle . Looks good. I got wrapped up in work and forgot about it.

    _-/Cripto9t\-_
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 17 October 2004 :  18:01:32  Show Profile  Visit Gargoyle's Homepage
Not a problem bud! I like to give back where I can.

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

matko
New Member

54 Posts

Posted - 29 October 2004 :  06:42:31  Show Profile
Hi has anybody implemented this on forum running on Access? I just did and it doesn't work properly. When this feature is on (time limit 0.125) users are not allowed to edit their posts, not even in the next minute post sending.
Has anybody else experienced this? Thanks.

Edited by - matko on 29 October 2004 06:43:15
Go to Top of Page

rasure
Junior Member

289 Posts

Posted - 29 October 2004 :  07:06:00  Show Profile  Visit rasure's Homepage
I have it on mine (access 2000) and I haven't noticed any problems, and have tested it on different time settings with a guest account. Although some members did report problems when it was on setting using the .(point) before the number but I couldn't replicate them after testing. I currently have mine set on 1 day with no problems at all.

Psychic & Spiritual Development Resources
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 29 October 2004 :  10:27:26  Show Profile
I'm surprised it works at all .
In post.asp this line
if strRqMethodType = "Edit" then

Needs to be
if strRqMethod = "Edit" then


Edit 3 in first post.

    _-/Cripto9t\-_
Go to Top of Page

matko
New Member

54 Posts

Posted - 29 October 2004 :  12:08:26  Show Profile
Hi cripto9t,
thanks for fix, I'll give it a try later today. Since there is the same problem with deleting, I assume that the same change as in post.asp should be made in pop_delete.asp. Am I right?
Thanks.

Edited by - matko on 29 October 2004 12:10:56
Go to Top of Page

matko
New Member

54 Posts

Posted - 29 October 2004 :  15:01:10  Show Profile
Well I was not right. If you want also delete to work properly, you should change in pop_delte.asp
if strRqMethodType = "Edit" then

and replace it with
if Mode_Type = "DeleteReply" then

Hope this will help (it works for me fine now)

Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07