Only Admin Edit Post

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

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Jarex
Registered User
Posts: 7
Joined: Thu Nov 01, 2007 5:33 pm

Re: Only Admin Edit Post

Post by Jarex »

Yes I used that link and looks like it not works as it should. Thank you for your tip creating a new user with Mods rights. Do not know why I did not do that myself. :D It works! Thanks. ;)
PHPBB 3.0.9
User avatar
A_O_C
Registered User
Posts: 2383
Joined: Sun Jul 01, 2007 11:26 pm
Location: phpbb_

Re: Only Admin Edit Post

Post by A_O_C »

Rich,

This will need to be updated for phpBB 3.0.6 (viewtopic changes). Also, is it possible to allow administrators to edit other administrator's posts? I failed when I tried to figure it out. ;)
tau!
Registered User
Posts: 7
Joined: Tue Sep 01, 2009 7:38 pm

Re: Only Admin Edit Post

Post by tau! »

Is it possible that this conflicts with the Soft Delete mod?
The mod works perfect for the editing part, the button is invisible, and even when you try it via a link to delete a certain post, it will pop up the error.

Though with deleting, I can still choose between hard & soft deleting and it both works with this mod.
I can still delete other admin's posts even when being a main mod instead of an admin.
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Only Admin Edit Post

Post by RMcGirr83 »

Then I would have to say that there is a conflict. Deleting should act the same as editing.
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
comkidwizzer3
Registered User
Posts: 375
Joined: Fri Jul 13, 2007 8:24 am
Location: $user->data['user_location'];
Contact:

Re: Only Admin Edit Post

Post by comkidwizzer3 »

Woah, nice work on the coding :D
~My MODs~
Login After Register - v1.0.0 | Custom Ranks MOD - RC

~!Hasher!~
tau!
Registered User
Posts: 7
Joined: Tue Sep 01, 2009 7:38 pm

Re: Only Admin Edit Post

Post by tau! »

This is de code in viewtopic.php:
'U_DELETE' => (!$user->data['is_registered']) ? '' : (((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || ($auth->acl_get('m_delete', $forum_id) && ($row['post_deleted'] == 0 || $auth->acl_get('m_harddelete', $forum_id))) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),
This is your code:
'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || ($auth->acl_get('m_delete', $forum_id) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),
// END Admin Only Edit Post Mod
difference is:
&& ($row['post_deleted'] == 0 || $auth->acl_get('m_harddelete', $forum_id)))

added before: ? append_sid("{$phpbb_root_path}

Perhaps that can help?
I've been trying some things out though no help.
The soft delete and the hard delete ignore your system.
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Only Admin Edit Post

Post by RMcGirr83 »

Try

Code: Select all

	'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || ($auth->acl_get('m_delete', $forum_id) && ($row['post_deleted'] == 0 || $auth->acl_get('m_harddelete', $forum_id) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id))) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),
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
User avatar
A_O_C
Registered User
Posts: 2383
Joined: Sun Jul 01, 2007 11:26 pm
Location: phpbb_

Re: Only Admin Edit Post

Post by A_O_C »

Rich,

I have successfully allowed administrators to edit other administrator posts. The problem is a Moderator will still see the edit and delete buttons in viewtopic. The edit I made to posting.php prevents them from editing administrator posts, but I want to hide the buttons in viewtopic too. Here is the code as i have it. Note these files are 3.0.6-RC1.

posting.php

Code: Select all

$admin_only_arry = $auth->acl_get_list(false, 'a_', false);
$admin_only_arry = (!empty($admin_only_arry[0]['a_'])) ? $admin_only_arry[0]['a_'] : array();
if ($is_authed && ($mode == 'edit' || $mode == 'delete') && (in_array($post_data['poster_id'], $admin_only_arry) && $user->data['user_id'] != $post_data['poster_id'] && $user->data['group_id'] != 5))
{
	if ($mode == 'edit')
	{
		trigger_error('USER_CANNOT_EDIT_ADMIN');
	}
	else
	{
		trigger_error('USER_CANNOT_DELETE_ADMIN');
	}
}
unset($admin_only_arry);
viewtopic.php

Code: Select all

$admin_only_arry = $auth->acl_get_list(false, 'a_', false);
//$admin_only_arry = (!empty($admin_only_arry[0]['a_'])) ? $admin_only_arry[0]['a_'] : array();

Code: Select all

	$edit_allowed = ($user->data['is_registered'] && ((($auth->acl_get('m_edit', $forum_id) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id)) || (
		$user->data['user_id'] == $poster_id &&
		$auth->acl_get('f_edit', $forum_id) &&
		!$row['post_edit_locked'] &&
		($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])
	)));

	$delete_allowed = ($user->data['is_registered'] && ((($auth->acl_get('m_delete', $forum_id) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id)) || (
		$user->data['user_id'] == $poster_id &&
		$auth->acl_get('f_delete', $forum_id) &&
		$topic_data['topic_last_post_id'] == $row['post_id'] &&
		($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
		// we do not want to allow removal of the last post if a moderator locked it!
		!$row['post_edit_locked']
	)));
tau!
Registered User
Posts: 7
Joined: Tue Sep 01, 2009 7:38 pm

Re: Only Admin Edit Post

Post by tau! »

thanks for the suggestion, though I have to say it doesn't make any difference so far :(
perhaps I need to look elsewhere where the problem is?

Even when I turn off the "soft" delete permission so it directly might go to physical delete, it still works.
User avatar
DoYouSpeakWak
Registered User
Posts: 2310
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak
Contact:

Re: Only Admin Edit Post

Post by DoYouSpeakWak »

It seems the whole permission handling for the u_edit and u_delete is now handles in ($edit_allowed) and not in the viewtopic.php file.

I spend a bit of time on this, but couldnt wrap my head around it. Any ideas?
Whatever you share comes back. Support the phpBB Communities
My Validated and Released Modifications
Offering paid services. 10+ years of experience with phpBB3 and as System Administrator.
zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

Re: Only Admin Edit Post

Post by zach' »

tau! wrote:thanks for the suggestion, though I have to say it doesn't make any difference so far :(
perhaps I need to look elsewhere where the problem is?

Even when I turn off the "soft" delete permission so it directly might go to physical delete, it still works.
Hi i have the same issue with the soft delete mod, it's seem working with this in viewtopic.php :

Code: Select all

'U_DELETE'			=> (!$user->data['is_registered']) ? '' : (((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id) && !in_array($poster_id, $admin_only_arry) || $user->data['user_id'] == $poster_id) && ($row['post_deleted'] == 0 || $auth->acl_get('m_harddelete', $forum_id))) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),
HKFA
Registered User
Posts: 3
Joined: Tue Oct 25, 2005 4:29 pm
Location: HKG852

Re: Only Admin Edit Post

Post by HKFA »

is it just only hide the button?? coz' still can delete post via MCP and viewtopic's quicktool, pls help and tks~
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Only Admin Edit Post

Post by RMcGirr83 »

:oops:

Forgot about the MCP. I'll update this mod for 3.0.6 and make a fix for that as well. The MOD already hides the buttons, no?
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
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Only Admin Edit Post

Post by RMcGirr83 »

Update is done :)

For those that want to give the new version a try

http://rmcgirr83.org/mods/only_admin_edit_post.zip

Includes edits for MCP as well as changes for 3.0.6 and has been uploaded into the MODDB on here for validation (upgrade instructions in contrib folder of mod download).
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
joebart72
Registered User
Posts: 743
Joined: Thu Feb 01, 2007 5:54 am

Re: Only Admin Edit Post

Post by joebart72 »

Thanks :) Could you give the tip again to allow founder to edit other admins ? Thanks :)
I learn English with phpbb.com :)
Locked

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