Index: checkout.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/checkout/checkout.module,v
retrieving revision 1.11.2.1
diff -u -p -r1.11.2.1 checkout.module
--- checkout.module	10 Jul 2008 14:38:19 -0000	1.11.2.1
+++ checkout.module	11 Jul 2008 21:58:27 -0000
@@ -34,6 +34,16 @@ function checkout_help($path, $arg) {
 }
 
 /**
+ * Implementation of hook_init().
+ */
+function checkout_init() {
+  global $user;
+  if ($user->uid && user_access('check out documents')) {
+    checkout_handle_request($user->uid);
+  }
+}
+
+/**
  * Implementation of hook_menu().
  */
 function checkout_menu() {
@@ -108,19 +118,6 @@ function checkout_nodeapi(&$node, $op, $
   global $user;
 
   switch ($op) {
-    // If a node exists, 'load' is always called when viewing or editing. But
-    // when going from an edit form to a form for a non-existent node, e.g. 
-    // node/add/page or when using the clone module, only 'prepare' is called.
-    // To release the node we edited before we need handle_request for
-    // 'prepare', too.
-    case 'prepare': 
-    // For all other cases where existing nodes are shown or edited.
-    case 'load':
-      if (user_access('check out documents')) {
-        checkout_handle_request($user->uid, $op);
-      }
-      break;
-
     case 'validate':
       if (isset($node->nid) && user_access('check out documents')) {
         // Existing node. Check if we still own the lock.
@@ -180,10 +177,8 @@ function checkout_cron() {
  *
  * @param $uid
  *   The user id to (un)lock nodes for.
-  * @param $op
- *   The node operation.
  */
-function checkout_handle_request($uid, $op) {
+function checkout_handle_request($uid) {
   
   // Build referer path
   $referer_uri = parse_url(referer_uri());
@@ -207,13 +202,6 @@ function checkout_handle_request($uid, $
     checkout_release($previous_nid, $uid);
   }
 
-  // For op 'prepare' we must never lock. If we handle a form for a new,
-  // non-existing node, we cannot lock it. Otherwise, 'load' will be called, too,
-  // and locks it.
-  if ($op == 'prepare') {
-    return;
-  }
-  
   // Check whether to lock the current node.
   if ($current_nid && (!$previous_nid || $previous_nid != $current_nid)) {
     // Try to lock the node.
