Hi there.
I'm trying to set up scheduling of nodes and have thus checked out the scheduler module. On the site I'm also using the teaser module to set up a separate teaser field.
When scheduling nodes for publishing I've experienced that if nodes are set up with scheduled publishing the contents of the teaser field is wiped when the node is published.
Here's an output of the relevant tables before and after publishing:
Before:
mysql> select * from node_revisions where nid = 715\G
*************************** 1. row ***************************
nid: 715
vid: 715
uid: 1
title: Yeah
body: <p>jada <img width="206" height="169" src="/files/u1/ucon_wht_bg.gif" alt="" /></p>
teaser: <p>jada <img width="206" height="169" src="/files/u1/ucon_wht_bg.gif" alt="" /></p>
log:
timestamp: 1241054930
format: 3
1 row in set (0.00 sec)
mysql> select * from nodeteaser where nid = 715\G
*************************** 1. row ***************************
nid: 715
teaser: <p>hm, dette er bare en test.</p><br /><p> </p>
1 row in set (0.00 sec)
After:
mysql> select * from node_revisions where nid = 715\G
*************************** 1. row ***************************
nid: 715
vid: 715
uid: 1
title: Yeah
body: <p>jada <img width="206" height="169" src="/files/u1/ucon_wht_bg.gif" alt="" /></p>
teaser: <p>jada <img width="206" height="169" src="/files/u1/ucon_wht_bg.gif" alt="" /></p>
log:
timestamp: 1241055167
format: 3
1 row in set (0.00 sec)
mysql> select * from nodeteaser where nid = 715\G
*************************** 1. row ***************************
nid: 715
teaser:
1 row in set (0.00 sec)
In other words, the field teaser in the nodeteaser table has been wiped clean.
I've looked a bit at the source code for the scheduler module and I have a theory that node_load() and the following node_save() are the problems here.
while ($node = db_fetch_object($nodes)) {
$n = node_load($node->nid);
$n->changed = $node->publish_on;
if (variable_get('scheduler_touch_'. $n->type, 0) == 1) {
$n->created = $node->publish_on;
}
$n->status = 1;
node_save($n);
I'm guessing node_load() isn't picking up the information in nodeteaser table and then it will be overwritten by the following node_save(). But this is just speculation on my behalf. Maybe some more experienced Drupal developers can shed some light on this?
Comments
Comment #1
eric-alexander schaefer commentedPlease have a look at #426728: OG and Scheduler-Module. Same reason. Please post an issue against the teaser module and point them to #426728: OG and Scheduler-Module.
Comment #2
mflage commentedSo basically what you're saying is that the issue is one with the teaser module?
Looking at the post you've linked to and the code in the nodeteaser module I'm wondering if the fix isn't a easy one to implement:
You say in the other post that it doesn't respect the 'load' case. Meaning that the code needs an additional case for the 'load':
Would something along those lines work? I'm not a Drupal developer, so I really need to be sure that I do the correct thing here before breaking something :)
EDIT: I tried activating that code, and it looks like it's actually called quite often, because right after activating it I got "1" written out in every section where it previously was the teaser.
Comment #3
eric-alexander schaefer commentedExactly. There should be a 'load' case, but I don't know if you code snippet would work because I know nothing about the teaser module. Please ask the teaser people. They should know what to do.