Make WordPress Core


Ignore:
Timestamp:
10/21/2015 03:37:23 PM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Add documentation in the form of a hash notation for default arguments accepted by wp_login_form().

Props ramiy for the initial patch.
Fixes #34364.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r35301 r35328  
    373373
    374374/**
    375  * Provides a simple login form for use anywhere within WordPress. By default, it echoes
    376  * the HTML immediately. Pass array('echo'=>false) to return the string instead.
     375 * Provides a simple login form for use anywhere within WordPress.
     376 *
     377 * The login format HTML is echoed by default. Pass a false value for `$echo` to return it instead.
    377378 *
    378379 * @since 3.0.0
    379380 *
    380  * @param array $args Configuration options to modify the form output.
     381 * @param array $args {
     382 *     Optional. Array of options to control the form output. Default empty array.
     383 *
     384 *     @type bool   $echo           Whether to display the login form or return the form HTML code.
     385 *                                  Default true (echo).
     386 *     @type string $redirect       URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
     387 *                                  Default is to redirect back to the request URI.
     388 *     @type string $form_id        ID attribute value for the form. Default 'loginform'.
     389 *     @type string $label_username Label for the username field. Default 'Username'.
     390 *     @type string $label_password Label for the password field. Default 'Password'.
     391 *     @type string $label_remember Label for the remember field. Default 'Remember Me'.
     392 *     @type string $label_log_in   Label for the submit button. Default 'Log In'.
     393 *     @type string $id_username    ID attribute value for the username field. Default 'user_login'.
     394 *     @type string $id_password    ID attribute value for the password field. Default 'user_pass'.
     395 *     @type string $id_remember    ID attribute value for the remember field. Default 'rememberme'.
     396 *     @type string $id_submit      ID attribute value for the submit button. Default 'wp-submit'.
     397 *     @type bool   $remember       Whether to display the "rememberme" checkbox in the form.
     398 *     @type string $value_username Default value for the username field. Default empty.
     399 *     @type bool   $value_remember Whether the "Remember Me" checkbox should be checked by default.
     400 *                                  Default false (unchecked).
     401 *
     402 * }
    381403 * @return string|void String when retrieving.
    382404 */
     
    384406    $defaults = array(
    385407        'echo' => true,
    386         'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], // Default redirect is back to the current page
     408        // Default 'redirect' value takes the user back to the request URI.
     409        'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
    387410        'form_id' => 'loginform',
    388411        'label_username' => __( 'Username' ),
     
    396419        'remember' => true,
    397420        'value_username' => '',
    398         'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked
     421        // Set 'value_remember' to true to default the "Remember me" checkbox to checked.
     422        'value_remember' => false,
    399423    );
    400424
Note: See TracChangeset for help on using the changeset viewer.