Hi all i am trying to simply get the event end date, and test if it is before the current site date,
then if it is i want to unpublish the node.

here is my code.
if([node:event_end_date] < [node:site_date]){
print "status ff";
[node:status] = 0;
}

with this i get this error
Parse error: syntax error, unexpected '[' in /homepages/30/d228688870/htdocs/test/htdocs/sites/all/modules/workflow_ng/workflow_ng/modules/workflow_ng_workflow_ng.inc(77) : eval()'d code on line 1

i have also tried this code.
print "event=";
print $node->event_end_date ;
print "site date=";
print $node->site_date ;
if($node->event_end_date > $node->site_date){
print "status off";
$node->status = 0;
}

and i get this printed.
event=site date=

and neither unpublishes my node.

can anyone tell me what i am doing wrong please?
or what code i should be writing, or what i should be doing please help.

Comments

f1wade’s picture

ive managed to find the fix for it, but make sure you test it a lot on your system as i found i unpublished pages as well as events, but i just added the condition that it was a node of type, and selected all my events.

php code is :

if([node:event-end-yyyy]<[node:site-date-yyyy] ||
([node:event-end-yyyy]<=[node:site-date-yyyy] && [node:event-end-ww] < [node:site-date-ww])){
$node->status = 0;
return array("node" => $node); 
}

full workflow to import if you want to ( at own risk)
array (
'cfg_19' =>
array (
'#id' => 1,
'#event' => 'node_view',
'#module' => 'workflow-ng',
'#altered' => false,
'#weight' => '0',
'#type' => 'configuration',
'#active' => 1,
'#label' => 'unpublish out of date stuff',
0 =>
array (
'#id' => 2,
'#type' => 'action',
'#name' => 'workflow_ng_action_custom_php',
'#label' => 'Execute custom PHP code',
'#settings' =>
array (
'php' => 'if([node:event-end-yyyy]<[node:site-date-yyyy] ||
([node:event-end-yyyy]<=[node:site-date-yyyy] && [node:event-end-ww] < [node:site-date-ww])){
$node->status = 0;
return array("node" => $node);
}',
'used_arguments' =>
array (
0 => 'node',
),
'used_php_arguments' =>
array (
0 => 'node',
),
),
),
1 =>
array (
'#type' => 'condition',
'#name' => 'workflow_ng_condition_content_is_type',
'#argument map' =>
array (
'node' => 'node',
),
'#settings' =>
array (
'type' =>
array (
'dive_trip' => 'dive_trip',
'social' => 'social',
'weekly_dive' => 'weekly_dive',
'weekly_lecture' => 'weekly_lecture',
'poolsession' => 'poolsession',
),
),
),
'#name' => 'cfg_19',
),
)