? 489180_persistent_login_register.patch ? LICENSE.txt Index: persistent_login.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/persistent_login/Attic/persistent_login.module,v retrieving revision 1.23.2.16 diff -u -p -r1.23.2.16 persistent_login.module --- persistent_login.module 9 May 2009 19:22:27 -0000 1.23.2.16 +++ persistent_login.module 11 Jun 2009 23:57:36 -0000 @@ -106,7 +106,7 @@ function persistent_login_erase_access($ */ 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') { + if (substr($form_id, 0, 10) != 'user_login' && (substr($form_id, 0, 13) != 'user_register' || variable_get('user_email_verification', 1))) { return; } @@ -135,10 +135,18 @@ function persistent_login_form_alter(&$f } // Let's add the "Remember me" checkbox to the login form. - $form['persistent_login'] = array( - '#type' => 'checkbox', - '#title' => t('Remember me'), - ); + 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. @@ -163,13 +171,18 @@ function persistent_login_form_after_bui function persistent_login_user($op, &$edit, &$account, $category = NULL) { global $user; switch ($op) { + case 'insert': + // Only create the persistent cookie if it's a user registering, not an admin creating the account. + if ($user->uid != 0) { + return; + } case 'login': // If we are coming from a login form, $edit['persistent_login'] // is set if the user checked it. If we are coming from // persistent_login_check(), $edit['persistent_login'] is also // set along with pl_series and pl_expiration. Either way, issue a // new PL cookie, preserving series and expiration if present. - if (!empty($edit['persistent_login'])) { + if (!empty($edit['persistent_login']) || !empty($edit['account']['persistent_login'])) { _persistent_login_create_cookie($account, $edit); } // Assume this is a non-PL login; clear persistent_login_login. 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 11 Jun 2009 23:57:36 -0000 @@ -115,7 +115,12 @@ function persistent_login_form_after_bui // Give the "Remember me" checkbox the weight originally assigned // to the submit button. - $form['persistent_login']['#weight'] = $original_submit_weight; + if (isset($form['account']['persistent_login'])) { + $form['account']['persistent_login']['#weight'] = $original_submit_weight; + } + else { + $form['persistent_login']['#weight'] = $original_submit_weight; + } // Ensure drupal_render() performs the sort by weight step on the form. unset($form['#sorted']); @@ -123,7 +128,13 @@ function persistent_login_form_after_bui // 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; + if (isset($form['account']['persistent_login'])) { + $form['account']['persistent_login']['#attributes']['tabindex'] = $tabindex; + } + else { + $form['persistent_login']['#attributes']['tabindex'] = $tabindex; + } + $form['submit']['#attributes']['tabindex'] = $tabindex + 1; }