Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: City Builder on January 29, 2011, 05:41:57 PM

Title: Disable 'last edit by...' message in posts for administrators?
Post by: City Builder on January 29, 2011, 05:41:57 PM
Hi, I'm running SMF 2.0 RC4 and I'd like to know what I have to change (and where) so that it disables the 'last edit' notification on messages that the administrator edits.

Thanks,
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on February 07, 2011, 09:58:26 PM
I would also like to know. :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on February 07, 2011, 10:47:10 PM
Hi, see if this works.

In Post.php look for:


// Have admins allowed people to hide their screwups?
if (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member'])


And replace the second line with


if (!$user_info['is_admin'] && (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member']))


That should hide all admin edits. Including their own posts
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: City Builder on February 07, 2011, 11:02:11 PM
Thank you, it seems to work great.

Solved.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on February 07, 2011, 11:04:07 PM
Great, you're welcome. :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on February 08, 2011, 04:19:04 AM
Thx Kays,

great job! ;-)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on April 10, 2011, 08:44:19 PM
Quote from: Kays on February 07, 2011, 10:47:10 PM
Hi, see if this works.

In Post.php look for:


// Have admins allowed people to hide their screwups?
if (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member'])


And replace the second line with


if (!$user_info['is_admin'] && (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member']))


That should hide all admin edits. Including their own posts

Thanks Kays ;)

P.S
I have made this in to a Package installer all credit goes to Kays :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: kat on April 11, 2011, 04:54:46 AM
Why not submit it to the mod site? ;)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on April 16, 2011, 12:26:25 AM
Quote from: K@ on April 11, 2011, 04:54:46 AM
Why not submit it to the mod site? ;)

Not a bad idea 8)

Quote from: Arantor on April 11, 2011, 05:05:01 AM
(If it is, make sure it's renamed first to not include spaces in the filename.)

The file will be renamed accordingly ;)

I am talking to Kays, It was him that posted the fix, I just incorporated it in to an install package, giving Kays full credit of course :D
One of us will upload it to the mod site :P
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on April 16, 2011, 11:03:11 AM
Hi, sorry for the slow response.

If you wish to submit it as a mod, I don't have a problem with it. :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sleezy on April 16, 2011, 11:06:26 AM
How could you submit it as a Mod?
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Illori on April 16, 2011, 11:31:02 AM
by using this link http://custom.simplemachines.org/mods/index.php?action=postmod;sa=new
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sleezy on April 16, 2011, 12:32:41 PM
No, I am trying to say, how could you submit it, if its just words?
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Illori on April 16, 2011, 12:48:10 PM
it is more then just words, there are code changes as listed above.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on April 16, 2011, 09:30:53 PM
Added file to Mods database, it's now awaiting approval.
Mod name = Disable 'last edit by....' for Administrators

later on I'll be adding support for 1.1.11 + ;)

I have found the code and undergoing testing 8)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: City Builder on April 17, 2011, 07:37:45 AM
Thanks for turning this into a mod, I lost it with some update to my forum but now it's back in as a mod, love it and find it exceptionally useful since we regularly modify peoples posts to award them awards that we use, and it makes it much nicer not to see that a post has been edited by an admin when we award them an award in the OP on the topic.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on April 19, 2011, 03:34:18 AM
Quote from: City Builder on April 17, 2011, 07:37:45 AM
Thanks for turning this into a mod, I lost it with some update to my forum but now it's back in as a mod, love it and find it exceptionally useful since we regularly modify peoples posts to award them awards that we use, and it makes it much nicer not to see that a post has been edited by an admin when we award them an award in the OP on the topic.

No worries bud. I'm glad that you Like it ;)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: coldy316 on April 28, 2011, 11:34:37 AM
Quote from: Guy with a Colt on April 16, 2011, 09:30:53 PM
Added file to Mods database, it's now awaiting approval.
Mod name = Disable 'last edit by....' for Administrators

later on I'll be adding support for 1.1.11 + ;)

I have found the code and undergoing testing 8)


working perfect and find on 2.0RC5 i would have a preview but adult sites are a no no in smf support

thumbs up on this and thanks for the update on this colt.... thumbs up all the way
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on April 29, 2011, 07:52:30 AM
For 1.1.x the second line is slightly different. Use this instead:


if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on May 02, 2011, 11:29:39 AM
Quote from: Kays on April 29, 2011, 07:52:30 AM
For 1.1.x the second line is slightly different. Use this instead:


if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))


Cheers for that, I already found it ;) I sifted through the 1.1.13 installer :)

The mod is still awaiting approval  ???
Does it really take forever for a mod to get approved? :o
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on May 12, 2011, 09:46:49 AM
The mod is accepted and updated, browse here (http://www.simplemachines.org/community/index.php?topic=433487.0) to download the mod :)
It now supports both versions 1.1.xx + 2.0 RCx ;)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on September 01, 2011, 10:13:44 AM
Quote from: Kays on February 07, 2011, 10:47:10 PM
Hi, see if this works.

In Post.php look for:


// Have admins allowed people to hide their screwups?
if (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member'])


And replace the second line with


if (!$user_info['is_admin'] && (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member']))


That should hide all admin edits. Including their own posts

Hi there,

do you also have a solution for the quick modifybutton?

Regards, Torsten
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on September 02, 2011, 10:20:28 AM
Hmm, you should be starting your own topic on this.

However, find:


// Can the user modify the contents of this post?  Show the modify inline image.
if ($message['can_modify'])


And replace it with:


// Can the user modify the contents of this post?  Show the modify inline image.
if ($user_info['is_admin'] && $message['can_modify'])


This way only the admin can see that button.

Is that what you want? And why would you want to do this? ???


Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on September 02, 2011, 03:56:16 PM
I think you misunderstood. ::)

I want to show the buton to all, that's no problem at all, but I don't want to show admin-edits when using the quickmodify button.

I don't think this needs an extra thread... it just fits fine to the topic. ;)

Regards, Torsten
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on September 06, 2011, 07:12:56 PM
No idea anyone? ???

Regards, Torsten
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on September 14, 2011, 07:05:51 PM
I hope it is okay to push the topic after 9 days?  O:)

Regards, Torsten
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on September 15, 2011, 11:35:04 AM
Sorry I did misunderstand your question.

It looks like the line which needs to be modified in Post.php appears in two places. Make sure that you edit it in both places. That should do it.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Tomcraft on September 15, 2011, 12:09:30 PM
That's it! Thanks a lot!  :)

Regards, Torsten
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Kays on September 15, 2011, 02:30:20 PM
Cool, that's good to know. :)

@Reaper.CSF. if you're still following this.

It might be an idea to update the mod to reflect this. Since both lines are similar, I think that just repeating the search and replace in the install script should should modify both lines. The same probably applies for the 1.1.x version also.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sheda on October 05, 2011, 07:58:22 AM
Heya.
Well... i made my own version of "disable 'last edited by' for admins" and i wonder if anyone would like to check it for bugs or tell me what they think of it.
If it turns out good, others might be interested in it, but i don't wanna post code i am not 100% certain about. As it is, it seems to work fine on my site.

It works like this: Instead of hiding the "last edited by" below the post, it doesn't create it to begin with, meaning it doesn't put modified time and name into the database, if you are an admin and checked a box to do so for this specific edit.
Disadvantage is, that you won't be able to recover the edit, or hide one that is already present, so it requires a bit of thinking ahead. If there's more than one admin, this could also lead to confusion as to who modified which post.
Advantage is, you have the choice for every single time you edit on every single post and old edits will stay in place (for example, if the poster of a post you modified modified the post before you).
I also made it work with the quick edit, or rather, the person who did the coding with me did.

So i wonder if posting the code here would be okay, so you can take a look at it.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Shambles on October 05, 2011, 08:04:23 AM
Well I can't speak for the politics of you posting your mod here, but I'd sure be interested, especially if there was a defaulted action on a per-post basis which could be switched off at the post level :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sheda on October 05, 2011, 05:56:06 PM
Yay, i knew there were people interested in this!
It's just probably not a good idea for anyone to copy my approach, before it's been verified by an expert. I'm quite the beginner, you know. :)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Branko. on October 05, 2011, 07:24:20 PM
If you are made any useful thing,you can tell to Reaper.CSF. ...it's the right way.  ;)
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sheda on October 06, 2011, 11:56:45 AM
Hm... should i? I don't wanna annoy him or something...
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Branko. on October 06, 2011, 01:07:49 PM
If you're talking about the version published by the Reaper.CSF. then do not hesitate, any suggestion is welcome.Reaper.CSF. is, like most authors (who publish free mods), I believe, positively oriented about it. If this is your version, which is completely different then contact the SMF mod team.
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Sheda on October 06, 2011, 01:52:40 PM
Actually, it's more like a different version that does something very similar. I dunno if i should go for a mod, as i don't know how to make one. But i guess i will go there then. Thanks.

Umm, where do i find them? xD
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Leo2 on December 17, 2011, 07:16:39 AM
Quote from: Sheda on October 05, 2011, 07:58:22 AM
It works like this: Instead of hiding the "last edited by" below the post, it doesn't create it to begin with, meaning it doesn't put modified time and name into the database, if you are an admin and checked a box to do so for this specific edit.
Disadvantage is, that you won't be able to recover the edit, or hide one that is already present, so it requires a bit of thinking ahead. If there's more than one admin, this could also lead to confusion as to who modified which post.
Advantage is, you have the choice for every single time you edit on every single post and old edits will stay in place (for example, if the poster of a post you modified modified the post before you).
I also made it work with the quick edit, or rather, the person who did the coding with me did.

So i wonder if posting the code here would be okay, so you can take a look at it.
Oh, I wondered why it doesn't remove the Last Edit if it is already there despite checking the 'hide' option.
May be you could add another option "Remove Last Edit from the message" for this mod? This will solve both tasks - keeping old date and removing Admin last edit if he decides to remove it later (like me :) )
The mysql command for removing can be as simple as:
UPDATE `smf_messages` SET `modified_name` = '' WHERE `id_msg` = 'xxx';
Title: Re: Disable 'last edit by...' message in posts for administrators?
Post by: Doburpally on February 15, 2012, 11:34:40 AM
Sorry for late reply.

Quote from: Kays on September 02, 2011, 10:20:28 AM
Hmm, you should be starting your own topic on this.

However, find:


// Can the user modify the contents of this post?  Show the modify inline image.
if ($message['can_modify'])


And replace it with:


// Can the user modify the contents of this post?  Show the modify inline image.
if ($user_info['is_admin'] && $message['can_modify'])


This way only the admin can see that button.

Is that what you want? And why would you want to do this? ???




Quote from: Kays on September 15, 2011, 02:30:20 PM
Cool, that's good to know. :)

@Reaper.CSF. if you're still following this.

It might be an idea to update the mod to reflect this. Since both lines are similar, I think that just repeating the search and replace in the install script should should modify both lines. The same probably applies for the 1.1.x version also.

Which file are we talking about?

Is this the code to look for?