I am trying to update a bunch of content_profile profile nodes in an update_N hook. Signup is installed on my site for my event nodes not enabled on the profile nodes.
However when I run the update, it errors with "Call to undefined function _signup_node_completed()" in node_form.inc on line 74. It seems weird that this function is being called as the node I am saving is not related to signup whatsoever.
Here is the block of code causing issue, at the end of the signup_save_node function called by signup_nodeapi:
$node = node_load($node->nid);
if ( _signup_node_completed($node) && !empty($node->signup_status)) {
// If this is an time-based node, and it's already past the close in
// advance time (e.g. someone just changed the node start time), and
// signups are still open, close them now.
signup_close_signup($node->nid);
drupal_set_message(t('%node_type start time is already past the signup close-in-advance time, signups now closed.', array('%node_type' => node_get_types('name', $node->type))));
}
Looks like the operands are on the wrong sides of the && operator, the !empty($node->signup_status)
should be checked before _signup_node_completed($node)
but I am wondering whether logic should actually be placed in hook_nodeapi to ensure this function only gets run on signup-enabled nodes.
Comment | File | Size | Author |
---|---|---|---|
#8 | 824232-8-signup-undefined-function-_signup_node_completed.patch | 680 bytes | BarisW |
#1 | signup-824232.patch | 788 bytes | tnightingale |
Comments
Comment #1
tnightingale CreditAttribution: tnightingale commentedHere is a patch which replaces the operands for the time being. Rolled against 2.x-dev
Comment #2
tnightingale CreditAttribution: tnightingale commentedChanging status
Comment #3
joachim CreditAttribution: joachim commentedI don't have the code in front of me now, but I am all in favour of moving a check that we're actually looking at a signup node up to hook_nodeapi() itself, if you want to add that to the patch :)
Comment #4
ArtusamakApparently it has been fixed in 1.0
Comment #5
Magnus CreditAttribution: Magnus commentedBut the issue and the patch is against 6.x-2.x-dev...
Comment #6
ArtusamakIn any case the patch is working (for 1.x and 2.x).
Comment #7
robbieferrero CreditAttribution: robbieferrero commentedI was having the same issue when using an update script where I was calling node_save to create a new node. My workaround was to include the following code at the top of my script:
module_load_include('inc', 'signup', 'includes/scheduler');
The issue also fixed a co-workers update script that caused the same error to be displayed.
I hope this helps.
Comment #8
BarisW CreditAttribution: BarisW commentedThis bug still applies to the D7 version and the attached patch, based on #1, fixes this issue.
Comment #9
protitude CreditAttribution: protitude commentedConfirmed this bug still exists in 7.x-1.x-dev and the patch in #8 fixes the issue.