Changeset 12696
- Timestamp:
- 01/11/2010 09:48:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r12687 r12696 195 195 196 196 return apply_filters('login_url', $login_url, $redirect); 197 } 198 199 /** 200 * Provides a simple login form for use anywhere within WordPress. By default, it echos 201 * the HTML immediately. Pass array('echo'=>false) to return the string instead. 202 * 203 * @since x.x 204 * @param array $args Configuration options to modify the form output 205 * @return Void, or string containing the form 206 */ 207 function wp_login_form( $args = array() ) { 208 $defaults = array( 'echo' => true, 209 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), // Default redirect is back to the current page 210 'form_id' => 'loginform', 211 'label_username' => __( 'Username' ), 212 'label_password' => __( 'Password' ), 213 'label_remember' => __( 'Remember Me' ), 214 'label_log_in' => __( 'Log In' ), 215 'id_username' => 'user_login', 216 'id_password' => 'user_pass', 217 'id_remember' => 'rememberme', 218 'id_submit' => 'wp-submit', 219 'remember' => true, 220 'value_username' => '', 221 'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked 222 ); 223 $args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) ); 224 225 $form = ' 226 <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post"> 227 ' . do_action( 'login_form_top' ) . ' 228 <p class="login-username"> 229 <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label> 230 <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" tabindex="10" /> 231 </p> 232 <p class="login-password"> 233 <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label> 234 <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" tabindex="20" /> 235 </p> 236 ' . do_action( 'login_form_middle' ) . ' 237 ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever" tabindex="90"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . ' 238 <p class="login-submit"> 239 <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" tabindex="100" /> 240 <input type="hidden" name="redirect_to" value="' . esc_attr( $args['redirect'] ) . '" /> 241 </p> 242 ' . do_action( 'login_form_bottom' ) . ' 243 </form>'; 244 245 if ( $args['echo'] ) 246 echo $form; 247 else 248 return $form; 197 249 } 198 250
Note: See TracChangeset
for help on using the changeset viewer.