Make WordPress Core

Changeset 55026


Ignore:
Timestamp:
01/02/2023 10:48:55 PM (4 years ago)
Author:
audrasjb
Message:

Networks and Sites: Mark required fields as such in New User Form.

This changeset adds required="required" attributes to required form fields and uses wp_required_field_message() and wp_required_field_indicator() functions to improve the generated markup, and for better consistency with other required fields.

Props jackreichert, flixos90, afercia, sabernhardt.
Fixes #38460.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/user-new.php

    r51475 r55026  
    125125<?php } ?>
    126126        <form action="<?php echo esc_url( network_admin_url( 'user-new.php?action=add-user' ) ); ?>" id="adduser" method="post" novalidate="novalidate">
    127         <table class="form-table" role="presentation">
    128                 <tr class="form-field form-required">
    129                         <th scope="row"><label for="username"><?php _e( 'Username' ); ?></label></th>
    130                         <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td>
    131                 </tr>
    132                 <tr class="form-field form-required">
    133                         <th scope="row"><label for="email"><?php _e( 'Email' ); ?></label></th>
    134                         <td><input type="email" class="regular-text" name="user[email]" id="email" /></td>
    135                 </tr>
    136                 <tr class="form-field">
    137                         <td colspan="2" class="td-full"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td>
    138                 </tr>
    139         </table>
     127                <p><?php echo wp_required_field_message(); ?></p>
     128                <table class="form-table" role="presentation">
     129                        <tr class="form-field form-required">
     130                                <th scope="row"><label for="username"><?php _e( 'Username' ); ?> <?php echo wp_required_field_indicator(); ?></label></th>
     131                                <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" required="required" /></td>
     132                        </tr>
     133                        <tr class="form-field form-required">
     134                                <th scope="row"><label for="email"><?php _e( 'Email' ); ?> <?php echo wp_required_field_indicator(); ?></label></th>
     135                                <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" required="required" /></td>
     136                        </tr>
     137                        <tr class="form-field">
     138                                <td colspan="2" class="td-full"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td>
     139                        </tr>
     140                </table>
    140141        <?php
    141142        /**
Note: See TracChangeset for help on using the changeset viewer.