unpublished nodes

Bartezz - December 12, 2008 - 16:11
Project:Header image
Version:5.x-1.1
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

I've just tried to unpublish a node which is being used as a header image by your module but eventhough the node is unpublished it shows in the header.

Is there a way to fix this, I'm combining your module with scheduler to unpublish header images but it doesn't work as your module doesn't respect the publish/unpublish setting.

Hope it's fixable :)

Cheers,
Bartezz

#1

Bartezz - December 12, 2008 - 20:40

Actually it is fixable :)

I can't post a patch now cause I'm not working from my ordinary workstation right now but I've managed to re-code your module somewhat to make it respect the published/unpublished setting.

I'll describe what I've done first;

* added field in the database table {header_image} called status int(11) default 1
* change headerimage.module line #320

// add status check: AND status = 1
$result = db_query("SELECT nid, conditions FROM {headerimage} WHERE block = %d AND status = 1 ORDER BY weight, nid ASC", $block);

* change headerimage.module line #689-690
// also insert node status when adding node to {header_image} table
db_query("INSERT INTO {headerimage} (nid, status, block, weight, conditions)
                 VALUES (%d, %d, %d, %d, '%s')", $node->nid, $node->status, $node->headerimage_block, $node->headerimage_weight, serialize($conditions));

Now when I enable the scheduler module for the header image content type I can schedule each header image to publish or unpublish at a certain time (tested and working as far as I can see).

These alterations in combination with scheduler module make it possible to set up seasonal header images long before the season has started and have them automatically published. Can come in handy when ur in bed hungover on new years day when actually you need to change the header image of your website to wish everyone a happy new year :)

If you see no problems with my alterations I can provide you a patch Eric?!

Cheers and have a good weekend!
Bartezz

#2

Bartezz - December 12, 2008 - 21:49

Oops, did find one quirck!

When scheduler unpublishes the node it also resets the block name, weight (?) and taxonomy condition that were set for the node. Will have to look into this!

Cheers

#3

Bartezz - December 14, 2008 - 23:04

After a weekend of debugging and help from Eric of scheduler I managed to find out what was wrong. Headerimage.module was missing a case: load form the hook_nodeapi and therefor not supplying othermodules with nessecary variables.

I will provide a patch for headerimage.module so that this module works for scheduler as soon as possible! So we can all schedule header images for the upcoming holidays :)

Cheers,
Bartezz

#4

Bartezz - December 15, 2008 - 20:18
Status:active» fixed

See http://drupal.org/node/347397

#5

System Message - December 29, 2008 - 20:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.