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.

Built from https://develop.svn.wordpress.org/trunk@55026


git-svn-id: http://core.svn.wordpress.org/trunk@54559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-01-02 22:50:15 +00:00
parent ed86f1f0c2
commit 1e82763d99
2 changed files with 15 additions and 14 deletions

View File

@ -124,19 +124,20 @@ if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) {
</div>
<?php } ?>
<form action="<?php echo esc_url( network_admin_url( 'user-new.php?action=add-user' ) ); ?>" id="adduser" method="post" novalidate="novalidate">
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="username"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="email"><?php _e( 'Email' ); ?></label></th>
<td><input type="email" class="regular-text" name="user[email]" id="email" /></td>
</tr>
<tr class="form-field">
<td colspan="2" class="td-full"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td>
</tr>
</table>
<p><?php echo wp_required_field_message(); ?></p>
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="username"><?php _e( 'Username' ); ?> <?php echo wp_required_field_indicator(); ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" required="required" /></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="email"><?php _e( 'Email' ); ?> <?php echo wp_required_field_indicator(); ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" required="required" /></td>
</tr>
<tr class="form-field">
<td colspan="2" class="td-full"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td>
</tr>
</table>
<?php
/**
* Fires at the end of the new user form in network admin.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55025';
$wp_version = '6.2-alpha-55026';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.