Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Is there a way to get grab a date that a post was edited? Even if it means a custom field that always gets filled with the current date would work for me. I don't want something the editor will have to worry about filling in, needs to be automatic.
Based on an answer from another thread I came up with the following, I haven't tested it yet but I also don't know enough about this code to know if this will cause any issues.

Am I on the right track here?

The following would go in my kfunctions file:
Code: Select all
class SetEditedDate{
    function set_edited_date( $field ){
        global $FUNCS;
       
        // get publish date ..
        $f = &$field->siblings[3];
        $publish_date = trim( $f->get_data() );
        $field->data = $publish_date;
        $field->modified = 1;
        unset( $f );
       
        return true;
    }
}


And then I would just add a validator on the field like this:
Code: Select all
validator='SetEditedDate::set_edited_date'


And then just hide this field from the user in the admin panel using a message field with CSS in it.

I believe this should always get me the edited date then. Can anyone confirm I'm thinking this right?
Hehe so after testing this it doesn't work. But I just noticed there isn't really anything here saying what date to fill in.. not sure how this is supposed to work since I'm basing it off another thread.

So far this isn't doing anything for me.
Hi,

Please try the following -
Code: Select all
<cms:show k_page_modification_date />

Hope it helps.
KK wrote: Hi,

Please try the following -
Code: Select all
<cms:show k_page_modification_date />

Hope it helps.


Well that works about a thousand times better! Thanks KK!! And again, this script just keeps kicking but!
5 posts Page 1 of 1