News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Don't Show Last Edit If Updater Is Admin

Started by 127.0.0.1, September 05, 2004, 05:12:17 PM

Previous topic - Next topic

ssnickerer

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!

SlammedDime

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']
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

ssnickerer

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);
}

SlammedDime

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'])
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SMdot™

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

ssnickerer

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);
}

texterted

I'd like this as a feature too. If anyone technical can please have a look at what's needed I'd be greatful.

SlammedDime

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);
}
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

texterted

#68
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?

af3

How about this:

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

L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


sup_iran

do not work for me too :(
1.1RC3 but it dont works.  I add if (!$user_info['is_admin']) but nothing........

HELP!

SlammedDime

#72
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.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

amirali.b

#73
ok nice...it works....
thanks

pirat3

so des this work with 1.1.2 Matt @ ARTcom?

amirali.b


SlammedDime

SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

pirat3


Joshua Dickerson

Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

lexhair

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.

Advertisement: