Closed (fixed)
Project:
Entity API
Version:
7.x-1.0-rc1
Component:
Code - misc
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2011 at 08:32 UTC
Updated:
14 Feb 2012 at 03:30 UTC
Hello, I'm trying to use this action to re-save "old" nodes to update some of their data when cron is ran:
$old = '1 month'; # Content is considered outdated if older than {$old}
$type = 'model'; # Apply to nodes of type {$type}
$count = 20; # Update {$count} nodes per cron
$old = strtotime("now - $old");
$nids = db_query_range('
SELECT n.nid
FROM {node} n
WHERE n.type = :type AND n.created < :old
ORDER BY n.created ASC',
0, $count, array(':old' => $old, ":type"=>$type)
);
foreach ($nids as $nid){
$node = node_load($nid);
node_save($node);
}However, when I've enabled the action and try to run cron, I receive this message:
Could anyone shed some light on what has gone wrong? Thank you.
Comments
Comment #1
millwardesque commentednode_load expects the $nid parameter to be the NID of the node rather than an object containing the NID (see http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...)
Try using the following instead.
Comment #2
andregriffin commentedThat worked brilliantly. Thank you so much!
Comment #3.0
(not verified) commentedobfuscate client name