1 ms6682 Feb 17, 2006 02:32
3 ms6682 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 blueyed Feb 17, 2006 17:55
It does get handled in DataObject::dbupdate()
means it's in /evocore/_dataobject.class.php, sorry..
5 ms6682 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 blueyed 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 ms6682 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 blueyed 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 ms6682 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 blueyed Feb 18, 2006 00:27
The second line is a no-operation.
You can (and should for clarity!) remove it.
11 ms6682 Feb 18, 2006 01:20
I realized that too! :oops: Thanks anyway. I'll reciprocate by contributing back to this community. Cheers!
12 blueyed 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.
13 ms6682 Feb 18, 2006 03:12
I've posted a hack http://forums.b2evolution.net/viewtopic.php?t=7184. Is this what you would consider a plugin? I can't figure out how to incorporate it as an 'Installed plug-ins' as listed under b2evo settings menu.
14 blueyed 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!
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).