MyBB Community Forums

Full Version: How to disable editing/deleting posts after a certain period
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to know if there is a way (for example, by using a mod) to make users unable to edit their posts or delete them if they are more than one week old.

I want to retain the ability of moderators to modify/delete posts but only affect normal users. Please advise.
I think a custom plugin would be needed for that.
so, just to be clear --

Configuration > Settings > Posting > Edit Time Limit

-- that option can restrict the time I allow my students to edit their contribution to the class discussions, but my students can still delete their post even if they can no longer edit?

EDIT: i now see i can turn off post deletion in the groups area (by group anyway). this is sufficient as i don't want students to be able to delete a post; only i can do that. i just don't see that this is a timed option, which doesn't matter to me but would for the OP.
Great answers! I'm also going to request a timed option for deletion to be added.
You can do this by editing the core of the mybb. Just 6 lines of code needs editing. If you want to do so I can write what you have to change here.
Please go on, because then I'll have a shorter way to creating a mod which can do this; also, if they decide to add this to core, they can do it easier Smile
Open editpost.php and go to line 111. Add following code after }

// Edit time limit
		$time = TIME_NOW;
		if($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < ($time-($mybb->settings['edittimelimit']*60)))
		{
			$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
			error($lang->edit_time_limit);
		}

Once you did this, the value you set to the option "Edit Time Limit" will be used.