0

I am trying to update Node on hook_cron function. I am using Drupal6 Here is my Code

function offers_cron() {
$query= db_query("SELECT * FROM {node} WHERE type = 'product'");
while($allnodes = db_fetch_object($query)){
    $node_id=$allnodes->nid;
    $node=node_load($node_id);
$node = new stdClass();
    $node->nid = $node_id;  
    $node->type = 'product';
    $node->language = 'en';
    $node->uid=1;
    $node->status = 1; 
    $node->created = time();
    $node->changed = $node->created;
    $node->comment=0;
    $node->promote = 0; 
    $node->sticky = 0;  
    $node->format = 2;  
    $node->title='test';
    $node->field_price[0]['value']='120';
    if ($node = node_submit($node)) {
        node_save($node);
          drupal_set_message(t("Node ".$node->title." added correctly"));
    } else {
        drupal_set_message(t("Node ".$node->title." added incorrectly"), "error");
    }


}


}

Now it shows it has updated all nodes here is screen shot for this enter image description here

Now when i click any node it doesnot show any updation See here enter image description here

Any Body have Idea About this

By it occurs Problem. I even Clear Cache

kiamlaluno
  • 24,790
  • 16
  • 70
  • 85
harpreet kaur
  • 143
  • 1
  • 3
  • 10
  • Closed as cross-site posting: http://drupal.stackexchange.com/questions/22621/node-update-problem-on-hook-cron – casperOne Feb 15 '12 at 22:15

1 Answers1

0

If node doesn't change, don't create new revision

Hitu Bansal
  • 2,081
  • 9
  • 44
  • 83