Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: 127.0.0.1 in September 05, 2004, 05:12:17 NACHMITTAGS

Titel: Don't Show Last Edit If Updater Is Admin
Beitrag von: 127.0.0.1 in September 05, 2004, 05:12:17 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: NoRad in September 05, 2004, 05:20:01 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: 127.0.0.1 in September 05, 2004, 05:38:01 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: [Unknown] in September 05, 2004, 05:49:35 NACHMITTAGS
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]
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in September 08, 2004, 01:30:52 NACHMITTAGS
Zitat von: [Unknown] in September 05, 2004, 05:49:35 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Skoen in September 08, 2004, 01:38:06 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: bloc in September 08, 2004, 01:50:18 NACHMITTAGS
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)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in September 08, 2004, 03:13:44 NACHMITTAGS
Zitat von: Skoen in September 08, 2004, 01:38:06 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in September 08, 2004, 03:18:14 NACHMITTAGS
Zitat von: Bloc in September 08, 2004, 01:50:18 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: 127.0.0.1 in September 08, 2004, 03:34:40 NACHMITTAGS
it worked fine for me
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: bloc in September 08, 2004, 06:05:31 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: 127.0.0.1 in September 08, 2004, 06:38:28 NACHMITTAGS
 ??? The mod keeps all edits visible, except for an admin edit.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in September 09, 2004, 12:24:55 VORMITTAG
Zitat von: 127.0.0.1 in September 08, 2004, 06:38:28 NACHMITTAGS
??? 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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: bloc in September 09, 2004, 04:19:55 VORMITTAG
Zitat von: Elijah Bliss in September 09, 2004, 12:24:55 VORMITTAG
Zitat von: 127.0.0.1 in September 08, 2004, 06:38:28 NACHMITTAGS
??? 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. :)

Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: [Unknown] in September 10, 2004, 03:54:08 VORMITTAG
Zitat von: Bloc in September 09, 2004, 04:19:55 VORMITTAG$context['user']['is_admin']!=1

Zitat$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]
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: bloc in September 10, 2004, 04:32:30 VORMITTAG
Zitat von: [Unknown] in September 10, 2004, 03:54:08 VORMITTAG
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 ;)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in September 10, 2004, 09:01:50 NACHMITTAGS
Zitat von: [Unknown] in September 10, 2004, 03:54:08 VORMITTAG
Zitat von: Bloc in September 09, 2004, 04:19:55 VORMITTAG$context['user']['is_admin']!=1

Zitat$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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: tenera in September 19, 2004, 02:37:53 NACHMITTAGS
Zitat von: Elijah Bliss in September 08, 2004, 01:30:52 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: [Unknown] in September 19, 2004, 03:45:10 NACHMITTAGS
Zitat von: tenera in September 19, 2004, 02:37:53 NACHMITTAGS
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.

ZitatIf 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]
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: HRM in September 26, 2004, 10:32:19 VORMITTAG
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Owdy in Oktober 07, 2004, 12:40:52 NACHMITTAGS
Zitat von: [Unknown] in September 05, 2004, 05:49:35 NACHMITTAGS
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']) )
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: CapriSkye in Oktober 15, 2004, 08:54:58 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: CapriSkye in Oktober 24, 2004, 04:30:02 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: CapriSkye in Dezember 20, 2004, 04:11:04 VORMITTAG
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.. :-\
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: CapriSkye in Dezember 29, 2004, 11:24:27 NACHMITTAGS
Zitat von: CapriSkye in Dezember 20, 2004, 04:11:04 VORMITTAG
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Ben Dragon in Januar 25, 2005, 06:12:02 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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 ?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Ben Dragon in April 12, 2005, 02:10:20 NACHMITTAGS
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)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Northerner in Juni 24, 2005, 09:41:26 NACHMITTAGS
as simple as this is, it really should be turned into a mod, some people might not know its available?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elmacik in September 02, 2005, 08:55:19 VORMITTAG
is there anyone who could do it work at last?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Snickers in Oktober 09, 2005, 08:40:04 VORMITTAG
lol, i'm confused, whats the final working version code for this?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Elijah Bliss in Oktober 09, 2005, 03:55:11 NACHMITTAGS
For 1.1 RC1, in Sources/Post.php
Code (FIND) Auswählen

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


Code (ADD AFTER) Auswählen

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


Code (FIND) Auswählen

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


Code (REPLACE) Auswählen

elseif (time() - $row['posterTime'] > $modSettings['edit_wait_time'] || $ID_MEMBER != $row['ID_MEMBER'])
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Snickers in Oktober 09, 2005, 04:18:14 NACHMITTAGS
THANKS!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ivo2296 in Januar 27, 2006, 12:34:23 VORMITTAG
Zitat von: Elijah Bliss in Oktober 09, 2005, 03:55:11 NACHMITTAGS
For 1.1 RC1, in Sources/Post.php
Code (FIND) Auswählen

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


Code (ADD AFTER) Auswählen

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


Code (FIND) Auswählen

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


Code (REPLACE) Auswählen

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


What about 1.0.5? please!

Thank you!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: coffee in Januar 28, 2006, 08:12:09 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: AliasAngel in Februar 04, 2006, 06:16:29 VORMITTAG
Sorry, computer somehow posted same message twice.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: AliasAngel in Februar 04, 2006, 06:16:56 VORMITTAG
What about for 1.1 RC2?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ernomo98 in Februar 17, 2006, 08:52:35 VORMITTAG
Zitat von: AliasAngel in Februar 04, 2006, 06:16:56 VORMITTAG
What about for 1.1 RC2?

up
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: furiousV in März 06, 2006, 03:35:29 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: fiver in April 01, 2006, 07:42:57 VORMITTAG
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 (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2F216.67.249.136%2FThemeImages%2Fnewsite%2Ficons%2Fmodify_inline.gif&hash=bc3fb0cf80000ca0ebed08519b4623787bf1415b)on the right of the post if you want to show admin's last edit

:D

Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: sawz in Mai 05, 2006, 02:58:35 NACHMITTAGS
Zitat von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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 :)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: FBI in Mai 05, 2006, 08:24:47 NACHMITTAGS
if (!$user_info['is_admin'])

Its works for my forum (http://www.forumbebas.net) with Simplicity Themes :)
Thanks..
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Mai 14, 2006, 01:56:54 NACHMITTAGS
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 ?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: sawz in Mai 14, 2006, 02:19:27 NACHMITTAGS
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?

Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Mai 14, 2006, 02:24:54 NACHMITTAGS
Zitat von: sawz in Mai 14, 2006, 02:19:27 NACHMITTAGS
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.  :'( :'( :'(
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: sawz in Mai 14, 2006, 02:39:20 NACHMITTAGS
it won't remove old edited by messages, those will remain.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Mai 14, 2006, 04:20:37 NACHMITTAGS
Zitat von: sawz in Mai 14, 2006, 02:39:20 NACHMITTAGS
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 :)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Mai 14, 2006, 06:33:23 NACHMITTAGS
Zitat von: sawz in Mai 14, 2006, 02:39:20 NACHMITTAGS
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 ?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: sawz in Mai 14, 2006, 07:17:16 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: mark25 in Juni 10, 2006, 12:06:26 NACHMITTAGS
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..  ;)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Oktober 07, 2006, 03:03:42 NACHMITTAGS
Zitat von: Elijah Bliss in September 08, 2004, 03:18:14 NACHMITTAGS
Zitat von: Bloc in September 08, 2004, 01:50:18 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: truelight5 in Oktober 09, 2006, 03:57:50 NACHMITTAGS
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:

Zitat// 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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in Oktober 09, 2006, 05:51:14 NACHMITTAGS
Zitat von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: truelight5 in Oktober 09, 2006, 05:56:41 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: MarkoWeb in Dezember 13, 2006, 12:32:43 NACHMITTAGS
What about 1.1? please!

Thank you!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: bcswebco.com in Januar 02, 2007, 10:49:49 VORMITTAG
Zitat von: Marko_ in Dezember 13, 2006, 12:32:43 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Hadi in Februar 12, 2007, 05:32:34 NACHMITTAGS
which modifecation we are talking here?

do you mean this:


Zitat von: bcswebco.com in Januar 02, 2007, 10:49:49 VORMITTAG
Zitat von: Marko_ in Dezember 13, 2006, 12:32:43 NACHMITTAGS
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.
Zitat von: Vinspire in Oktober 09, 2006, 05:51:14 NACHMITTAGS
Zitat von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: symon in Februar 13, 2007, 02:05:20 NACHMITTAGS
Zitat von: bcswebco.com in Januar 02, 2007, 10:49:49 VORMITTAG
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in April 30, 2007, 02:54:33 VORMITTAG
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!!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: TrueSatan in April 30, 2007, 07:13:27 VORMITTAG
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Mai 01, 2007, 10:57:08 NACHMITTAGS
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!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Mai 02, 2007, 05:11:10 NACHMITTAGS
Zitat von: ssnickerer in Mai 01, 2007, 10:57:08 NACHMITTAGS
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']
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Mai 02, 2007, 06:19:41 NACHMITTAGS
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);
}
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Mai 02, 2007, 06:44:40 NACHMITTAGS
Zitat von: ssnickerer in Mai 02, 2007, 06:19:41 NACHMITTAGS
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'])
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SMdot™ in Mai 04, 2007, 01:51:02 NACHMITTAGS
Zitat von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Mai 06, 2007, 04:03:10 NACHMITTAGS
Zitat von: Matt @ ARTcom in Mai 02, 2007, 06:44:40 NACHMITTAGS
Zitat von: ssnickerer in Mai 02, 2007, 06:19:41 NACHMITTAGS
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);
}
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: texterted in Mai 10, 2007, 03:21:30 NACHMITTAGS
I'd like this as a feature too. If anyone technical can please have a look at what's needed I'd be greatful.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Mai 11, 2007, 07:52:54 NACHMITTAGS
Zitat von: ssnickerer in Mai 06, 2007, 04:03:10 NACHMITTAGS
Zitat von: Matt @ ARTcom in Mai 02, 2007, 06:44:40 NACHMITTAGS
Zitat von: ssnickerer in Mai 02, 2007, 06:19:41 NACHMITTAGS
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);
}
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: texterted in Mai 12, 2007, 06:23:21 VORMITTAG
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: af3 in Mai 22, 2007, 08:41:59 NACHMITTAGS
How about this:

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

HELP!
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Juni 28, 2007, 05:12:24 NACHMITTAGS
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) Auswählen
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) Auswählen
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) Auswählen
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) Auswählen
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: amirali.b in Juli 02, 2007, 05:16:45 VORMITTAG
ok nice...it works....
thanks
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: pirat3 in Juli 31, 2007, 04:49:08 NACHMITTAGS
so des this work with 1.1.2 Matt @ ARTcom?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: amirali.b in Juli 31, 2007, 04:58:11 NACHMITTAGS
I quess it works with 1.1.2
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Juli 31, 2007, 05:24:33 NACHMITTAGS
I don't see why it shouldn't.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: pirat3 in Juli 31, 2007, 05:56:02 NACHMITTAGS
Works 100% on SMF 1.1.2
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Joshua Dickerson in Juli 31, 2007, 06:05:07 NACHMITTAGS
Zitat von: pirat3 in Juli 31, 2007, 05:56:02 NACHMITTAGS
Works 100% on SMF 1.1.2
You should upgrade to 1.1.3 :P
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: lexhair in August 02, 2007, 09:45:50 VORMITTAG
Zitat von: [Unknown] in September 19, 2004, 03:45:10 NACHMITTAGS
Zitat von: tenera in September 19, 2004, 02:37:53 NACHMITTAGS
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.

ZitatIf 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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Hesperus-Lux in August 10, 2007, 04:03:36 NACHMITTAGS
Zitat von: sawz in Mai 05, 2006, 02:58:35 NACHMITTAGS
Zitat von: mab in März 09, 2005, 05:24:59 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: NGame.nl in August 14, 2007, 04:32:15 VORMITTAG
Yeah, I would like to know that too. Also for my own made User Group.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: NGame.nl in August 15, 2007, 03:24:54 NACHMITTAGS
Someone?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: BHClanGaming.com™ in Oktober 02, 2007, 03:49:03 NACHMITTAGS
didn't work for me.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: asdas2 in Oktober 05, 2007, 12:17:50 NACHMITTAGS
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Oktober 10, 2007, 11:13:31 VORMITTAG
Zitat von: SlammedDime in Juni 28, 2007, 05:12:24 NACHMITTAGS
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) Auswählen
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) Auswählen
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) Auswählen
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) Auswählen
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."
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Oktober 10, 2007, 11:25:28 VORMITTAG
Any errors in your error log?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Oktober 10, 2007, 11:43:27 VORMITTAG
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. =\
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Oktober 10, 2007, 12:53:14 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Oktober 10, 2007, 04:31:35 NACHMITTAGS
Thats a bug in 1.1.3... should have been fixed in 1.1.4.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Oktober 10, 2007, 04:36:47 NACHMITTAGS
Zitat von: SlammedDime in Oktober 10, 2007, 04:31:35 NACHMITTAGS
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. =\
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: ssnickerer in Oktober 12, 2007, 01:11:01 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: lanlord in November 04, 2007, 10:52:34 NACHMITTAGS
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.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Fiery in Dezember 08, 2007, 11:16:47 NACHMITTAGS
Can everyone that is having an issue post their current issue?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Trinny in Februar 18, 2008, 04:35:42 NACHMITTAGS
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?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Vinspire in April 07, 2008, 12:19:31 VORMITTAG
Zitat von: SlammedDime in Juni 28, 2007, 05:12:24 NACHMITTAGS
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) Auswählen
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) Auswählen
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) Auswählen
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) Auswählen
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 :)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: lanlord in Juli 01, 2008, 11:48:42 VORMITTAG
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.

Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: assam_siddibapa in Juli 09, 2008, 10:40:12 VORMITTAG
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
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: TheDisturbedOne in November 08, 2008, 06:57:02 NACHMITTAGS
SlammedDime's doesn't work for me in 1.1.7
Can anybody tell me what went wrong?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: aw06 in Januar 19, 2009, 09:37:21 NACHMITTAGS
Zitat von: SlammedDime in Juni 28, 2007, 05:12:24 NACHMITTAGS
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) Auswählen
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) Auswählen
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) Auswählen
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) Auswählen
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 ??
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: SlammedDime in Januar 19, 2009, 09:53:39 NACHMITTAGS
I don't know why TheDisturbedOne had problems, but it should work just fine.
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: aw06 in Januar 19, 2009, 10:07:33 NACHMITTAGS
gonna try in 1.1.7 and report back
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: aw06 in Januar 19, 2009, 10:48:30 NACHMITTAGS
OK, works for on 1.1.7 without errors
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: aw06 in Januar 20, 2009, 08:24:23 VORMITTAG
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 ..
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: TheDisturbedOne in Januar 20, 2009, 06:26:32 NACHMITTAGS
Zitat von: SlammedDime in Januar 19, 2009, 09:53:39 NACHMITTAGS
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 :)
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: Jessikard in April 03, 2009, 05:24:30 VORMITTAG
we tried all changings, but now only admin can see the edit  :(

Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: akosiparusa in Juli 10, 2009, 10:40:24 VORMITTAG
what if the updater is a moderator. what code is needed?
Titel: Re: Don't Show Last Edit If Updater Is Admin
Beitrag von: RML in Dezember 04, 2009, 04:09:28 VORMITTAG
It doesn't work with SMF 2.0 RC2. Is there any chance to modify it to work with that version?