--- prepopulate.module.orig     2009-10-27 08:48:41.000000000 -0500
+++ prepopulate.module  2009-10-27 09:45:32.000000000 -0500
@@ -26,6 +26,23 @@ function prepopulate_help($path, $arg) {
  */
 function prepopulate_form_alter(&$form, $form_state, $form_id) {
   if (isset($_GET['edit'])) {
+    /**
+     * wikitools integration - check if unique titles are turned on, 
+     * and redirect to the appropriate node if a duplicate is detected
+     */
+    // check if unique titles are on
+    $wikiConf = variable_get('wikitools_options', array());
+    if ($wikiConf['unique titles'] == 'unique titles') {
+      // get wikitools content types
+      $wikiTypes = variable_get('wikitools_node_types', array());
+      $contentType = $form['type']['#value'];
+      // if this is a wikitools enabled content type, check for title uniqueness
+      if (array_search($contentType, $wikiTypes) == $contentType) {
+        if (isset($_GET['edit']['title']) && ($testNode = node_load(array('title' => $_GET['edit']['title'])))) {
+          drupal_goto('node/' . $testNode->nid);
+        }
+      }
+    } // end wikitools integration
     foreach (array_keys((array)$_GET['edit']) as $getvar) {
       if (element_child($getvar) && !is_null($form[$getvar])) {
         _prepopulate_get_walk($form[$getvar], $_GET['edit'][$getvar]);

