Prevent moderator from editing admin topics ?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
joebart72
Registered User
Posts: 743
Joined: Thu Feb 01, 2007 5:54 am

Prevent moderator from editing admin topics ?

Post by joebart72 » Mon Nov 12, 2007 7:49 am

Hi everybody ! I'm looking for a mod in order to protect administrators posts or topic. There was a mod for phpBB 2 and I think it would be useful for phpBB 3 ;)
I learn English with phpbb.com :)

joebart72
Registered User
Posts: 743
Joined: Thu Feb 01, 2007 5:54 am

Re: Prevent moderator from editing admin topics ?

Post by joebart72 » Mon Jan 14, 2008 5:21 am

I think many administrators would like to protect their posts... ;)

Is there a way moderators can't edit or delete admin posts or topics ?

Up :?:
I learn English with phpbb.com :)

=alex=
Registered User
Posts: 52
Joined: Sun Dec 09, 2007 6:34 am
Contact:

Re: Prevent moderator from editing admin topics ?

Post by =alex= » Mon Jan 14, 2008 6:12 am

good idea theres no mod like this that i know of atm

pixel001
Registered User
Posts: 100
Joined: Thu Aug 23, 2007 11:38 am

Re: Prevent moderator from editing admin topics ?

Post by pixel001 » Thu Jan 17, 2008 10:38 am

good idea :D

bump ^^

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Re: Prevent moderator from editing admin topics ?

Post by -ds- » Thu Aug 14, 2008 5:28 pm

I am bumping this as this should really have been part of the phpbb permissions core.


Here is the old phpbb 2 hack. Maybe someone with knowledge of the inner workings of phpbb 3 can change it?

Code: Select all

###############################################
##	Hack Title:		Improved disallow editing/deleting administrator posts
##	Hack Version:	1.0.0
##	Author:			aboyd
##	Website:		http://www.outshine.com/forums/
##	Description:	Moderators cannot edit nor delete posts by administrators.
##	Compatibility:	2.0.19
##
##	Installation Level: Easy
##	Installation Time: 5
##
##	Files To Edit: 3
##		modcp.php
##		posting.php
##		language/lang_english/lang_main.php
##
##	Included Files: 0
##
##	History:
##		1.0.0:	Initial release.
##
##	Author Notes:
##		This was a hack by Freakin' Booty, but it wasn't EasyMod compliant, and
##    phpBB 2.0.19 changed some things so that this wouldn't install.  All I've
##    done is make it EasyMod compliant, and compatible with phpBB 2.0.19.
##
##	Support:		http://www.outshine.com/forums
##	Copyright:		©2003-04 Freakin' Booty ;-P - Disallow editing/deleting admin posts 0.0.2
##
###############################################
##	You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
##	Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
##	This hack is released under the GPL License.
##	This hack can be freely used, but not distributed, without permission.
##	Intellectual Property is retained by the hack author(s) listed above.
###############################################

#
#-----[ OPEN ]--------------------------------------------
#
modcp.php

#
#-----[ FIND ]--------------------------------------------
#
# 2.0.4 - 2.0.11
#
	case 'delete':
		if (!$is_auth['auth_delete'])
		{
			message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
		}

#
#-----[ AFTER, ADD ]--------------------------------------
#
		if( $userdata['user_level'] != ADMIN )
		{
			$topics_sql = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? implode(',', $HTTP_POST_VARS['topic_id_list']) : $topic_id;
			$sql = "SELECT t.topic_id
					FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
					WHERE u.user_id = t.topic_poster
						AND u.user_level = " . ADMIN . "
						AND t.topic_id IN ($topics_sql)";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not retrieve topics list', '', __LINE__, __FILE__, $sql);
			}

			if( $db->sql_numrows($result) > 0 )
			{
				message_die(GENERAL_MESSAGE, $lang['Not_auth_edit_delete_admin']);
			}
		}

#
#-----[ OPEN ]--------------------------------------------
#
posting.php

#
#-----[ FIND ]--------------------------------------------
#
		if ( empty($post_id) )
		{
			message_die(GENERAL_MESSAGE, $lang['No_post_id']);
		}

#
#-----[ AFTER, ADD ]--------------------------------------
#
		if( $userdata['user_level'] != ADMIN && ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete') )
		{
			$sql = "SELECT u.user_level
					FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
					WHERE p.post_id = $post_id
						AND p.poster_id = u.user_id
						AND u.user_level = " . ADMIN;
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not retrieve post information', '', __LINE__, __FILE__, $sql);
			}
			if( $row = $db->sql_fetchrow($result) )
			{
				message_die(GENERAL_MESSAGE, $lang['Not_auth_edit_delete_admin']);
			}
		}
#
#-----[ OPEN ]--------------------------------------------
#
# Make sure to edit this file for every language installed
#
language/lang_english/lang_main.php

#
#-----[ FIND ]--------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]-------------------------------------
#
//
// Disallow editing/deleting administrator posts
//
$lang['Not_auth_edit_delete_admin'] = 'You cannot edit/delete an administrator\'s posts, sorry.';

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Re: Prevent moderator from editing admin topics ?

Post by -ds- » Fri Aug 22, 2008 9:36 am

up?

mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: Prevent moderator from editing admin topics ?

Post by mtrs » Fri Aug 22, 2008 9:49 am

Why not installing Prime Post Revisions mod, so all the edits will be logged. Then, you can track what your mods edited.
I abandoned all of my mods.

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Re: Prevent moderator from editing admin topics ?

Post by -ds- » Tue Sep 16, 2008 3:17 pm

mtrs wrote:Why not installing Prime Post Revisions mod, so all the edits will be logged. Then, you can track what your mods edited.
Yes, that's one option, but a rather extensive one. The logging of every edit will cause your database to increase a hell of a lot. Then having to check them etc ..

all I want to do is to disallow admin posts editing by all but admins - without having to install various other mods.

Surely all it needs is a couple of edits in a file and not a fully blown mod with extra database tables and so forth.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Prevent moderator from editing admin topics ?

Post by RMcGirr83 » Tue Sep 16, 2008 4:33 pm

You can try this.

OPEN

viewtopic.php

FIND

Code: Select all

'from'			=> '',
AFTER, ADD

Code: Select all

'group_id'      => '',
FIND

Code: Select all

'user_colour'		=>
AFTER ADD

Code: Select all

'group_id'          => $row['group_id'],
FIND

Code: Select all

'U_EDIT'			=> (!$user->data['is_registered']
IN-LINE, FIND

Code: Select all

(!$user->data['is_registered']
IN-LINE, AFTER ADD

Code: Select all

 || ($user_cache[$poster_id]['group_id'] == '5' && $user->data['group_id'] <> '5')
OPEN

posting.php

FIND

Code: Select all

$sql = 'SELECT f.*, t.*, p.*, u.username, u.username_clean
IN-LINE, FIND

Code: Select all

u.username_clean
IN-LINE, AFTER ADD

Code: Select all

, u.group_id

Code: Select all

if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)
IN-LINE, FIND

Code: Select all

!$auth->acl_get('m_edit', $forum_id)
IN-LINE, AFTER ADD

Code: Select all

 || ($post_data['group_id'] == '5' && $user->data['group_id'] <> '5')
FIND

Code: Select all

{
AFTER ADD

Code: Select all

	if ($post_data['group_id'] == '5' && $user->data['group_id'] <> '5')
	{
		trigger_error('You can not edit an Administrators posts');
	}
Note, hard coded language and I haven't tested it, so user beware.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

tgrtgr
Registered User
Posts: 2
Joined: Tue Sep 16, 2008 3:25 pm

Re: Prevent moderator from editing admin topics ?

Post by tgrtgr » Wed Sep 17, 2008 12:06 am

The code RMcGirr83 works fine :) and adapting the same code I was able to avoid deletion from moderators too. But is there a centralized place where we could add those group checks to avoid any action from mods to admin post? I mean to avoid edit/deletion/moves/merges/etc.

tgrtgr
Registered User
Posts: 2
Joined: Tue Sep 16, 2008 3:25 pm

Re: Prevent moderator from editing admin topics ?

Post by tgrtgr » Thu Sep 18, 2008 11:54 am

Bumping the thread.

Locked

Return to “[3.0.x] MOD Requests”