I want to convert a node from one content type ("Project") to another one ("Project follow up"), basing on the comparison between the current date (using PHP) and the value of a field date ("Project signup date," which is a CCK date field). Currently, I am using a rule set that will be scheduled based on a check that a rule does when the project is created. The rule set than checks (upon a successful cron run) if the date is higher than the field date (using the date timestamp); the rule set will then convert the node from "Project" to "Project followup."

As I keep getting errors when testing the rule/rule set, I must ask if I'm doing it right. What are the proper PHP evaluation and token replacement pattern? The following are the replacement tokens, and my default PHP code.

Replacement tokens

[node:field_pdate-value]     The raw date value.
[node:field_pdate-view]      The formatted date.
[node:field_pdate-timestamp] The raw date timestamp.
[node:field_pdate-yyyy]      Date year (four digit)
[node:field_pdate-yy]        Date year (two digit)
[node:field_pdate-month]     Date month (full word)
[node:field_pdate-mon]       Date month (abbreviated)
[node:field_pdate-mm]        Date month (two digit, zero padded)
[node:field_pdate-m]         Date month (one or two digit)
[node:field_pdate-ww]        Date week (two digit)
[node:field_pdate-date]      Date date (YYYY-MM-DD)
[node:field_pdate-datetime]  Date datetime (YYYY-MM-DDTHH:MM:SS)
[node:field_pdate-day]       Date day (full word)
[node:field_pdate-ddd]       Date day (abbreviation)
[node:field_pdate-dd]        Date day (two digit, zero-padded)
[node:field_pdate-d]         Date day (one or two digit)
[node:field_pdate-dS]        Date day (one or two digit) with ordinal suffix (st, nd, rd or th)
[node:field_pdate-time]      Time H:i

PHP code

php echo time();
  • What kind of comparison do you want to do? Commented Apr 22, 2011 at 4:51
  • The PHP code is not making any comparison; it is just outputting the time of when it is executed.
    – apaderno
    Commented Apr 22, 2011 at 14:11

1 Answer 1


Node Convert might help you with the node conversion from one type to another. http://drupal.org/project/node_convert

I'm not sure if you can use this module to do it programmatically, but it might help to look at this structure and run something similar on a cron job.

  • Node_convert has good field-mapping support: how to deal with the data in fields when migrating from one type to another. That is the hardest part of migrating.
    – berkes
    Commented Sep 9, 2011 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.