On one of my forums, I used to have the permission “Can edit own posts forever” configured for normal members. That was until a forum user decided to remove all of his posts and really mess up some of the conversation histories for some threads.
I then changed the permission to “Can edit own posts until there has been a reply” but some members complained that they wanted to make legitimate edits (corrections, mostly) after someone had replied.
So… I decided to hack the “Can edit own posts forever” to become “Can edit own posts for 24 hours”.
It would be nice to add this as a proper option, although presumably you would have to allow administrators to edit the number of minutes / hours / days for which editing is allowed.
For anyone who is interested in similar functionality, here are the edits (hack style) made to 5.1. (I need to upgrade to 5.5…):
+++ forum/content/ahah/sp-ahah-admintoollinks.php 2014-11-15 18:20:09.066004390 -0800
@@ -113,7 +113,7 @@
}
if (sp_get_auth(‘edit_any_post’, $forum[‘forum_id’]) ||
– ($post[‘user_id’] == $spThisUser->ID && (sp_get_auth(‘edit_own_posts_forever’, $forum[‘forum_id’]) || (sp_get_auth(‘edit_own_posts_reply’, $forum[‘forum_id’]) && $last)))) {
+ ($post[‘user_id’] == $spThisUser->ID && ( ( sp_get_auth(‘edit_own_posts_forever’, $forum[‘forum_id’] ) && ( strtotime( $post[‘post_date’] ) > ( time() – 86400 ) ) ) || (sp_get_auth(‘edit_own_posts_reply’, $forum[‘forum_id’]) && $last)))) {
$out.= ‘<div class=”spForumToolsEdit”>’;
$out.= ‘<img class=”spIcon” src=”‘.SPTHEMEICONSURL.’sp_ToolsEdit.png” alt=”” title=”” />’;
$out.= ‘<a href=”javascript:document.admineditpost’.$post[‘post_id’].’.submit();”>’.sp_text(‘Edit this post’).'</a>’;
@@ -266,4 +266,4 @@
}
— forum/content/sp-topic-view-functions.orig.php 2014-11-15 18:18:51.315004473 -0800
+++ forum/content/sp-topic-view-functions.php 2014-11-15 18:17:44.113004427 -0800
@@ -1192,7 +1192,7 @@
$canEdit = true;
} else {
if ($spThisPostUser->ID == $spThisUser->ID &&
– (sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id) ||
(sp_get_auth(‘edit_own_posts_reply’, $spThisTopic->forum_id) && $spThisPost->last_post))) {
+ ( ( sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id ) && ( strtotime( $spThisPost->post_date ) > ( time() – 86400 ) ) ) ||
$canEdit = true;
}
@@ -1968,8 +1968,8 @@
if (sp_get_auth(‘view_email’, $spThisTopic->forum_id) ||
sp_get_auth(‘pin_posts’, $spThisTopic->forum_id) ||
sp_get_auth(‘edit_any_post’, $spThisTopic->forum_id) ||
– (sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID) ||
– (sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id) && $spThisUser->guest && $spThisPostUser->guest_email == $spThisUser->guest_email) ||
+ (sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id) && ( strtotime( $spThisPost->post_date ) > ( time() – 86400 ) ) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID) ||
+ (sp_get_auth(‘edit_own_posts_forever’, $spThisTopic->forum_id) && ( strtotime( $spThisPost->post_date ) > ( time() – 86400 ) ) && $spThisUser->guest && $spThisPostUser->guest_email == $spThisUser->guest_email) ||
(sp_get_auth(‘edit_own_posts_reply’, $spThisTopic->forum_id) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID && $spThisPost->last_post) ||