Nodes saved in node_expire table with value of 0 then unpublished

barckhoff - May 19, 2009 - 07:59
Project:Node Expire
Version:6.x-2.03
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Running Drupal 6.11. Using "copy & paste" action code.

Have only one custom content type set to expire after 1 month. All other content types should not have expiration.
Applied patches ( here and here) to fix default date of 1970-01-01 and to hide fields which were appearing in Image content type -- others were working fine.

However, whenever I publish an Image, Node Expire adds the node to the node_expire table with a value of 0 in the "expire" column. When cron is run, the module acts as though the Image node has expired and unpublishes it.

Any ideas on how to fix this???

#1

barckhoff - May 26, 2009 - 13:54
Title:Image nodes saved in node_expire table with value of 0 then unpublished» Nodes saved in node_expire table with value of 0 then unpublished

Now this is happening with book nodes also....

#2

smsearcy - May 29, 2009 - 16:40

I posted an update to #426636: Errors on cron run that should fix the problem. Please let me know if it helps.

#3

barckhoff - June 2, 2009 - 07:42

Thank you, smsearcy!!! I applied the modified patch posted by arthurf and it seems to be working.

Now the only issue I have is to get it to stop subtracting one day from the expiration date each time the node is edited. Any ideas on how to do that?

#4

smsearcy - June 3, 2009 - 01:17

I'm not sure since I didn't run into that issue. Is the expiration date displayed when editing a node (assuming you have edit node permissions enabled) the correct or incorrect value? If it's displaying incorrectly, I think that is set in _node_expire_form_alter_nodeform() in node_expire.nodeapi.inc. I've made some changes so mine looks like this at the beginning of the function (I think I based this on the default date code posted at #405608: Empty Expiration Date Field is filled with bad information!).

function _node_expire_form_alter_nodeform(&$ntypes, &$form, &$form_state, $form_id) {
  // Check if the Node Expire feature is enabled for the node type
  $node = isset($form['#node']) ? $form['#node'] : NULL;

  // Convert the timestamp into a human readable date
  if (is_numeric($node->expire)) {
    if ($node->expire != 0) {
      $node->expire = format_date($node->expire, 'custom', NODE_EXPIRE_FORMAT);
    } else {  // expiration date is 0, set default if available
      if (!empty($ntypes['default'])) {
        $node->expire = format_date(strtotime($ntypes['default']), 'custom', NODE_EXPIRE_FORMAT);
      } else {
        $node->expire = '';
      }
    }
  }

I hope that can be of some help.

#5

barckhoff - June 19, 2009 - 12:24
Status:active» closed

Wow, sorry for the delayed response, I had moved on to other things for awhile.

Well, I tried inserting your new code, but it didn't seem to work for me.

Anyway, the -1 day issue is more appropriately addressed here: http://drupal.org/node/435658, so I guess this one should be closed.

Thanks for your help.

 
 

Drupal is a registered trademark of Dries Buytaert.