Post by Todge on Oct 17, 2005 5:59:47 GMT -8
This will limit the time that a member can modify or delete a post once posted..
Put this at the TOP of your Global Header (or above any code you have that re-arranges the welcome table)
And put this either in your Global Footer for it to effect all boards, or the footers of the boards you want the limit to apply on....
var modDelTime = 30;
Edit this line at the start of the footer code for the amount of minutes you want to allow for modifying and deleting..
The code will only work for times of up to a day (1440 minutes)
Modified to work with re-arranged Welcome Tables
Put this at the TOP of your Global Header (or above any code you have that re-arranges the welcome table)
<script type="text/javascript">
// Get Forum Time for 'Time limit on deleting/modifying posts' code
var realTime = document.getElementsByTagName('font')[2].innerHTML.split(':');
var administrator;
if(document.getElementsByTagName('td')[5].innerHTML.match(/ion=admin/))
{
var administrator = 'yes';
}
</script>
And put this either in your Global Footer for it to effect all boards, or the footers of the boards you want the limit to apply on....
<script type="text/javascript">
<!--
/*
Time limit on deleting/modifying posts
by Todge (Todge-@ntlworld.com)
Global or board footer
Copyright © 2005
Please keep this header intact
*/
// How many minutes should modifying/deleting be allowed? (Up to 1440 minutes (24 hours))
var modDelTime = 30;
// Check for admin or Guest
if(pb_username != 'Guest' && administrator != 'yes' )
{
// Set variables
var postTime;
var postHr;
var postMin;
var realHr = parseInt(realTime[0].split(' ')[realTime[0].split(' ').length-1]);
var realMin = parseInt(realTime[1].split(/(p|a)/)[0]);
if(modDelTime < 5)
{
modDelTime = 5;
}
// Get forum time and convert to minutes
if(realTime[1].match('p') && realHr != 12)
{
realHr = realHr+12;
}
else if(realTime[1].match('a') && realHr == 12)
{
realHr = 0;
}
realHr = realHr+24;
realTime = realHr*60+realMin;
// Check mini profiles and get post times, convert to minutes
var td=document.getElementsByTagName('td');
for(t=0; t<td.length; t++)
{
if(td[t].className.match('windowbg') && td[t].width=='20%' && td[t].vAlign=='top' && td[t].align=='left' && td[t].innerHTML.match(pb_username))
{
postTime = td[t+3].innerHTML.split('«')[1].split('»')[0];
if(postTime.match('day'))
{
postTime = postTime.split(':');
postMin = parseInt(postTime[1].split(/(p|a)/)[0]);
postHr = parseInt(postTime[0].split(' ')[postTime[0].split(' ').length-1]);
if(postTime[1].match('p') && postHr != 12)
{
postHr = postHr+12;
}
else if(postTime[1].match('a') && postHr == 12)
{
postHr = 0;
}
if(postTime[0].match('Today'))
{
postHr = postHr+24;
}
postTime = postHr*60+postMin;
// Remove modify and delete buttons if time has expired
if(realTime-postTime > modDelTime)
{
td[t+4].innerHTML = '<a'+td[t+4].innerHTML.split(/<a/i)[1];
}}
else
{
td[t+4].innerHTML = '<a'+td[t+4].innerHTML.split(/<a/i)[1];
}}}}
// -->
</script>
var modDelTime = 30;
Edit this line at the start of the footer code for the amount of minutes you want to allow for modifying and deleting..
The code will only work for times of up to a day (1440 minutes)
Modified to work with re-arranged Welcome Tables