diff --git a/remember_me.module b/remember_me.module index 579185c..fdfcb1b 100644 --- a/remember_me.module +++ b/remember_me.module @@ -68,26 +68,11 @@ function remember_me_form_alter(&$form, $form_state, $form_id) { '#title' => t('Remember me'), '#type' => variable_get('remember_me_checkbox_visible', 1) ? 'checkbox' : 'hidden', '#default_value' => variable_get('remember_me_checkbox', 1), - '#attributes' => array('tabindex' => 1), ); - $que = array(); - // Now lets try and insert it right after the password field in the document - // and set the tabindex to 1 for each field so that we can jump in sequence. - while (list($key, $val) = each($form)) { - switch ($key) { - case 'name': - case 'pass' : - $val['#attributes']['tabindex'] = 1; - break; - case 'actions': - $form = $que + $cbox + $form; - $form[$key]['submit']['#attributes']['tabindex'] = 1; - return; - } - $que[$key] = $val; - } + $offset = array_search('pass', array_keys($form)) + 1; + $form = array_slice($form, 0, $offset, TRUE) + $cbox + array_slice($form, $offset, NULL, TRUE); } }