A Node Teaser on an unpublished node resets to NULL when it is published by the Scheduler module.

Configuration:

-Drupal 4.7.6
-Latest build of Scheduler for 4.7.x
-Node Teaser module used for teasers, latest 4.7.x build

When a node is authored and saved in an unpublished state, the Node Teaser is properly saved, too. But when published by Scheduler, the Node Teaser is reset to NULL. Behavior prevents us from scheduling nodes to be published without human intervention.

Thinking this was a bug in Scheduler, I opened an issue there. Got this from the maintainer of Scheduler:

"Sorry guys but but when Scheduler publishes all it does is :

  $node = node_load(...);
  $node->status = 1;
  node_save($node);

All Drupal API calls. Nodeteaser's tables are not touched by Scheduler. So the fault must me in Nodeteaser as it doesn't seem to be handling node_load() / node_save() API calls."

Comments

AdrianB’s picture

That issue is already moved to Node Teaser:
http://drupal.org/node/150298

josh@pixael.com’s picture

Version: 4.7.x-1.x-dev » 5.x-1.1

this happens also in drupal 5.3!

josh@pixael.com’s picture

the problem is in _nodeteaser_update

replace with this new function and the teaser will not reset by scheduler

function _nodeteaser_update($node) {

 if($node->nodeteaser!="" && $node->nodeteaser!=" ") 

   if(db_query("UPDATE {node_revisions} SET teaser='%s' WHERE vid=%d",$node->nodeteaser, $node->vid) == FALSE)

     return FALSE;



 $nt = db_fetch_object(db_query('SELECT teaser FROM {nodeteaser} WHERE nid = %d', $node->nid));



 if ($nt && $node->nodeteaser!="" && $node->nodeteaser!=" ")

   return db_query("UPDATE {nodeteaser} SET teaser = '%s' WHERE nid = %d", $node->nodeteaser, $node->nid);

 else

   return _nodeteaser_insert($node);

 }