Seems that searching on the code this does not show up; or searching Boonex. Can someone point out where this timer is located and where to rip it out. It is more of an annoyance to my members that anything that helps them. Yes, I understand the purpose but keeping members happy so they stay is more important. Geeks, making the world a better place |
Searched on "Allow edit post" and "Allow edit post period" looking for the key, no results. Geeks, making the world a better place |
modules/boonex/forum/inc/header.inc.php
$gConf['edit_timeout'] = 3600; // edit timeout in sec |
Thanks for the reply. I have been looking through the forum.php script. I wanted to rip it out altogether but have to be careful about not breaking the forum script. Plus, I don't want to inadvertently give edit permission to everyone, just the forum topic owner.
However, one simple solution as you pointed out is to just set the timer for a very long time. The problem with that is the timer still shows so I would need to hide the countdown timer from view.
I may post the bits from forum.php to get some feedback from the coders on here.
And really, this should not be hard coded in without some way to turn it off in the backend. Maybe we don't want to limit the time a person can edit their posts. Just because Boonex thinks it is a good idea don't mean we all want it this way. A perfect example is that bad idea known as "autopilot".
Geeks, making the world a better place |
This is what I am seeing in forum.php:
/** * xml for edit post * @param $post_id post id * @param $topic_id topic id */ function editPostXml ($post_id, $topic_id) { $cu = $this->getUrlsXml (); if ($post_id) { $a = $this->fdb->getTopicByPostId ($post_id); $t = $this->fdb->getTopic ($a['topic_id']); $topic_id = $t['topic_uri'];
$timeout = 'disabled'; $access = 'deny'; if ($this->_checkUserPerm ('', $t['forum_type'], 'edit', $t['forum_id']) ) $access = 'allow'; if ('deny' == $access && ($user = $this->fdb->getPostUser((int)$post_id)) == $this->_getLoginUserName() && $this->_checkUserPerm ('', 'own', 'edit', $t['forum_id']) ) {
$when = $this->fdb->getPostWhen ((int)$post_id); $timeout = $GLOBALS['gConf']['edit_timeout'] - (time() - $when); $access = $timeout > 10 && !$t['topic_locked'] ? 'allow' : 'deny'; } }
$files = ''; $signature = ''; if ('allow' == $access) { $files = $this->_getAttachmentsXML ((int)$post_id); $signature = $this->fdb->getSignature ($this->fdb->getPostUser((int)$post_id)); encode_post_text ($signature, 0); }
return <<<EOS <root> $cu <edit_post> <post_id>$post_id</post_id> <topic_id>$topic_id</topic_id> <timeout>$timeout</timeout> <access>$access</access> <attachments>$files</attachments> <signature>$signature</signature> </edit_post> </root> EOS; }
/** * edit post * @param $post_id post id * @param $topic_id topic id * @param $text new post text */ function editPost ($post_id, $topic_id, $text) { $no_access = true;
$t = $this->fdb->getTopicByUri (filter_to_db($topic_id)); $user = $this->fdb->getPostUser((int)$post_id);
if ($this->_checkUserPerm ('', $t['forum_type'], 'edit', $t['forum_id'])) $no_access = false; if ($no_access && $user == $this->_getLoginUserName()) if ($this->_checkUserPerm ('', 'own', 'edit', $t['forum_id']) && !$this->_isEditTimeout((int)$post_id) && !$t['topic_locked']) $no_access = false;
if ($no_access) { return <<<EOF <html> <body> <script language="javascript" type="text/javascript"> window.parent.document.f.accessDenied(); </script> </body> </html> EOF; }
// edit post here prepare_to_db($text, 1);
$this->fdb->editPost ($post_id, $text, $user);
$this->_handleSignature ($_POST, $user);
$isUploadSuccess = $this->_handleUpload ($_POST, $post_id);
if (is_callable($this->onPostEdit)) call_user_func_array ($this->onPostEdit, array($t, $post_id, $text, $user));
return <<<EOF <html> <body> <script language="javascript" type="text/javascript"> if (!$isUploadSuccess) window.parent.alert ('[L[Some or all files upload failed]]'); window.parent.document.f.editSuccess('{$t['topic_uri']}'); </script> </body> </html> EOF;
}
Geeks, making the world a better place |
if ($this->_checkUserPerm ('', 'own', 'edit', $t['forum_id']) && !$this->_isEditTimeout((int)$post_id) && !$t['topic_locked'])
If I remove && !$this->_isEditTimeout((int)$post_id) would that remove the check for the timer and allow one to edit their post at any time? The idea is that admins and post owner can edit a post at any time but I don't want a member that is not the post owner to be able to edit the post.
Geeks, making the world a better place |
Guess I will just hack at it and see if I can figure things out. The countdown timer has to go even if it is disabled. Geeks, making the world a better place |
The more I look at this, the more it becomes a big mess. No wonder everyone complains about the "Fish" forum. Boonex, in their ultimate wisdom, decided to use the same variable to control deleting posts as well as editing posts. So now I have to try and split the two apart. UGH. Just because I may want someone to edit their posts at any time does not mean I want them to be able to delete their posts at any time; especially if there are a dozen or so replies. Geeks, making the world a better place |
Here is the solution for breaking the edit timer from the delete.
In forum/inc/header.inc.php add a new variable:
$gConf['delete_timeout'] = 3600; // delete timeout in sec
Now in the forum.php, there is one in /forum/classes and one in /forum/classes/en
Clone the function: _isEditTimeout to _isDelTimeout and use your new variable delete_timeout
function _isDelTimeout ($post_id) { if ((time() - $this->fdb->getPostWhen($post_id) - 10) > $GLOBALS['gConf']['delete_timeout']) return true; return false; }
Then you have to go through the forum.php and where the del function is used, you replace _isEditTimeout with _isDelTimeout. You will now be able to set a separate time for deleting forum posts from editing forum posts.
For example:
if (!$allow_edit && $r['user'] == $this->_getLoginUserName()) { if ($this->_checkUserPerm ($r['user'], 'own', 'edit', $forum_id) && !$this->_isEditTimeout($r['post_id']) && !$t['topic_locked']) $allow_edit = 1; }
if (!$allow_del && $r['user'] == $this->_getLoginUserName()) { if ($this->_checkUserPerm ($r['user'], 'own', 'del', $forum_id) && !$this->_isDelTimeout($r['post_id']) && !$t['topic_locked']) $allow_del = 1; }
Before, the second if was using the same function for checking if the time allowed had ended.
Geeks, making the world a better place |
Final piece of the puzzle. To disable the edit timer completely; or at least the way I hack at it :
//$access = $timeout > 10 && !$t['topic_locked'] ? 'allow' : 'deny'; $access = !$t['topic_locked'] ? 'allow' : 'deny';
This keeps the locked forum topics from being edited
Then set the function _isEditTimeout to return false
function _isEditTimeout ($post_id) { return false; }
Then you need to set the "allow edit" message to display none in the CSS otherwise it displays a negative time message.
Geeks, making the world a better place |