Our alert is unpublishing every time cron runs. I outputted the time passed (time() - $result->created) to the log output and ended up with a really high number (1282950964 seconds in this case). I'm not really sure why this would be, the code seems correct to me, so maybe the result is being returned wrong?

Comments

kevinquillen’s picture

Assigned: Unassigned » kevinquillen

I will take a look. At first glance it looks correct but will debug it.

kevinquillen’s picture

Status: Active » Postponed (maintainer needs more info)

Can you give me some more information about this? What is your time limit set to? I tried to debug this but was not able to replicate.

Anonymous’s picture

My time limit is 24 hours. We are still in the development stage so we're running cron a lot and clearing the cache a lot, but the unpublishing seems rather random. I can't even really say it is happening every time cron is run but it has certainly consistently unpublished before the 24 hour limit. I'll publish a few more today and see what happens. Hopefully I can find out a little more information for you.

Anonymous’s picture

I've narrowed down what's causing this (for us at least). Any time any content is added or updated on the site, the user alert seems to be unpublished. I think user_alert_nodeapi fires every time any node is updated or inserted. So there should be a check in there for the node type user_alert. The following code seems to work for me.

function user_alert_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
	switch ($op) {
		case 'insert':
		case 'update':
		  if ($node->type == 'user_alert') {
  			$result = db_query('SELECT nid, status FROM {node} WHERE type = "%s" AND nid != %d', 'user_alert', $node->nid);
  			while ($row = db_fetch_object($result)) {
  				db_query('UPDATE {node} SET status = %d WHERE status = %d AND nid = %d', 0, 1, $row->nid);
  			}
		  }
		break;
	      default:
		break;
	}
}
kevinquillen’s picture

Okay, I see what you are saying. Makes sense now.

kevinquillen’s picture

Status: Postponed (maintainer needs more info) » Fixed

#4 added to 6.x-.1.3

Anonymous’s picture

Status: Fixed » Active

Awesome, sounds great.

However, I downloaded 1.3 and this doesn't seem to have made it in.

kevinquillen’s picture

You are right. I added the change last night and tagged the release and created it. Odd.

I am new to CVS on Drupal so I apologize. It has been hit or miss for me.

Anonymous’s picture

No problem, I think you're doing great. I don't have much experience with CVS either so I can't say I'd be doing much better.

kevinquillen’s picture

Status: Active » Fixed
kevinquillen’s picture

It got included in the release that time.

kevinquillen’s picture

Version: 6.x-1.1 »

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.