Recent Topics

1 Feb 17, 2006 02:32    

[u]Version: Phoenix Alpha 1.6[/u]

I need to correct certain contents regularly that ain't considered an update. Hence, I needed an option to disable the AUTOMATIC update of mod_date/ datemodified field to the current timestamp during edit.

I tried to customize this hack from http://blog.yakaledo.net/b2e/index.php/2005/08/13/test but couldn't achieve what I need.

I played around many times over with the item_issue_date in b2edit.php. Duplicate the whole code into item_mod_date and managed to pull out the data onto the form. However, it wouldn't commit the item_mod_date into the db. I traced and found the dbupdate() function and realised item_mod_date is not there. Apparently, it seems to be commited elsewhere.

An expert would take less than 1-2mins on this, huh? :roll: Well, I've taken a whole day! :'( Help me, pls...

2 Feb 17, 2006 03:33

It does get handled in DataObject::dbupdate(), as $this->datemodified_field which is "item_mod_date" for the Item class (which is derived from DataObject).

3 Feb 17, 2006 05:04

I found this in _item.class.php

		// this is automatic $this->set( 'datemodified', date('Y-m-d H:i:s', $localtimenow ) );


I un-commented it and forced a value but it didn't work. It seems that I shouldn't be trying anything there.

I traced datemodified to edit_actions.php and by passing a direct value,

$edited_Item->set( 'datemodified', date('Y-m-d H:i:s','2006-02-12 17:46:52') );


I am able to change the datemodified' accordingly. However, this line of code only appears for case 'publish' & case 'deprecate'. I cannot find a similar code for case 'update'.

Pardon my shallow knowledge of programing (from school more than 10 years ago... those Pascal days... ) for I've never touched programming since! :oops: What a shame... I don't mean to disturb you guys, but I've really tried my best with my limited skills.

4 Feb 17, 2006 17:55

It does get handled in DataObject::dbupdate()

means it's in /evocore/_dataobject.class.php, sorry..

5 Feb 17, 2006 23:21

Great. I've found the code to control the modified date... under function dbupdate

$this->set_param( $this->datemodified_field, 'date', date('Y-m-d H:i:s',$localtimenow) );

Call me shallow, but could someone kindly tell me how to pass the current modified date value to replace $localtimenow ?

6 Feb 17, 2006 23:39

The current one of the Item?

this would be $this->datemodified_field, but you'd rather want to comment the whole line out then.. :)

7 Feb 17, 2006 23:54

:o :) :lol: ... This is so embarassing! :oops:

I've been trying to replace $localtimenow with the right variables and all it takes was to replace the WHOLE line with $this->datemodified_field !!! This is so embarassing!

Thank you, Daniel. Thank you very much! I've got a long way to go...

8 Feb 17, 2006 23:58

Hmm, I hope you've understood me right:
commenting out means, add a "//" or "#" in front of the line, not just putting


$this->datemodified_field;


there, as it would make no sense.

Anyway, welcome on board and I think you're on the right track.. :)

9 Feb 18, 2006 00:17

Not sure if I did right, but here's what I did... and it works! :D

//			$this->set_param( $this->datemodified_field, 'date', date('Y-m-d H:i:s',$localtimenow) );
			$this->datemodified_field;

10 Feb 18, 2006 00:27

The second line is a no-operation.

You can (and should for clarity!) remove it.

11 Feb 18, 2006 01:20

I realized that too! :oops: Thanks anyway. I'll reciprocate by contributing back to this community. Cheers!

12 Feb 18, 2006 01:23

I'm looking forward to it.. :)

There will be a great plugin API/system with Phoenix, so the doors should be open.

14 Feb 18, 2006 03:42

This is a very good hack and well documented. The only drawback I see is with the last block where you should have stated in which "case" you've inserted your line. It's the one above "editcomment", currently, but the order might change.

Currently you cannot make this a plugin. There would hooks be needed, where your plugin interacts with the core in the three places you've placed your code.

Thanks for summarizing and contributing!


Form is loading...