You are not logged in.
- Topics: Active | Unanswered
#1 2010-03-10 16:17:24
- Luca
- Member
- Registered: 2009-08-20
- Posts: 40
how to disallow to users to delete post older 24 hours
is there any way to disallow users to edit\delete his posts that was made older than 24 hour?
now if i right understand user can delete all his post by all the time, right?
Offline
#2 2010-03-10 17:08:48
- FSX
- Developer

- From: NL
- Registered: 2008-05-09
- Posts: 803
- Website
Re: how to disallow to users to delete post older 24 hours
There's no way to do this. You'll have to modify the code to add this feature.
I don't think it's too hard to add this. You just have to check the timestamp of the post in viewtopic.php, delete.php and edit.php.
Offline
#3 2010-03-10 18:13:36
- Franz
- Lead developer

- From: Germany
- Registered: 2008-05-13
- Posts: 3,755
- Website
Offline
#4 2010-03-10 19:18:33
- Tyler
- Member
- Registered: 2008-05-11
- Posts: 104
Re: how to disallow to users to delete post older 24 hours
Here's a quick way to do it.
In viewtopic.php (around line 281), replace:
// Generation post action array (quote, edit, delete etc.)
if (!$is_admmod)
{
if (!$pun_user['is_guest'])
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
if ($cur_topic['closed'] == '0')
{
if ($cur_post['poster_id'] == $pun_user['id'])
{
if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
$post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
if ($pun_user['g_edit_posts'] == '1')
$post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
}
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
$post_actions[] = '<li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
}
}
else
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_common['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_common['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_common['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';With:
// Generation post action array (quote, edit, delete etc.)
if (!$is_admmod)
{
if (!$pun_user['is_guest'])
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
if ($cur_topic['closed'] == '0')
{
if ($cur_post['poster_id'] == $pun_user['id'])
{
if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
{
$now = time();
if ($now < ($cur_post['posted']+86400))
$post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
}
if ($pun_user['g_edit_posts'] == '1')
{
if ($now < ($cur_post['posted']+86400))
$post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
}
}
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
$post_actions[] = '<li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
}
}
else
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_common['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_common['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_common['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';Offline
#5 2010-03-10 19:44:17
- eureka
- Member
- From: France
- Registered: 2008-08-29
- Posts: 46
Re: how to disallow to users to delete post older 24 hours
if ($pun_user['g_edit_posts'] == '1')
{
if ($now < ($cur_post['posted']+86400))
$post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
}$now could not be defined here
French language packs for FluxBB 1.3-Legacy and FluxBB 1.4.2
Offline
#6 2010-03-11 22:05:00
- Tyler
- Member
- Registered: 2008-05-11
- Posts: 104
Re: how to disallow to users to delete post older 24 hours
if ($pun_user['g_edit_posts'] == '1') { if ($now < ($cur_post['posted']+86400)) $post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'; }$now could not be defined here
Oh, my mistake. Add
$now = time();Above the if statement.
Offline
#7 2010-03-11 22:35:03
- FSX
- Developer

- From: NL
- Registered: 2008-05-09
- Posts: 803
- Website
Re: how to disallow to users to delete post older 24 hours
You'll still be able to access edit.php and delete.php directly. And what about moderators and administrators?
Offline
#8 2010-03-12 02:26:07
- Tyler
- Member
- Registered: 2008-05-11
- Posts: 104
Re: how to disallow to users to delete post older 24 hours
You'll still be able to access edit.php and delete.php directly. And what about moderators and administrators?
I assume he meant just regular users. As for still being able to access them directly, quick was the key word in my post.
Offline
#9 2010-04-04 10:51:23
- Lanark
- Member

- Registered: 2008-10-27
- Posts: 36
- Website
Re: how to disallow to users to delete post older 24 hours
This is an interesting idea, but I think I would choose a different time period
either 5 minutes - you have a little time to fix any typos and then its locked
or else a week or two - you can edit while the topic is fresh, but lock it later so you don't have to moderate ancient posts
just change the 86400 figure to what you want
Offline
