Limit user editing of old forum posts

Dragonfly issues as they relate to modules discussed here
  
31 Dec '69 Ons Feb 04, 2009 16:41    
layingback
Site Admin  
  •  

Innlegg Limit user editing of old forum posts

I believe, from my own experience, that having user edits of their own posts disabled presents an unnecessary challenge to the user,: we all make typo mistakes. But equally letting users "go back in time" and change earlier posts [b]after[b/] someone has replied is also not too swift, as it leaves the door open to abuse.

The following mod to CPG-BB Forums (the standard forums in DF) will accomplish this, limiting user edits to their posts so long as no-one has posted a subsequent reply.

Leave basic forum setting at can-edit, and then make the following change to viewtopic.php at line 931 (for revision 9.39 in DF version 9.2.1):

Kode:
	if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] ) {



and replace with:

Kode:
	if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] && $i == $total_posts - 1 ) || $is_auth['auth_mod'] ) {



You are just adding a test, which applies to non-moderators, and non-admins, to see if the post is the last one.

EDIT: Adding an error message and enforcement

In posting.php in same folder, at line 227 insert:

Kode:
		} else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && $mode == 'editpost' ) {
			message_die(GENERAL_MESSAGE, $lang['Cannot_edit_replied']);



And in language/english/forums.php add:

Kode:
    'Cannot_edit_replied' => 'Sorry, but you may not edit posts that have been replied to.',



You can test/evaluate here, just register/login and post to this thread. Reply twice and you will see that you can no longer edit your prior post in the thread.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 


Sist endret av layingback den Fre Feb 06, 2009 12:17, endret 1 gang totalt 
 
 
  
31 Dec '69 Ons Feb 04, 2009 16:48    
testytester
Newbie  Newbie
  •  

Innlegg Re: Limit user editing of old forum posts

Test post 1



testytester please enter your server specs in your user profile! Gråter eller Veldig trist  
 
 
 
  
31 Dec '69 Ons Feb 04, 2009 16:48    
testytester
Newbie  Newbie
  •  

Innlegg Re: Limit user editing of old forum posts

Test post 2



testytester please enter your server specs in your user profile! Gråter eller Veldig trist  
 
 
 
Link  QR 
Share this Utskriftsvennlig side  facebook   google+   linkedin   twitthis  
Show more ...



Kontroll av Forumrettigheter - Du kan ikke starte nye emner i dette forumet
Du kan ikke svare på emner i dette forumet
Du kan ikke endre dine egne innlegg i dette forumet
Du kan ikke slette dine egne innlegg i dette forumet
Du kan ikke delta i avstemninger i dette forumet
Du kan ikke legge til filer i dette forumet
Du kan laste ned filer fra dette forumet