| 200 | * Provides a simple login form, based on the wp-login.php form HTML. If the |
| 201 | * current user is already logged in, returns nothing. |
| 202 | * |
| 203 | * @since x.x |
| 204 | * @param string $redirect URL to redirect the user to on a successful login |
| 205 | * @param bool $remember Include the "Remember Me" checkbox? |
| 206 | * @return void |
| 207 | */ |
| 208 | function wp_login_form( $redirect = false, $remember = false ) { |
| 209 | if ( is_user_logged_in() ) |
| 210 | return ''; |
| 211 | |
| 212 | if ( !$redirect ) |
| 213 | $redirect = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Default redirect is back to the current page |
| 214 | |
| 215 | $form = ' |
| 216 | <form name="loginform" id="loginform" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post"> |
| 217 | <p> |
| 218 | <label for="user_login">' . apply_filters( 'login_form_username', __( 'Username' ) ) . '</label> |
| 219 | <input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10" /> |
| 220 | </p> |
| 221 | <p> |
| 222 | <label for="user_pass">' . apply_filters( 'login_form_password', __( 'Password' ) ) . '</label> |
| 223 | <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /> |
| 224 | </p> |
| 225 | ' . ( $remember ? '<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> ' . apply_filters( 'login_form_remember_me', __( 'Remember Me' ) ) . '</label></p>' : '' ) . ' |
| 226 | <p class="submit"> |
| 227 | <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="' . apply_filters( 'login_form_log_in', __( 'Log In' ) ) . '" tabindex="100" /> |
| 228 | <input type="hidden" name="redirect_to" value="' . esc_attr( $redirect ) . '" /> |
| 229 | </p> |
| 230 | </form>'; |
| 231 | return $form; |
| 232 | } |
| 233 | |
| 234 | /** |