Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: 127.0.0.1 on September 05, 2004, 05:12:17 PM

Title: Don't Show Last Edit If Updater Is Admin
Post by: 127.0.0.1 on September 05, 2004, 05:12:17 PM
I'm trying to write a little mod that does what is stated in the topic. I successfully wrote one for YaBBSE and it looked like this...

// dont update modified time or name if updater is admin
if ($settings[7] != 'Administrator')
{
$request = mysql_query("UPDATE {$db_prefix}messages SET subject='$subject',icon='$icon', body='$message', modifiedTime=" . time() . ", modifiedName='" . addslashes($realname) . "', smiliesEnabled=$smilies WHERE ID_MSG=$postid $doLimitOne;") or database_error(__FILE__, __LINE__);
}
else
{
$request = mysql_query("UPDATE {$db_prefix}messages SET subject='$subject',icon='$icon', body='$message', smiliesEnabled=$smilies WHERE ID_MSG=$postid $doLimitOne;") or database_error(__FILE__, __LINE__);
}

There is no more modifymessage.php in SMF, but I'm pretty sure the mod would be done in post.php. What would I need to change?

Or better yet, maybe I can accomplish this by modding the display.template.php?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Radianation on September 05, 2004, 05:20:01 PM
Check post.php lines 1110 - 1126

The table with the check for admin is in smf_members titled "ID_GROUP"
From my understanding, if ID_GROUP = 1 then the user is administrator.

There are several members lookups in post.php. You should be able to find one that does what you want if you can't write it yourself.

I hope this helps.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: 127.0.0.1 on September 05, 2004, 05:38:01 PM
Would it look like this?


// Do not update modified time if poster is admin.
if ($_POST['ID_GROUP'] == 1)
$modifiedTime = '';


I know this is wrong because it doesn't work. $_POST['ID_GROUP'] is probably a non-existant variable.  I'm trying to figure out what the proper variable is that identifies if the poster is an admin.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: [Unknown] on September 05, 2004, 05:49:35 PM
Find, Sources/Post.php:

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


See that?  Fix it ;) like so:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


-[Unknown]
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on September 08, 2004, 01:30:52 PM
Quote from: [Unknown] on September 05, 2004, 05:49:35 PM
Find, Sources/Post.php:

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


See that?  Fix it ;) like so:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


-[Unknown]


This doesn't work for me, I still get the "last edit" below posts I modify.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Skoen on September 08, 2004, 01:38:06 PM
I think you will see it, as you are the administrator.
But have you checked with a test account to see if the normal user still can see it?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: bloc on September 08, 2004, 01:50:18 PM
You could just change the Display.template.php file, but then you will not see your own edits. And you have to do it on every theme.

Just find this in Display.template.php:
                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']))


and replace with

                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=1)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on September 08, 2004, 03:13:44 PM
Quote from: Skoen on September 08, 2004, 01:38:06 PM
I think you will see it, as you are the administrator.
But have you checked with a test account to see if the normal user still can see it?

Yeah, normal users can still see edits as well.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on September 08, 2004, 03:18:14 PM
Quote from: Bloc on September 08, 2004, 01:50:18 PM
You could just change the Display.template.php file, but then you will not see your own edits. And you have to do it on every theme.

Just find this in Display.template.php:
                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']))


and replace with

                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=1)


Now this mod worked but in reverse, the admin can't see his/hers "Last Edits" but everyone else can.




I just changed this from:
if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=1)

to

if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=0)

and it worked.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: 127.0.0.1 on September 08, 2004, 03:34:40 PM
it worked fine for me
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: bloc on September 08, 2004, 06:05:31 PM
Of course....now I see that it actually makes all edits invisible - but not for admin. Oh,well. ;) Not exactly what was asked for but could be of use anyway?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: 127.0.0.1 on September 08, 2004, 06:38:28 PM
 ??? The mod keeps all edits visible, except for an admin edit.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on September 09, 2004, 12:24:55 AM
Quote from: 127.0.0.1 on September 08, 2004, 06:38:28 PM
??? The mod keeps all edits visible, except for an admin edit.

I logged on as a regular user and I could still see the admin edit.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: bloc on September 09, 2004, 04:19:55 AM
Quote from: Elijah Bliss on September 09, 2004, 12:24:55 AM
Quote from: 127.0.0.1 on September 08, 2004, 06:38:28 PM
??? The mod keeps all edits visible, except for an admin edit.

I logged on as a regular user and I could still see the admin edit.

Ok, I got a bit confused here, but this is more correct:

1.$settings['show_modify']...............................show if settings for showing edits are ON
2.&& !empty($message['modified']['name']).....AND if the name of the person editing is NOT empty
3.&& $context['user']['is_admin']==1)..............AND if person watching IS admin.

What $context['user']['is_admin']!=1) would do is show for all BUT the admin, and $context['user']['is_admin']!=0 - show for all that has 1 or nothing...which us unsafe.

So to be sure only the admin see edits ( all edits btw not just admin's edits) use $context['user']['is_admin']==1.

One must make sure all themes has it too...or else the persons with different themes from you will see it anyway.

Sorry for the confusion. :)

Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: [Unknown] on September 10, 2004, 03:54:08 AM
Quote from: Bloc on September 09, 2004, 04:19:55 AM$context['user']['is_admin']!=1

Quote$context['user']['is_admin']!=0

Actually, it's not a number at all.  It's better to just say:

$context['user']['is_admin'] means they are an admin.
!$context['user']['is_admin'] means they aren't an admin.

In other words, I would suggest using:

$context['user']['is_admin'] instead of $context['user']['is_admin']!=0
!$context['user']['is_admin'] instead of $context['user']['is_admin']!=1

Regardless of that, this is not really a good way to do what at least the topic is about, and I don't see why they way I posted shouldn't work. (as long as you replace all the code I mentioned, event the elseif.)

-[Unknown]
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: bloc on September 10, 2004, 04:32:30 AM
Quote from: [Unknown] on September 10, 2004, 03:54:08 AM
Regardless of that, this is not really a good way to do what at least the topic is about, and I don't see why they way I posted shouldn't work. (as long as you replace all the code I mentioned, event the elseif.)

-[Unknown]

Agreed on that. It was a merely a alternative suggestion that got a bit out of hand ;)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on September 10, 2004, 09:01:50 PM
Quote from: [Unknown] on September 10, 2004, 03:54:08 AM
Quote from: Bloc on September 09, 2004, 04:19:55 AM$context['user']['is_admin']!=1

Quote$context['user']['is_admin']!=0

Actually, it's not a number at all.  It's better to just say:

$context['user']['is_admin'] means they are an admin.
!$context['user']['is_admin'] means they aren't an admin.

In other words, I would suggest using:

$context['user']['is_admin'] instead of $context['user']['is_admin']!=0
!$context['user']['is_admin'] instead of $context['user']['is_admin']!=1

Regardless of that, this is not really a good way to do what at least the topic is about, and I don't see why they way I posted shouldn't work. (as long as you replace all the code I mentioned, event the elseif.)

-[Unknown]

I dunno. I copied and pasted the code exactly the way you had it and as a regular user I can still see the last edit of the admin.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: tenera on September 19, 2004, 02:37:53 PM
Quote from: Elijah Bliss on September 08, 2004, 01:30:52 PM
This doesn't work for me, I still get the "last edit" below posts I modify.

What happens is, any message you edit after you add the code, will not have an 'edit line', but a message that has already been edited will still have its 'edit line'. Also, on a previously edited post, the edit date will no longer change.

If you want the edit line to be gone from all of your posts, you will have to go into your database and set modifiedTime to 0, and modifiedName to NULL. Then the edit line will no longer appear on any of your posts. There is probably a relativily quick to do this, but I couldn't outline one for you. If you're relatively knowleagable of mySQL, you could probably write a script to go through all posts with posterName = yourname, and reset the values for modifiedName and modifiedTime.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: [Unknown] on September 19, 2004, 03:45:10 PM
Quote from: tenera on September 19, 2004, 02:37:53 PM
What happens is, any message you edit after you add the code, will not have an 'edit line', but a message that has already been edited will still have its 'edit line'. Also, on a previously edited post, the edit date will no longer change.

Ah.  I thought that was implied.  I didn't realize it might be expected to be retroactive.  Thanks for clearing it up.

QuoteIf you want the edit line to be gone from all of your posts, you will have to go into your database and set modifiedTime to 0, and modifiedName to NULL. Then the edit line will no longer appear on any of your posts. There is probably a relativily quick to do this, but I couldn't outline one for you. If you're relatively knowleagable of mySQL, you could probably write a script to go through all posts with posterName = yourname, and reset the values for modifiedName and modifiedTime.

UPDATE smf_messages
SET modifiedTime = 0, modifiedName = NULL
WHERE modifiedName = 'admin';

Where 'admin' is your username.

-[Unknown]
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: HRM on September 26, 2004, 10:32:19 AM
Hm...The very first code [Unknown] gave works straigh away excellent for me.

Indeed I can see the Edits from before adding the code but for the new one it works perfect, i don't even see my own (new) edits.

Very helpful topic this one.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Owdy on October 07, 2004, 12:40:52 PM
Quote from: [Unknown] on September 05, 2004, 05:49:35 PM
Find, Sources/Post.php:

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


See that?  Fix it ;) like so:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


-[Unknown]

What if i want admin and some membergroup both have this, how to edit that code?

edit:
/me goes and try this:
if ( in_array(1, $GLOBALS['user_info']['groups']) )
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: CapriSkye on October 15, 2004, 08:54:58 PM
so who exactly is an admin? are moderators admin? how about global moderators? and if i want this apply to just one member, do i change this if ($user_info['is_admin']) to if ($user_info['user']) where user is the name of the user? thank you
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: CapriSkye on October 24, 2004, 04:30:02 PM
i've change unknown's code to work with whichever member you want to hide modify time,

with unknown's code:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


replace with this:

// Administrator edits should not be logged!
if ($user_info['name'] == 'CapriSkye')
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


where 'CapriSkye' is the member's name you want to hide modify time.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: CapriSkye on December 20, 2004, 04:11:04 AM
anybody knows a way to show the new icon anyway? just not showing the modify time, but still let people know the message is edited so they can go check it out. just a thought.. :-\
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: CapriSkye on December 29, 2004, 11:24:27 PM
Quote from: CapriSkye on December 20, 2004, 04:11:04 AM
anybody knows a way to show the new icon anyway? just not showing the modify time, but still let people know the message is edited so they can go check it out. just a thought.. :-\

this trick will work for 1.0 final :)
In /Display.template.php:
Find:

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


Replace with:

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


Where capri is the username
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Ben Dragon on January 25, 2005, 06:12:02 PM
Greetings,

I've noticed in the latest version of SMF, that this "hide admin edits" hack is no longer working.

I re-edited the Post.php with the above content, (as the upgrade overwrote it).

Is there some way of making this hack work?

Have I overlooked a new setting that does this?

Thanks.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Ben Dragon on April 12, 2005, 02:10:20 PM
Sorry for the lateness of the reply... very busy here, but...

Yes, it seems to work great! :D

I'll test it out more extensively over the next little while and will report back if I find anything additional of concern.

Other than that; thanks!  8)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Northerner on June 24, 2005, 09:41:26 PM
as simple as this is, it really should be turned into a mod, some people might not know its available?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elmacik on September 02, 2005, 08:55:19 AM
is there anyone who could do it work at last?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Snickers on October 09, 2005, 08:40:04 AM
lol, i'm confused, whats the final working version code for this?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Elijah Bliss on October 09, 2005, 03:55:11 PM
For 1.1 RC1, in Sources/Post.php
Code (FIND) Select

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{


Code (ADD AFTER) Select

if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;


Code (FIND) Select

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


Code (REPLACE) Select

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Snickers on October 09, 2005, 04:18:14 PM
THANKS!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ivo2296 on January 27, 2006, 12:34:23 AM
Quote from: Elijah Bliss on October 09, 2005, 03:55:11 PM
For 1.1 RC1, in Sources/Post.php
Code (FIND) Select

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{


Code (ADD AFTER) Select

if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;


Code (FIND) Select

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


Code (REPLACE) Select

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])


What about 1.0.5? please!

Thank you!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: coffee on January 28, 2006, 08:12:09 PM
i am still unable to get this to work for me...
using SMF 1.0 Beta 5 Public.

the code i have in sources/post.php is:

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'])
$modifiedTime = time();


i've tried changing it a dozen different ways according to all the suggestions here but no matter what i do, i still see last admin edits using admin log in and guest log in. what am i doing wrong?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: AliasAngel on February 04, 2006, 06:16:29 AM
Sorry, computer somehow posted same message twice.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: AliasAngel on February 04, 2006, 06:16:56 AM
What about for 1.1 RC2?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ernomo98 on February 17, 2006, 08:52:35 AM
Quote from: AliasAngel on February 04, 2006, 06:16:56 AM
What about for 1.1 RC2?

up
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: furiousV on March 06, 2006, 03:35:29 PM
A "Show Last Edit on end of post" Option should be available when making a post and showing Advanced Options.

Sometimes you want to have control over when and when this don't show and not change the source files all the time.

With my very basic PHP knowledge, I would appreciate someone to guide me in the right direction.

We all can benefit from such
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: fiver on April 01, 2006, 07:42:57 AM
Hi furiousV,

I just had an 'accidental' idea. Read this link first and you will know what I mean.  ;D
http://www.simplemachines.org/community/index.php?topic=51190.msg446691#msg446691

If you are using smf1.1rc2, make the changes suggested by Elijah Bliss (Reply #31) and...
- click 'Modify' if you don't want to show admin's last edit
- click Quick Edit icon (http://216.67.249.136/ThemeImages/newsite/icons/modify_inline.gif)on the right of the post if you want to show admin's last edit

:D

Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: sawz on May 05, 2006, 02:58:35 PM
Quote from: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?

this worked for me :)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: FBI on May 05, 2006, 08:24:47 PM
if (!$user_info['is_admin'])

Its works for my forum (http://www.forumbebas.net) with Simplicity Themes :)
Thanks..
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on May 14, 2006, 01:56:54 PM
Tried all the codes that is provided in this thread but none of it working.  :'( :'( :'(

I am using SMF 1.1 RC 2  :'( :'( :'(

And what if the forum got founder, admin & global mods that i want them to have this function ?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: sawz on May 14, 2006, 02:19:27 PM
all your doing is adding 1 line of code to Post.php

if (!$user_info['is_admin'])

add that where its saying, right before

// Have admins allowed people to hide their screwups?

Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on May 14, 2006, 02:24:54 PM
Quote from: sawz on May 14, 2006, 02:19:27 PM
all your doing is adding 1 line of code to Post.php

if (!$user_info['is_admin'])

add that where its saying, right before

// Have admins allowed people to hide their screwups?

Did that. Even tried Bliss code but none of it working.  :'( :'( :'(
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: sawz on May 14, 2006, 02:39:20 PM
it won't remove old edited by messages, those will remain.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on May 14, 2006, 04:20:37 PM
Quote from: sawz on May 14, 2006, 02:39:20 PM
it won't remove old edited by messages, those will remain.

Hmm ... I c. Then I think i did actually get it to work coz i notice the time different but though it was just a forum error. Will try it out again. Thanks :)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on May 14, 2006, 06:33:23 PM
Quote from: sawz on May 14, 2006, 02:39:20 PM
it won't remove old edited by messages, those will remain.

Followed Bliss code and its working fine now.

Ermmm ... Another question is. If my global mods edit the text ... will the "edit notice" came out ?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: sawz on May 14, 2006, 07:17:16 PM
i was wondering the same thing, you'll probaby have to
add a line of code for them too. let us know how it works out.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: mark25 on June 10, 2006, 12:06:26 PM
it works for me.. but i hope on the next release, there would be a button if you want to see last edit when you edit post..  ;)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on October 07, 2006, 03:03:42 PM
Quote from: Elijah Bliss on September 08, 2004, 03:18:14 PM
Quote from: Bloc on September 08, 2004, 01:50:18 PM
You could just change the Display.template.php file, but then you will not see your own edits. And you have to do it on every theme.

Just find this in Display.template.php:
                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']))


and replace with

                // Show "« Last Edit: Time by Person »" if this post was edited.
                if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=1)


Now this mod worked but in reverse, the admin can't see his/hers "Last Edits" but everyone else can.




I just changed this from:
if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=1)

to

if ($settings['show_modify'] && !empty($message['modified']['name']) && $context['user']['is_admin']!=0)

and it worked.

I just upgrade my forum board to RC3 and did this edit .... till today only i noticed i fall for this trick.

I thought i can't see the "edited by : " and all my forummers can't see it too  :D
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: truelight5 on October 09, 2006, 03:57:50 PM
I am using RC3 and was wondering which code will work for this feature with my post.php.

The code that is being changed is not like any listed here:

Quote// Have admins allowed people to hide their screwups?
      if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
      {
         $msgOptions['modify_time'] = time();
         $msgOptions['modify_name'] = addslashes($user_info['name']);
      }

Thanks in advance to anyone who can offer some assistance!

Blessings!
Susie
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on October 09, 2006, 05:51:14 PM
Quote from: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?

This is my favourite code  :D ;D

Thanks.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: truelight5 on October 09, 2006, 05:56:41 PM
I swear I feel so dumb...of course...there is the line.  I don't know why when I kept looking at it before it didn't look right for some reason...  :P  I think I need to take a break lol

Thanks for the repost...for some reason it "clicked" and I see it now...

Blessings!
Susie
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: MarkoWeb on December 13, 2006, 12:32:43 PM
What about 1.1? please!

Thank you!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: bcswebco.com on January 02, 2007, 10:49:49 AM
Quote from: Marko_ on December 13, 2006, 12:32:43 PM
What about 1.1? please!

Thank you!

Same modification to 1.1 and 1.1.1 in Post.php

Note: this change only applies to using the "Modify" function to edit a post - NOT the quick edit feature.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Hadi on February 12, 2007, 05:32:34 PM
which modifecation we are talking here?

do you mean this:


Quote from: bcswebco.com on January 02, 2007, 10:49:49 AM
Quote from: Marko_ on December 13, 2006, 12:32:43 PM
What about 1.1? please!

Thank you!




Same modification to 1.1 and 1.1.1 in Post.php

Note: this change only applies to using the "Modify" function to edit a post - NOT the quick edit feature.
Quote from: Vinspire on October 09, 2006, 05:51:14 PM
Quote from: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?

This is my favourite code  :D ;D

Thanks.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: symon on February 13, 2007, 02:05:20 PM
Quote from: bcswebco.com on January 02, 2007, 10:49:49 AM
Note: this change only applies to using the "Modify" function to edit a post - NOT the quick edit feature.

I was just about to post and say this works but not on admin's own posts. But then I read this quoted post and realised I'd used the quick edit.

Can we get a similar tweak that also does the quick edit? :D
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on April 30, 2007, 02:54:33 AM
Hey everyone. Sorry to bother, but I'm a bit confused by what's happened here. Can someone distill all that to tell me what find/replace I should do to implement this mod on 1.1.2? Thanks!!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: TrueSatan on April 30, 2007, 07:13:27 AM
Go to your Sources directory...find Post.php...in it find // Have admins allowed people to hide their screwups?

above that add if (!$user_info['is_admin'])

...and that's it.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on May 01, 2007, 10:57:08 PM
I have the following code in Post.php, and it is not working as everyone has said they would:

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{
// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}


The same results are returned when the line containing

$modifiedTime = 0;

is commented out. Could this have anything to do with a new version of SMF? I notice that his hack is a bit old. Is there a newer way of doing this?

Thanks!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on May 02, 2007, 05:11:10 PM
Quote from: ssnickerer on May 01, 2007, 10:57:08 PM
I have the following code in Post.php, and it is not working as everyone has said they would:

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{
// Administrator edits should not be logged!
if ($user_info['is_admin'])
$modifiedTime = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}


The same results are returned when the line containing

$modifiedTime = 0;

is commented out. Could this have anything to do with a new version of SMF? I notice that his hack is a bit old. Is there a newer way of doing this?

Thanks!
Change $modifiedTime to $msgOptions['modify_time']
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on May 02, 2007, 06:19:41 PM
Still doesn't work. The code now stands as:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on May 02, 2007, 06:44:40 PM
Quote from: ssnickerer on May 02, 2007, 06:19:41 PM
Still doesn't work. The code now stands as:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}

Add else before that second if statement...

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SMdot™ on May 04, 2007, 01:51:02 PM
Quote from: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?

is this the only modification I need to make? I read through everything but I'm a bit slow =P
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on May 06, 2007, 04:03:10 PM
Quote from: Matt @ ARTcom on May 02, 2007, 06:44:40 PM
Quote from: ssnickerer on May 02, 2007, 06:19:41 PM
Still doesn't work. The code now stands as:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}

Add else before that second if statement...

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])

This still doesn't work, unfortunately. =\

Does anyone have any more ideas? The code currently stands as follows:

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{
// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: texterted on May 10, 2007, 03:21:30 PM
I'd like this as a feature too. If anyone technical can please have a look at what's needed I'd be greatful.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on May 11, 2007, 07:52:54 PM
Quote from: ssnickerer on May 06, 2007, 04:03:10 PM
Quote from: Matt @ ARTcom on May 02, 2007, 06:44:40 PM
Quote from: ssnickerer on May 02, 2007, 06:19:41 PM
Still doesn't work. The code now stands as:

// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}

Add else before that second if statement...

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])

This still doesn't work, unfortunately. =\

Does anyone have any more ideas? The code currently stands as follows:

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{
// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])

// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}

I think you misunderstood what I meant.  You added the entire line of code that I had in my previous post.  Most of that line of code was already there.... right be.... nevermind.... use this block of code....

// This is an already existing message. Edit it.
if (!empty($_REQUEST['msg']))
{
// Administrator edits should not be logged!
if ($user_info['is_admin'])
$msgOptions['modify_time'] = 0;
// Have admins allowed people to hide their screwups?
elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);
}
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: texterted on May 12, 2007, 06:23:21 AM
Go to your Sources directory...find Post.php...in it find // Have admins allowed people to hide their screwups?

above that add if (!$user_info['is_admin'])

On my 1.1.2 forum I've added this to post.php and it works!
Well done everyone for this...

EDIT... OH no it doesn't work! It fails to show if a standard user edits their posts as well as the Admin.

HoHum... maybe someone can find a fix?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: af3 on May 22, 2007, 08:41:59 PM
How about this:

if ($user_info['is_admin']) {
$msgOptions['modify_time'] = 0;
$msgOptions['modify_name'] = '';
}
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: L.G.S on June 01, 2007, 04:01:19 PM
All these fixed do not work with 1.1.2 :(
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: sup_iran on June 24, 2007, 11:14:41 AM
do not work for me too :(
1.1RC3 but it dont works.  I add if (!$user_info['is_admin']) but nothing........

HELP!
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on June 28, 2007, 05:12:24 PM
Ok, there are two spots to change to make this work properly.  I've just tested these changes on a fresh 1.1.3 install and they work just fine....  If User A makes a post, Admin can change it without the edited by showing up.  If User A edits his post, the edited by will show.  If Admin then goes and edits the post AFTER User A, it will still show that User A edited his post.  The edited by will not be changed.

Around line 1564 in Sources/Post.php:
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


And around line 2235
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


That takes care of regular modify of a message, and quick modify, repsectively.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: amirali.b on July 02, 2007, 05:16:45 AM
ok nice...it works....
thanks
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: pirat3 on July 31, 2007, 04:49:08 PM
so des this work with 1.1.2 Matt @ ARTcom?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: amirali.b on July 31, 2007, 04:58:11 PM
I quess it works with 1.1.2
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on July 31, 2007, 05:24:33 PM
I don't see why it shouldn't.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: pirat3 on July 31, 2007, 05:56:02 PM
Works 100% on SMF 1.1.2
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Joshua Dickerson on July 31, 2007, 06:05:07 PM
Quote from: pirat3 on July 31, 2007, 05:56:02 PM
Works 100% on SMF 1.1.2
You should upgrade to 1.1.3 :P
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: lexhair on August 02, 2007, 09:45:50 AM
Quote from: [Unknown] on September 19, 2004, 03:45:10 PM
Quote from: tenera on September 19, 2004, 02:37:53 PM
What happens is, any message you edit after you add the code, will not have an 'edit line', but a message that has already been edited will still have its 'edit line'. Also, on a previously edited post, the edit date will no longer change.

Ah.  I thought that was implied.  I didn't realize it might be expected to be retroactive.  Thanks for clearing it up.

QuoteIf you want the edit line to be gone from all of your posts, you will have to go into your database and set modifiedTime to 0, and modifiedName to NULL. Then the edit line will no longer appear on any of your posts. There is probably a relativily quick to do this, but I couldn't outline one for you. If you're relatively knowleagable of mySQL, you could probably write a script to go through all posts with posterName = yourname, and reset the values for modifiedName and modifiedTime.

UPDATE smf_messages
SET modifiedTime = 0, modifiedName = NULL
WHERE modifiedName = 'admin';

Where 'admin' is your username.

-[Unknown]
Is it ok to set modifiedName to be a NULL value? When I execute SQL queries, I search the modifiedName field for empty strings not NULL values.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Hesperus-Lux on August 10, 2007, 04:03:36 PM
Quote from: sawz on May 05, 2006, 02:58:35 PM
Quote from: mab on March 09, 2005, 05:24:59 PM
In post.php, I just made that :

                                                                      FIND :
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();


                                                                      REPLACE WITH :
// Just add if (!$user_info['is_admin'])

if (!$user_info['is_admin'])
// Have admins allowed people to hide their screwups?
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
$modifiedTime = time();



and it seems working.


ex :
a post has been written by Cain (the test user)

if admin edit the post, nothing appears
if Cain edit the post :  « Last Edit: xxxxxxxx XX, 200X, HH:MM:SS by Cain »
if Cain edit the post twice, the date/time is updates
if admin edit the post, nothing change.

So with this hack, all rules are complied.


What do you think about ?

this worked for me :)


This worked for me. Great Stuff, but does anyone know to make it apply to both admins and global moderators? I don't know php.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: NGame.nl on August 14, 2007, 04:32:15 AM
Yeah, I would like to know that too. Also for my own made User Group.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: NGame.nl on August 15, 2007, 03:24:54 PM
Someone?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: BHClanGaming.com™ on October 02, 2007, 03:49:03 PM
didn't work for me.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: asdas2 on October 05, 2007, 12:17:50 PM
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

i m using smf 1.1.4 and dilber mc theme
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on October 10, 2007, 11:13:31 AM
Quote from: SlammedDime on June 28, 2007, 05:12:24 PM
Ok, there are two spots to change to make this work properly.  I've just tested these changes on a fresh 1.1.3 install and they work just fine....  If User A makes a post, Admin can change it without the edited by showing up.  If User A edits his post, the edited by will show.  If Admin then goes and edits the post AFTER User A, it will still show that User A edited his post.  The edited by will not be changed.

Around line 1564 in Sources/Post.php:
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


And around line 2235
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


That takes care of regular modify of a message, and quick modify, repsectively.

Thanks, SlammedDime!! I chose to only change the quick reply part, so that I could choose whether or not to have the Edits show up. I hope a feature in the advanced posting options will come out soon.

EDIT: Uh oh. Okay, lots of problems with the Quick Reply mod....

So after an Admin submits an edit, the "Loading" fails to go away on the page. For regular users, Quick Reply can't even start up - it just gets stuck at "Loading."
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on October 10, 2007, 11:25:28 AM
Any errors in your error log?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on October 10, 2007, 11:43:27 AM
So I guess I take that back. Something's wrong. The "Loading" lingers after editing even when I replace Post.php with the default, unedited version. Seems like it's theme-independent, too. I think I've messed something up.

It seems that the following error results when a normal user tries to use quick edit:

Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
LIMIT 1' at line 8
File: /home/infin35/public_html/forums/Sources/Post.php
Line: 2038


EDIT: OKAY! Apparently the problem isn't in the mod! Same problem when I replace with original version of Post.php! Crap, I must have broken something. That's not good. =\
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on October 10, 2007, 12:53:14 PM
I think installing the mod gives me problems. But I think the "Loading" lingering after editing is a bug to begin with, because that's what just happened when I did a fresh install of SMF 1.1.4. (Though it may be due to server problems too, maybe?)

I'm just going to give up on this. Not worth the trouble for me. Hopefully they'll integrate this feature into the actual forum software in 2.0.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on October 10, 2007, 04:31:35 PM
Thats a bug in 1.1.3... should have been fixed in 1.1.4.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on October 10, 2007, 04:36:47 PM
Quote from: SlammedDime on October 10, 2007, 04:31:35 PM
Thats a bug in 1.1.3... should have been fixed in 1.1.4.

Are you sure about that? My tests were (are) on fresh, brand new 1.1.4 boards, installed with new databases and everything. =\
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: ssnickerer on October 12, 2007, 01:11:01 PM
This mod (http://www.simplemachines.org/community/index.php?topic=199784.new) seems like a better alternative, idea-wise, until the functionality is actually built into the SMF core. But I haven't been able to get it to work yet, unfortunately. Anyone else with luck?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: lanlord on November 04, 2007, 10:52:34 PM
I combined the admins and one user as:

      // Administrator edits should not be logged!
      if (!$user_info['is_admin'])
      if (!$user_info['username'] == 'user1')

I'm not a programmer so I don't know if there's a better way but it worked.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Fiery on December 08, 2007, 11:16:47 PM
Can everyone that is having an issue post their current issue?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Trinny on February 18, 2008, 04:35:42 PM
Wow.

I was looking for a way to hide post edits per usergroup. ie: designate which user groups edits will not show, and which will show.

Example, we have two levels of administrators, and also Global moderators. If I wanted to hide edits done by all three usergroups, but leave edits made by regular users, what would I have to do?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Vinspire on April 07, 2008, 12:19:31 AM
Quote from: SlammedDime on June 28, 2007, 05:12:24 PM
Ok, there are two spots to change to make this work properly.  I've just tested these changes on a fresh 1.1.3 install and they work just fine....  If User A makes a post, Admin can change it without the edited by showing up.  If User A edits his post, the edited by will show.  If Admin then goes and edits the post AFTER User A, it will still show that User A edited his post.  The edited by will not be changed.

Around line 1564 in Sources/Post.php:
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


And around line 2235
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


That takes care of regular modify of a message, and quick modify, repsectively.

Thank SlammedDime. I uses this code and it is working fine on SMF 1.1.4. No error in my error log too :)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: lanlord on July 01, 2008, 11:48:42 AM
All you have to do to make this work in 2.0 Beta 3.1 is to replace this line:

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

With this:

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


That line is in sources/posts.php twice so replace both.

Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: assam_siddibapa on July 09, 2008, 10:40:12 AM
Can some one tell me what i should do in total so that admin can see edited date and time but members should not see
using smf 1.1.5

Actually went throuh but couldnt find any thing exactly
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: TheDisturbedOne on November 08, 2008, 06:57:02 PM
SlammedDime's doesn't work for me in 1.1.7
Can anybody tell me what went wrong?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: aw06 on January 19, 2009, 09:37:21 PM
Quote from: SlammedDime on June 28, 2007, 05:12:24 PM
Ok, there are two spots to change to make this work properly.  I've just tested these changes on a fresh 1.1.3 install and they work just fine....  If User A makes a post, Admin can change it without the edited by showing up.  If User A edits his post, the edited by will show.  If Admin then goes and edits the post AFTER User A, it will still show that User A edited his post.  The edited by will not be changed.

Around line 1564 in Sources/Post.php:
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


And around line 2235
Code (Find) Select
if (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}

Code (Replace) Select
if (!$user_info['is_admin'] && (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER']))
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = addslashes($user_info['name']);
}


That takes care of regular modify of a message, and quick modify, repsectively.

Will this work in 1.1.7 ??
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: SlammedDime on January 19, 2009, 09:53:39 PM
I don't know why TheDisturbedOne had problems, but it should work just fine.
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: aw06 on January 19, 2009, 10:07:33 PM
gonna try in 1.1.7 and report back
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: aw06 on January 19, 2009, 10:48:30 PM
OK, works for on 1.1.7 without errors
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: aw06 on January 20, 2009, 08:24:23 AM
This also Works tested on another forum i have
http://custom.simplemachines.org/mods/index.php?mod=982

Does not give the option when you quick edit... but thats liveable ...
Puts a link to remove edit, so you can remove edits from you Globals/Mods where you see fit ..
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: TheDisturbedOne on January 20, 2009, 06:26:32 PM
Quote from: SlammedDime on January 19, 2009, 09:53:39 PM
I don't know why TheDisturbedOne had problems, but it should work just fine.
It works, I don't remember what happened, it was a while ago :)
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: Jessikard on April 03, 2009, 05:24:30 AM
we tried all changings, but now only admin can see the edit  :(

Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: akosiparusa on July 10, 2009, 10:40:24 AM
what if the updater is a moderator. what code is needed?
Title: Re: Don't Show Last Edit If Updater Is Admin
Post by: RML on December 04, 2009, 04:09:28 AM
It doesn't work with SMF 2.0 RC2. Is there any chance to modify it to work with that version?