Hope this is not getting too boring... I would dearly like confirmation that I am right or wrong about this.
In my "checkout" module, I use the hook_nodeapi function on update of a node to decide whether or not to keep the node checked out. In 4.6, it was very easy to determine whether or not the node was checked out. In $op = 'form pre' I simply added a checkbox called 'checkout' to the node form, then in $op = 'update' the value of the checkbox was automatically included in the $node object, as you can see in this snippet:
case 'update':
if ($node->checkout != '1') {
checkout_checkin($node->nid);
}
else {
db_query("UPDATE {checkout} SET checkedout=1 WHERE nid = '%d'", $node->nid);
drupal_set_message(t('Remember that you have this document checked out in your name'));
}
break;
In 4.7 this no longer works and I find myself forced to call the $edit field, thuswise:
case 'update':
$edit = $_POST['edit'];
if ($edit['checkout'] != '1') {
checkout_checkin($node->nid);
}
else {
db_query("UPDATE {checkout} SET checkedout=1 WHERE nid = '%d'", $node->nid);
drupal_set_message(t('Remember that you have this document checked out in your name'));
}
break;
Is this the right way to do it or am I missing something?