Index: pathauto.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v retrieving revision 1.111 diff -u -p -r1.111 pathauto.module --- pathauto.module 28 May 2008 16:04:35 -0000 1.111 +++ pathauto.module 1 Jun 2008 10:19:27 -0000 @@ -262,6 +262,8 @@ function pathauto_nodeapi(&$node, $op, $ function pathauto_form_alter(&$form, $form_state, $form_id) { // Only do this for node forms if (isset($form['#id']) && ($form['#id'] == 'node-form') && arg(0) == 'node') { + $node = $form['#node']; + // See if there is a pathauto pattern or default applicable if (isset($form['language'])) { $language = isset($form['language']['#value']) ? $form['language']['#value'] : $form['language']['#default_value']; @@ -286,14 +288,19 @@ function pathauto_form_alter(&$form, $fo $form['path']['pathauto_perform_alias'] = array( '#type' => 'checkbox', '#title' => t('Automatic alias'), - '#default_value' => TRUE, + '#default_value' => isset($node->pathauto_perform_alias) ? $node->pathauto_perform_alias : TRUE, '#description' => $output, '#weight' => 0 - ); + ); + + if (isset($node->pathauto_perform_alias) && isset($node->old_alias) + && $node->pathauto_perform_alias && $node->path == '' && $node->old_alias != '') { + $form['path']['path']['#default_value'] = $node->old_alias; + $node->path = $node->old_alias; + } //For Pathauto to remember the old alias and prevent the Path-module from deleteing it when Pathauto wants to preserve it - $old_alias = $form['path']['path']['#default_value']; - $form['path']['old_alias'] = array('#type' => 'value', '#value' => $old_alias); + $form['path']['old_alias'] = array('#type' => 'value', '#value' => $node->path); } } }