MyBB Community Forums

Full Version: Time limit on deleting posts?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I asked about this on another thread but felt it would get lost among everything else, so I'm creating its own thread. Is it possible to limit the amount of time a user can delete their own posts, like we can limit how long they have to be able to edit them?
That's a time limit on editing, which I've already gone through. I need to know about a time limit on deleting! Big Grin

EDIT: OK, going by what was there for the edit time limit, I figured out how to do it for the delete limit. Basicially the same thing, only you have to add the code to both the editpost.php and the editpost.lang.php files and then add basically the same thing to Admin CP as for the edit time limit. I can't believe I actually figured something out! LOL
Ooops, I guess I did something wrong. I can't put two different times in the editing and deleting settings, since it will always go with the lower number for both. What did I do wrong?

	// Edit time limit
		$time = time();
		if($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['edittimelimit']*60)))
		{
			$lang->edit_time_limit = sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
			error($lang->edit_time_limit);
		}
		// Delete time limit
		$time = time();
		if($mybb->settings['deletetimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['deletetimelimit']*60)))
		{
			$lang->delete_time_limit = sprintf($lang->delete_time_limit, $mybb->settings['deletetimelimit']);
			error($lang->delete_time_limit);
		}
<snip>
OK, I made the changes, but hitting delete after the time limit for edit still comes up...same message too, "administrator has made it so that you can't edit after so many minutes."

And I was so proud of myself too! *sniff*

EDIT: I changed the times so that the delete limit was lower than the edit limit. Then the delete message came up after its limit, but when the edit limit was reached, no matter if you hit the delete or edit, you get the same "administrator has made it so that you can't edit after so many minutes," edit message????? There must be a fix to this, isn't there?
Ah ok I missed something.

Revert the modifications I posted above.
In editpost.php, find:
		// Edit time limit
		$time = time();
		if($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['edittimelimit']*60)))
		{
			$lang->edit_time_limit = sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
			error($lang->edit_time_limit);
		}
Replace with:
		if($mybb->input['action'] != "deletepost") {
		// Edit time limit
		$time = time();
		if($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['edittimelimit']*60)))
		{
			$lang->edit_time_limit = sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
			error($lang->edit_time_limit);
		}
		}
		else {
        $time = time();
        if($mybb->settings['deletetimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['deletetimelimit']*60)))
        {
            error('You cannot delete this message at this time');
        }
		}
Phew! Looks like it's fixed now! Big Grin

Thanks for your quick responses, Dennis! I really appeciate your help!
Glad I could help
Bump Toungue
Pages: 1 2 3