Index: vocabperms.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabperms/vocabperms.module,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 vocabperms.module
--- vocabperms.module	27 Apr 2007 17:22:39 -0000	1.1.2.7
+++ vocabperms.module	14 Jun 2007 16:57:01 -0000
@@ -151,27 +151,15 @@
             }
           }
           if ($perm > VOCABPERMS_EDIT) {
-            /**
-             * when editing, replace terms with the original ones
-             * http://drupal.org/node/130362
-             *
-             * NOTE: this could be done by saving the terms in node_load
-             * and restoring them here (this works because 'vocabperms' is
-             * alphabetecally after 'taxonomy').
-             *
-             * However, I choose NOT to do that because it would copy the
-             * node taxonomy on every single node load.  The solution here
-             * DOES cause an extra query, but this happens only once when this
-             * particular node is saved.
-             */
-         
-            if ($form['nid']) {
-              $form['taxonomy'][$vid] = 
-                taxonomy_node_get_terms_by_vocabulary($form['nid'], $vid);
-            }
-            else {
-              unset($form['taxonomy'][$vid]);
-            }
+            // Convert the element to a value so any preset or existing
+            // values will be retained.
+            // Use a default value if available. Otherwise, use the first option (which
+            // would be selected by default).
+            $value = isset($elem['#default_value']) ? $elem['#default_value'] : key($elem['#options']);
+            $form['taxonomy'][$vid] = array(
+              '#type' => 'value',
+              '#value' => $value,
+            );
           }
         }
       }
