Changeset 58382
- Timestamp:
- 06/11/2024 06:22:37 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r58213 r58382 492 492 * 493 493 * @since 3.0.0 494 * @since 6.6.0 Added `required_username` and `required_password` arguments. 494 495 * 495 496 * @param array $args { 496 497 * Optional. Array of options to control the form output. Default empty array. 497 498 * 498 * @type bool $echo Whether to display the login form or return the form HTML code. 499 * Default true (echo). 500 * @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/". 501 * Default is to redirect back to the request URI. 502 * @type string $form_id ID attribute value for the form. Default 'loginform'. 503 * @type string $label_username Label for the username or email address field. Default 'Username or Email Address'. 504 * @type string $label_password Label for the password field. Default 'Password'. 505 * @type string $label_remember Label for the remember field. Default 'Remember Me'. 506 * @type string $label_log_in Label for the submit button. Default 'Log In'. 507 * @type string $id_username ID attribute value for the username field. Default 'user_login'. 508 * @type string $id_password ID attribute value for the password field. Default 'user_pass'. 509 * @type string $id_remember ID attribute value for the remember field. Default 'rememberme'. 510 * @type string $id_submit ID attribute value for the submit button. Default 'wp-submit'. 511 * @type bool $remember Whether to display the "rememberme" checkbox in the form. 512 * @type string $value_username Default value for the username field. Default empty. 513 * @type bool $value_remember Whether the "Remember Me" checkbox should be checked by default. 514 * Default false (unchecked). 499 * @type bool $echo Whether to display the login form or return the form HTML code. 500 * Default true (echo). 501 * @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/". 502 * Default is to redirect back to the request URI. 503 * @type string $form_id ID attribute value for the form. Default 'loginform'. 504 * @type string $label_username Label for the username or email address field. Default 'Username or Email Address'. 505 * @type string $label_password Label for the password field. Default 'Password'. 506 * @type string $label_remember Label for the remember field. Default 'Remember Me'. 507 * @type string $label_log_in Label for the submit button. Default 'Log In'. 508 * @type string $id_username ID attribute value for the username field. Default 'user_login'. 509 * @type string $id_password ID attribute value for the password field. Default 'user_pass'. 510 * @type string $id_remember ID attribute value for the remember field. Default 'rememberme'. 511 * @type string $id_submit ID attribute value for the submit button. Default 'wp-submit'. 512 * @type bool $remember Whether to display the "rememberme" checkbox in the form. 513 * @type string $value_username Default value for the username field. Default empty. 514 * @type bool $value_remember Whether the "Remember Me" checkbox should be checked by default. 515 * Default false (unchecked). 516 * @type bool $required_username Whether the username field has the 'required' attribute. 517 * Default false. 518 * @type bool $required_password Whether the password field has the 'required' attribute. 519 * Default false. 515 520 * 516 521 * } … … 519 524 function wp_login_form( $args = array() ) { 520 525 $defaults = array( 521 'echo' => true,526 'echo' => true, 522 527 // Default 'redirect' value takes the user back to the request URI. 523 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],524 'form_id' => 'loginform',525 'label_username' => __( 'Username or Email Address' ),526 'label_password' => __( 'Password' ),527 'label_remember' => __( 'Remember Me' ),528 'label_log_in' => __( 'Log In' ),529 'id_username' => 'user_login',530 'id_password' => 'user_pass',531 'id_remember' => 'rememberme',532 'id_submit' => 'wp-submit',533 'remember' => true,534 'value_username' => '',528 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 529 'form_id' => 'loginform', 530 'label_username' => __( 'Username or Email Address' ), 531 'label_password' => __( 'Password' ), 532 'label_remember' => __( 'Remember Me' ), 533 'label_log_in' => __( 'Log In' ), 534 'id_username' => 'user_login', 535 'id_password' => 'user_pass', 536 'id_remember' => 'rememberme', 537 'id_submit' => 'wp-submit', 538 'remember' => true, 539 'value_username' => '', 535 540 // Set 'value_remember' to true to default the "Remember me" checkbox to checked. 536 'value_remember' => false, 541 'value_remember' => false, 542 // Set 'required_username' to true to add the required attribute to username field. 543 'required_username' => false, 544 // Set 'required_password' to true to add the required attribute to password field. 545 'required_password' => false, 537 546 ); 538 547 … … 595 604 '<p class="login-username"> 596 605 <label for="%1$s">%2$s</label> 597 <input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20" />606 <input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20"%4$s /> 598 607 </p>', 599 608 esc_attr( $args['id_username'] ), 600 609 esc_html( $args['label_username'] ), 601 esc_attr( $args['value_username'] ) 610 esc_attr( $args['value_username'] ), 611 ( $args['required_username'] ? ' required="required"' : '' ) 602 612 ) . 603 613 sprintf( 604 614 '<p class="login-password"> 605 615 <label for="%1$s">%2$s</label> 606 <input type="password" name="pwd" id="%1$s" autocomplete="current-password" spellcheck="false" class="input" value="" size="20" />616 <input type="password" name="pwd" id="%1$s" autocomplete="current-password" spellcheck="false" class="input" value="" size="20"%3$s /> 607 617 </p>', 608 618 esc_attr( $args['id_password'] ), 609 esc_html( $args['label_password'] ) 619 esc_html( $args['label_password'] ), 620 ( $args['required_password'] ? ' required="required"' : '' ) 610 621 ) . 611 622 $login_form_middle .
Note: See TracChangeset
for help on using the changeset viewer.