This is really similar to this issue:
http://drupal.org/node/896756
But it relates to more than just PHP code. When I set a "triggered rule" to update the CCK field, if I set the value with the text field ( help text: Format: 2011-04-06 16:45) then it still will set the field value to the current time, so every time the page reloads when viewing the field, (either on the node view page, or viewing the field after views pulls it) it will show the current time, not the value I set it to in rules.
What really confuses me, is that when I go back to view the rule setting, the field value that is in the form is showing the current time, too...
The same thing happens if I try to return php code.. I've tried all of these (and more):
(note that a few try to use a workflow token value for a timestamp, which definitely works, and is accurate, as I've tried printing these values into my site log with watchdog()
They show up properly in the reports, but everytime I view the node, I see the current time.
return array(
0=> array('value'=> date("Y-m-d h:i"))
);
return array(
0=> array('value'=> date("Y-m-d h:i", "[node:workflow-current-state-date-tstamp]"))
);
<?php
return array(
0=> array('value'=> date("Y-m-d h:i",intval("[node:workflow-current-state-date-tstamp]")))
);
return array(
0=> array('value'=> time())
);
and many more...
I've tried adding seconds, returning time stamps.. you name it.
( per this issue : http://drupal.org/node/265076 )
But no matter what I do, if the value gets set by rules.. It will be saved as the current time..
Why would you ever want a field to show the current time anyway?
Comments
Comment #1
tmsimont commentedI should mention that when using version 6.x-2.3, this actually works:
But in 6.x-2.7, no go.
So I imagine this is a bug that was introduced between 2.3 and 2.7
Comment #2
notluap commentedI am also having this issue. Setting a cck date field via php with rules, the cck date field always spouts out the current time.
Comment #3
SuperStes commentedSame here (sort of; see http://drupal.org/node/1146822)
Tweaking with the php code entered in the rule either gives me the current date or 01/01/1970.
I find it very hard to find support for this problem!
Comment #4
l_o_l commentedI also had problems setting a CCK field type date to some date with rules, using 6.x-2.7 (D6.22).
The date always became '2011-01-01'.
But eventually this worked for me. Its sets the date as it should (and like I want):
I do not know why this works. Maybe it helps somebody else.
Comment #5
Encarte commentedComment #6
runzipel commentedinserts actual time...
Comment #7
tmsimont commented@runzipel i don't think you read the issue...
Comment #8
damienmckennaUnfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.