The headerimage module currently uses hook_node_prepare() to add it's properties to a node. But as the documentation states for hook_node_prepare():

Act on a node object about to be shown on the add/edit form.

The correct call is hook_node_load(). That function assigns the properties at the correct time when a header image node is loaded. I've attached a patch that fixes this.

I found this bug while using an action in the "Update options" dropdown on the Administer > Content page. Running an action from that page will make a call to hook_node_update(), but the header image properties were never loaded, and therefore it throws an error.

This is an issue in the 6.x branch as well.

CommentFileSizeAuthor
hi-hook_node_load.patch2.03 KBhargobind

Comments

sense-design’s picture

Could you also provide a patch for D6, then I will review both

Stevel’s picture

Status: Active » Reviewed & tested by the community

Looks good to me.

sense-design’s picture

Thanks, will commit it to D7 DEV tonight

sense-design’s picture

sense-design’s picture

Status: Reviewed & tested by the community » Closed (fixed)
skaught’s picture

I'm my situation if found that both node_prepare and node_load functions are needed. node_load fixed a cron related issue, but removing the hook_prepare killed node/*/edit and node/add.