Hi, I'm trying to hack your module so that any nodes, when edited, also cause an update and the edits can be seen.

I thought it would require something like:

in livecoverage_nodeapi(
...
case 'update':
// if ($node->livecoverage) {
$delta = db_result(db_query("select delta from livecoverage_node where unid = $node->nid"));
$delta++;
// Relate this node to the event
db_query("UPDATE livecoverage_node SET delta = $delta where unid = $node->nid");
// Notify the event that it has been updated
db_query("UPDATE {livecoverage_settings} SET changed = %d WHERE pnid = %d", time(), $node->event_nid);
// }

This is code increements the delta fine, but does not cause an update
Any hints on what extra needs to be done?

Comments

Bimble’s picture

To get this to work, a couple of additional changes need to be made:

    case 'update':
//      if ($node->livecoverage) {
        $delta = db_result(db_query("select delta from livecoverage_node where unid = $node->nid"));
        $delta++;
        // Relate this node to the event
        db_query("UPDATE livecoverage_node SET delta = $delta where unid = $node->nid");
        // Notify the event that it has been updated
   $time = time()-2;
        $pnid = db_result(db_query("select pnid from livecoverage_node where unid = $node->nid"));
        db_query("UPDATE {livecoverage_settings} SET changed = %d WHERE pnid = %d", $time, $pnid);
//      }

Also, in livecoverage_load() $result needs to query on "changed' not 'created':

    $result = db_query("SELECT l.unid FROM {livecoverage_node} l INNER JOIN {node} n ON n.nid = l.unid WHERE l.pnid = %d AND n.changed > %d", $nid, $changed);