Limited Edit Time

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
frank22
Registered User
Posts: 15
Joined: Fri Oct 19, 2007 2:16 am

Re: Limited Edit Time

Post by frank22 »

Hi,

I installed this mod. Get this error on trying to post new topic:
Parse error: parse error, unexpected T_VARIABLE in /home/reikimas/public_html/tforum/posting.php on line 273

Line 273:

$message = sprintf($lang['edit_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL $post_id) $post_id '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL "=$forum_id '">', '</a>');

Please help.
User avatar
3Di
Former Team Member
Posts: 16091
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: Limited Edit Time

Post by 3Di »

Please re-check your edits because i think there is an "installation error" somewhere else in your posting.php.

regards
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
RMcGirr83
Former Team Member
Posts: 21835
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Limited Edit Time

Post by RMcGirr83 »

frank22 wrote:Hi,

I installed this mod. Get this error on trying to post new topic:
Parse error: parse error, unexpected T_VARIABLE in /home/reikimas/public_html/tforum/posting.php on line 273

Line 273:

Code: Select all

$message = sprintf($lang['edit_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL $post_id) $post_id '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL "=$forum_id '">', '</a>');
Please help.
Should be

Code: Select all

$message = sprintf($lang['edit_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
You have to close the the brackets on the append_sid function, for starters. ;)
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
frank22
Registered User
Posts: 15
Joined: Fri Oct 19, 2007 2:16 am

Re: Limited Edit Time

Post by frank22 »

Thanks for your help, RMcGirr83.

Now it gives the same error but in line 282, which reads as:

$message = sprintf($lang['edit_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL $post_id) $post_id '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL "=$forum_id '">', '</a>');

Kindly review this one too. I hope correcting this would make it work.

Thanks in advance.
User avatar
RMcGirr83
Former Team Member
Posts: 21835
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Limited Edit Time

Post by RMcGirr83 »

frank22 wrote:Thanks for your help, RMcGirr83.

Now it gives the same error but in line 282, which reads as:

$message = sprintf($lang['edit_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL $post_id) $post_id '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL "=$forum_id '">', '</a>');

Kindly review this one too. I hope correcting this would make it work.

Thanks in advance.

Code: Select all

$message = sprintf($lang['edit_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
frank22
Registered User
Posts: 15
Joined: Fri Oct 19, 2007 2:16 am

Re: Limited Edit Time

Post by frank22 »

Thanks very much, RMcGirr83, for your help particularly so quickly. It now works great.

Thank you once again.
User avatar
3Di
Former Team Member
Posts: 16091
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: Limited Edit Time

Post by 3Di »

As a matter of fact it was an installation error, like a wrong copy/paste or so on. It frequently happens when you don't use a good and free text-editor. Assuming you MODded your Forum by hands. ;) Anyway.. hope you'll enjoy this MOD & thanks to all :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: Limited Edit Time

Post by rantbot »

The instructions (lines 263-268) contain these lines -

Code: Select all

#
#-----[ FIND ]------------------------------------------------
#
			$sql = "UPDATE " . FORUMS_TABLE . "
#
#-----[ BEFORE, ADD ]-----------------------------------------
for modifying admin_forums.php.

However the code $sql = "UPDATE " . FORUMS_TABLE . " appears in three places in admin_forums.php. Which one do we want?
User avatar
RMcGirr83
Former Team Member
Posts: 21835
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Limited Edit Time

Post by RMcGirr83 »

the first one
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: Limited Edit Time

Post by rantbot »

Does this mod also prevent users from deleting their posts after the edit time limit has passed?
User avatar
RMcGirr83
Former Team Member
Posts: 21835
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Limited Edit Time

Post by RMcGirr83 »

rantbot wrote:Does this mod also prevent users from deleting their posts after the edit time limit has passed?
You can set for users not to be able to delete posts in the ACP
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: Limited Edit Time

Post by rantbot »

RMcGirr83 wrote:You can set for users not to be able to delete posts in the ACP
That's not what I want. I want deletions to be handled like edits - users can do either but only up to a point.
User avatar
RMcGirr83
Former Team Member
Posts: 21835
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Limited Edit Time

Post by RMcGirr83 »

With 3Di's permission.

open posting.php

FIND

Code: Select all

//-- mod : Limited Edit Time by 3Di ----------------------------------------------
//
// languages handling here.. 1 means singular, for forums.
if ($post_info['forum_limited_time'] == 1) 
{
	$lang['edit_time_auth_explain'] = $lang['edit_time_auth_explain_one'];
}
// languages handling here.. 1 means singular, for $userdata.
if ($userdata['user_limited_time'] == 1) 
{
	$lang['edit_time_past'] = $lang['edit_time_past_one'];
}
// let's start with the program then.
//
// Time precision set to seconds, not minutes.. this time.
// We avoid also Admin and Moderators to be involved here, ofcourse
// If forum_limited_time or user_limited_time are set to ZERO there aren't restriction set..
// you can use both or just one of those, it's up to you
//
	if ( $mode == 'editpost' && !$is_auth['auth_mod'] && ($post_info['forum_limited_time'] != '0') && !$submit)
	{
		$current_time = time();
		$difference_sec = $current_time - $post_info['post_time'];
		if ( $difference_sec > ($post_info['forum_limited_time'] * 60) )
		{
			$message = sprintf($lang['edit_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
			message_die(GENERAL_MESSAGE, $message);
			}
			else if ( $mode == 'editpost' && !$is_auth['auth_mod'] && ($userdata['user_limited_time'] != '0') && !$submit)
			{
			$current_time = time();
			$difference_sec = $current_time - $post_info['post_time'];
			if ( $difference_sec > ( $userdata['user_limited_time'] * 60 ) )
			{
				$message = sprintf($lang['edit_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
				message_die(GENERAL_MESSAGE, $message);
			}
		}
	}
//-- end mod : Limited Edit Time by 3Di ------------------------------------------
replace with

Code: Select all

//-- mod : Limited Edit Time by 3Di ----------------------------------------------
//
// languages handling here.. 1 means singular, for forums.
if ($post_info['forum_limited_time'] == 1) 
{
	$lang['edit_time_auth_explain'] = $lang['edit_time_auth_explain_one'];
	$lang['delete_time_auth_explain'] = $lang['delete_time_auth_explain_one'];
}
// languages handling here.. 1 means singular, for $userdata.
if ($userdata['user_limited_time'] == 1) 
{
	$lang['edit_time_past'] = $lang['edit_time_past_one'];
	$lang['delete_time_past'] = $lang['delete_time_past_one'];
}
// let's start with the program then.
//
// Time precision set to seconds, not minutes.. this time.
// We avoid also Admin and Moderators to be involved here, ofcourse
// If forum_limited_time or user_limited_time are set to ZERO there aren't restriction set..
// you can use both or just one of those, it's up to you..also for delete post
//
	if ( ( $mode == 'editpost' || $mode == 'delete' ) && !$is_auth['auth_mod'] && ($post_info['forum_limited_time'] != '0') && !$submit)
	{
		$current_time = time();
		$difference_sec = $current_time - $post_info['post_time'];
		if ( $difference_sec > ($post_info['forum_limited_time'] * 60) )
		{	
		 	if ( $mode == 'editpost' )
		 	{
				$message = sprintf($lang['edit_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
				message_die(GENERAL_MESSAGE, $message);
			}
			else
			{
				$message = sprintf($lang['delete_time_auth_explain'], $post_info['forum_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
				message_die(GENERAL_MESSAGE, $message);				
			}
		}
		else if ( ( $mode == 'editpost' || $mode == 'delete' ) && !$is_auth['auth_mod'] && ($userdata['user_limited_time'] != '0') && !$submit)
		{
			$current_time = time();
			$difference_sec = $current_time - $post_info['post_time'];
			if ( $difference_sec > ( $userdata['user_limited_time'] * 60 ) )
			{
			 	if ( $mode == 'editpost' )
			 	{
					$message = sprintf($lang['edit_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
					message_die(GENERAL_MESSAGE, $message);
				}
				else
				{
					$message = sprintf($lang['delete_time_past'], $userdata['user_limited_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
					message_die(GENERAL_MESSAGE, $message);					
				}
			}
		}
	}
//-- end mod : Limited Edit Time by 3Di ------------------------------------------
also open language/lang_english/lang_extend_let_3Di.php

and replace it with this one

Code: Select all

<?php
/***************************************************************************
 *							lang_extend_let_3Di.php
 *                            -------------------
 *   begin                : 2007/03/31
 *   copyright            : (C) 2007 3Di (aka 3D)
 *   email                : 3dforum AT libero DOT it
 *
 *   $Id: lang_extend_let_3Di.php, 1.0.0e, 2007/08/13 18.30.00, 3Di Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

$lang['edit_time_past'] = 'You are not allowed to edit your posts. You have to edit your posts within <b>%d</b> minutes, after you posted your messages.';
$lang['edit_time_past_one'] = 'You are not allowed to edit your post. You have to edit your post within <b>%d</b> minute, after you posted your message.';
$lang['edit_time'] = 'Post Edit time'; 
$lang['edit_time_explain'] = 'The time (in minutes) the user has to edit/delete his/her post/s. Unlimited time if ZERO.';
$lang['edit_time_auth_explain'] = 'This Forum has the <i>Limited Time Edit</i> set to <b>%d</b> minutes. Sorry';
$lang['edit_time_auth_explain_one'] = 'This Forum has the <i>Limited Time Edit</i> set to <b>%d</b> minute. Sorry';
$lang['Limited_Edit_Time_value_must_be'] = 'The value for Limited Edit/Delete Time must be <b>only numbers</b><br />The query has been stopped and no values have been entered into the DB yet.<br /><br />Please go back and try again.';
$lang['Forum_time'] = 'Time in minutes within the posts can be edited or deleted, ZERO for unlimited time.';
$lang['delete_time_auth_explain'] = 'This Forum has the <i>Limited Time Delete</i> set to <b>%d</b> minutes. Sorry';
$lang['delete_time_auth_explain_one'] = 'This Forum has the <i>Limited Time Delete</i> set to <b>%d</b> minute. Sorry';
$lang['delete_time_past'] = 'You are not allowed to delete your posts. You have to delete your posts within <b>%d</b> minutes, after you posted your messages.';
$lang['delete_time_past_one'] = 'You are not allowed to delete your post. You have to delete your post within <b>%d</b> minute, after you posted your message.';
?>
then whatever time you set for a forum in the ACP for editing will also apply to deletion.

Is that close enough? I haven't tested this though.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
3Di
Former Team Member
Posts: 16091
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: Limited Edit Time

Post by 3Di »

The code above has not been tested by me yet nor validated so apply at your own risk (make backups first, as usual.. I mean).

Regards
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: Limited Edit Time

Post by rantbot »

My previous question was, does this mod, as tested and released, prevent users from deleting their posts entirely in the same way that it prevents them from editing posts?

The problem, obviously, is that some people have this weird mania for deleting their old posts. That leaves big holes in threads and tends to render the other posts incomprehensible. I don't want any of my boards to be vulnerable to that sort of sabotage. So I want to prevent users from deleting their old posts. To do that, they also have to be prevented from editing their old posts. If they're not prevented from doing that, they can just edit an old post by removing all the text. Then, the post hasn't technically been "removed", but practically, it has. And that still messes up an old thread. So the two - editing and removal - are intimately connected. Implementing just one isn't very useful.

It is a simple matter to prevent all edits and removals of all posts, and in some situations I have set sections of boards up that way. But it is not really a good way to handle the problem in the general case. Any rational board administrator will want members to be able to do short-term edits and removals (if only to correct stupid typos and remove inadvertent double posts), but also be able to block long-term edits and removals, as explained above.

So. Is there a mod for phpBB 2 which allows both editing and removal of posts for a short period of time - from, say, anything from five minutes to an hour (the exact time isn't very important) - but prevents both editing and removal of posts after that time?
Post Reply

Return to “[2.0.x] MOD Database Releases”