News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

No Changing Moderator's Edit

Started by live627, April 06, 2005, 08:32:29 PM

Previous topic - Next topic

live627

Link to Mod

This modification makes it so that if a moderator or admin was the last person to edit a post then the owner can not
edit the post even if they normally have the rights.

This modification will attempt to retroactivaly determine if a moderator was the last editor.  Note that if a moderator has
changed their name since the time of the edit the modification will fail to retroactivaly mark that post as moderator edited.

All future posts should be marked properly.

With this mod you can choose on a per theme basis to display the modification notice if the last editor was a mod or not

huijaa

Good idea!....

When moderator or adminstrator changes an user's post,  the poster (a normal member) cannot edit anymore.

Dovenforum Nederland -- a forum for deaf people in the Netherlands --

Thantos

Since I didn't explain it:
After a moderator or admin edit's the post anyone with the permission modify_any or modify_replies can still change it as I figured only moderators would have those permissions.

Greybrow

I'm having little problems.
Mod works but is giving me errors:

8: Undefined index: hide_modEdit
File: ....../forum/Themes/default/Display.template.php (eval?)
Line: 439

I'm using smf 1.0.4

Thantos

#4
I'll look into this and get back to you.

Find:
if ($settings['show_modify'] && !empty($message['modified']['name']) && !($message['modEdit'] && $settings['hide_modEdit']) )

Replace
if ($settings['show_modify'] && !empty($message['modified']['name']) && !($message['modEdit'] && isset($settings['hide_modEdit'])) )

LostProphecy

does this work with 1.1. beta 2 or 1.1 beta 3??
Angelus Ex Quo Nox

Thantos

Probably note.  I'll try to find some time to make a Beta 3 version this weekend.

Greybrow

After modifying the file, I'm gettting same error.
Maybe the problem is with reading the language file?

Fizzy

I tried to install this with Package Manager on my 1.0.5 and ended up in a world of pain.

I downloaded the package and clicked to install it, didn't get any error messages.
When I installed it the process stalled and withina few seconds the database became unresponsive.
The process to update the DB then ran amok and sapped up all of the DB resources.
The forum spat error messages saying it couldn't connect to the DB, phpmyadmin refused to allow me to connect to the DB at all.
Eventually I managed to get in to phpmyadmin/processes and found that the edit to the messages table had been running flat out for ages. I tried to kill it in phpmyadmin but it refused to be killed.
I was able to restore my backed up files using ftp but the DB update just refused to be killed for the next 50 minutes.
Eventually I managed to reverse the table edit and remove the mod edit column from the table and the forum then came back online.

I just thought you should be aware.
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Envy

I had pretty much the same issue as Fizzy, I tried to install it via the package manager, but when I clicked 'proceed' everything ground to a halt and I had to go in via ftp and remove what files I could to get my site back...

Shame, as this is what I was after  :-\

Thantos

I'd be willing to bet that its getting hung up when trying to figure out which posts were last editted by a mod.

You can try this:  Open the package up and edit add_settings.php
Find:
// Now try to figure out if the current messages have been mod editted and dump them into a temporary table
	
$result db_query ("
	
	
CREATE TEMPORARY TABLE 
{$db_prefix}NoChangeModEdit SELECT 
	
	
IF( !ISNULL(modifiedName) AND (mem.ID_GROUP = 1 OR mem.ID_GROUP = 2 OR !ISNULL(mods.ID_MEMBER)), 1, 0) AS modEdit,
	
	
msg.ID_MSG
	
	
FROM 
{$db_prefix}members AS mem, {$db_prefix}messages AS msg
	
	
LEFT JOIN 
{$db_prefix}members AS mem2 ON ( IFNULL(mem2.realName,mem2.memberName) = modifiedName )
	
	
LEFT JOIN 
{$db_prefix}moderators AS mods ON (mem2.ID_MEMBER=mods.ID_MEMBER 
	
	
AND msg.ID_BOARD=mods.ID_BOARD)
	
	
WHERE mem.ID_MEMBER=msg.ID_MEMBER
	
	
"
__FILE____LINE__);
	
if ( 
$result // ok well we got the info lets update it then
	
	
db_query("
	
	
	
UPDATE 
{$db_prefix}messages AS msg 
	
	
	
SET modEdit= (
	
	
	
	
	
SELECT modEdit FROM 
{$db_prefix}NoChangeModEdit AS b 
	
	
	
	
	
WHERE msg.ID_MSG = b.ID_MSG
	
	
	
	
	
)
	
	
	
"
__FILE____LINE__);

and remove it

Thantos

Version 0.3 released
Updated for SMF 1.1 RC 1+

I removed the part where it tries to mark the current messages.  It was causing too high of a load.  If it find a good method I'll release a seperate file to do it.

SleePy

i installed this and i am getting pages of errors. apparently to me the function is undefined

8: Undefined index: hide_modEdit
File: /home/mdccla2/public_html/forums/Themes/helios/Display.template.php (eval?)
Line: 536

noting that i have modifying my Display.template.php so the line number is off

this is what line 536 is on when i download my display.template.php file and go to that line:

if ($settings['show_modify'] && !empty($message['modified']['name']) && !($message['modEdit']) )

i removed  && $settings['hide_modEdit'] so it looked like
if ($settings['show_modify'] && !empty($message['modified']['name']) && !($message['modEdit']) )
and the errors stopped and yet it still works.... odd..
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:GitHub
Join us on IRC Libera.chat/#smf


Thantos

I'll look into it SleePy.  The hide_modEdit is just an option to not display the "Editted by" if the editor was a mod.

greyknight17

I'm trying to install this manually on my forum (using a different theme) but have one question.  I edited all those files accordingly, but got stuck when I looked at the add_settings file.  I know they are usually used for the Package Manager install, but don't I have to do those database changes also?  If I need to change it, what and how do I do this?  The install.xml file doesn't mention it and I'm not very database savvy.

Thanks.

Thantos

add_settings.php is actually really easy to do.  Upload it to your forum root directory and then surf to it.  You should get no output.  Then delete it.

greyknight17

Thanks for the reply MikeMill.

It won't change anything else right as long as I don't upload that xml file also?  Just changes the database?

If I wanted to uninstall it later on, I assume I just need to upload the other file (I think delete_settings.php) to remove the changes made in the database right?

Just want to do this correctly  :D

Thanks.

Thantos

Correct on all counts.  add_settings.php just makes database changes.  remove_settings.php undoes those changes.

jerm

im getting these errors:
8: Undefined index: modEdit
File: /home/egrounds/public_html/forums/Sources/Post.php
Line: 601
8: Undefined index: modEdit
File: /home/egrounds/public_html/forums/Sources/Post.php
Line: 1155

is this part of your mod, or ?

Advertisement: