I am using the 4.4.0 version and I notice that after scheduling an hide or post, if you decide to remove them later the entry isn't removed from the DB table. Which means after scheduling you can't remove it anymore.

I made a change in the write hook and added some lines, I don't know how to make a patch otherwise I'd provide one.
If anyone needs the same code here it is:

** Just replace this: **

function scheduler_write($node, $op, $arg) {

  if (user_access("administer nodes") && ($node->scheduler_post || $node->scheduler_hide)) {

    if ($node->scheduler_post) {
      $conds["timestamp_posted"] = scheduler_nodetime($node, "post");
    }
    else {
      $conds["timestamp_posted"] = 0;
    }
    if ($node->scheduler_hide) {
      $conds["timestamp_hidden"] = scheduler_nodetime($node, "hide");
    }
    else {
      $conds["timestamp_hidden"] = 0;
    }

    if ($op !== "insert") {
      // Determine whether we must UPDATE or INSERT, then do it
      $result = db_query("SELECT * FROM {scheduler} WHERE nid = %d", $node->nid);
      if (db_num_rows($result)) {
        foreach ($conds as $key => $value) {
          $update_conds[] = "$key=$value";
        }
        db_query("UPDATE {scheduler} SET %s WHERE nid = %d", implode(", ", $update_conds), $node->nid);
      }
      else {
        scheduler_insert($node, $conds);
      }
    }
    else {
      scheduler_insert($node, $conds);
    }
  }
}

** With this: **

function scheduler_write($node, $op, $arg) {

  if (user_access("administer nodes") && ($node->scheduler_post || $node->scheduler_hide)) {

    if ($node->scheduler_post) {
      $conds["timestamp_posted"] = scheduler_nodetime($node, "post");
    }
    else {
      $conds["timestamp_posted"] = 0;
    }
    if ($node->scheduler_hide) {
      $conds["timestamp_hidden"] = scheduler_nodetime($node, "hide");
    }
    else {
      $conds["timestamp_hidden"] = 0;
    }

    if ($op !== "insert") {
      // Determine whether we must UPDATE or INSERT, then do it
      $result = db_query("SELECT * FROM {scheduler} WHERE nid = %d", $node->nid);
      if (db_num_rows($result)) {
        foreach ($conds as $key => $value) {
          $update_conds[] = "$key=$value";
        }
        db_query("UPDATE {scheduler} SET %s WHERE nid = %d", implode(", ", $update_conds), $node->nid);
      }
      else {
        scheduler_insert($node, $conds);
      }
    }
    else {
      scheduler_insert($node, $conds);
    }
  }
  else {
      // In case there used to be an entry but now it's disabled remove it from the DB
      $result = db_query("SELECT * FROM {scheduler} WHERE nid = %d", $node->nid);
      if (db_num_rows($result)) {
        db_query("DELETE FROM {scheduler} WHERE nid = %d", $node->nid);
      }
  }
}

I do think this should be implemented into the module, but maybe it's already fixed in the 4.5.0 version.

Comments

moshe weitzman’s picture