Index: persistent_login.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/persistent_login/Attic/persistent_login.module,v
retrieving revision 1.23.2.18
diff -u -p -r1.23.2.18 persistent_login.module
--- persistent_login.module	18 Aug 2009 23:30:24 -0000	1.23.2.18
+++ persistent_login.module	23 Aug 2009 18:42:40 -0000
@@ -105,8 +105,21 @@ function persistent_login_erase_access($
  * Implementation of hook_form_alter().
  */
 function persistent_login_form_alter(&$form, $form_state, $form_id) {
-  // If this is not a user login form, then we have nothing else todo.
-  if (substr($form_id, 0, 10) != 'user_login') {
+  $alter_form = FALSE;
+  if (substr($form_id, 0, 10) == 'user_login') {
+    // This is a login form that we want to alter.
+    $alter_form = TRUE;
+  }
+  elseif (substr($form_id, 0, 13) == 'user_register') {
+    // This is a user register form, but we only want to alter this if
+    // - Visitors can create accounts and no administrator approval is required.
+    // - E-mail verification is not required when a visitor creates an account.
+    // - The form is not being executed by a user administrator.
+    if (!variable_get('user_email_verification', 1) && variable_get('user_register', 1) == 1 && !user_access('administer users')) {
+      $alter_form = TRUE;
+    }
+  }
+  if (!$alter_form) {
     return;
   }
 
@@ -134,11 +147,19 @@ function persistent_login_form_alter(&$f
     return;
   }
 
-  // Let's add the "Remember me" checkbox to the login form.
-  $form['persistent_login'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Remember me'),
-  );
+  // Let's add the "Remember me" checkbox to the login/user register form.
+  if (isset($form['account']) && is_array($form['account'])) {
+    $form['account']['persistent_login'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Remember me'),
+    );
+  }
+  else {
+    $form['persistent_login'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Remember me'),
+    );
+  }
 
   // Add an after_build callback that we'll use to adjust the weight
   // and tabindex attributes of the "Remember me" checkbox.
Index: persistent_login.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/persistent_login/Attic/persistent_login.pages.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 persistent_login.pages.inc
--- persistent_login.pages.inc	1 May 2009 08:40:26 -0000	1.1.2.6
+++ persistent_login.pages.inc	23 Aug 2009 18:53:17 -0000
@@ -88,42 +88,49 @@ function persistent_login_erase($uid = N
  * After_build callback for login forms.
  */
 function persistent_login_form_after_build($form, &$form_state) {
+  // Get a reference to the portion of the form we are interested in.
+  if (isset($form['account']) && is_array($form['account'])) {
+    $form_reference = &$form['account'];
+  }
+  else {
+    $form_reference = &$form;
+  }
+
   // If we don't have a submit button, then it's a sign someone else altered
   // the login form in a way that cannot be submitted, so we remove the
   // "Remember me" checkbox we added in hook_form_alter() and quit.
   if (!isset($form['submit'])) {
-    unset($form['persistent_login']);
+    unset($form_reference['persistent_login']);
     return $form;
   }
 
   // FAPI ensures a weight is assigned to all elements before after_build
   // callback is invoked.
 
-  // Get the weight assigned to the submit button.
-  $original_submit_weight = $form['submit']['#weight'];
+  // Get the weight assigned to the password field.
+  $original_pass_weight = $form_reference['pass']['#weight'];
 
-  // Increase the weight of all elements with a weight equal or
-  // greater to the weight assigned to the submit button to make
-  // room for the "Remember me" checkbox.
-  foreach (element_children($form) as $key) {
-    if (isset($form[$key]) && $form[$key]) {
-      if ($form[$key]['#weight'] >= $original_submit_weight) {
-        $form[$key]['#weight'] += 1;
+  // Increase the weight of all elements with a weight greater to the one assigned
+  // to the password field to make room for the "Remember me" checkbox.
+  foreach (element_children($form_reference) as $key) {
+    if (isset($form_reference[$key]) && $form_reference[$key]) {
+      if ($form_reference[$key]['#weight'] > $original_pass_weight) {
+        $form_reference[$key]['#weight'] += 1;
       }
     }
   }
 
-  // Give the "Remember me" checkbox the weight originally assigned
-  // to the submit button.
-  $form['persistent_login']['#weight'] = $original_submit_weight;
+  // Give the "Remember me" checkbox a weight based on the one assigned
+  // to the password field so it renders just after that.
+  $form_reference['persistent_login']['#weight'] = $original_pass_weight + 0.5;
 
   // Ensure drupal_render() performs the sort by weight step on the form.
-  unset($form['#sorted']);
+  unset($form_reference['#sorted']);
 
   // Adjust the tabindex of the plain login form.
   if (isset($form['submit']['#attributes']) && isset($form['submit']['#attributes']['tabindex'])) {
     $tabindex = (int)$form['submit']['#attributes']['tabindex'];
-    $form['persistent_login']['#attributes']['tabindex'] = $tabindex;
+    $form_reference['persistent_login']['#attributes']['tabindex'] = $tabindex;
     $form['submit']['#attributes']['tabindex'] = $tabindex + 1;
   }
 
