Make WordPress Core

Ticket #51899: user-edit.php.diff

File user-edit.php.diff, 6.2 KB (added by butterflymedia, 5 years ago)
  • wp-admin/user-edit.php

     
    732732        </table>
    733733
    734734
    735                 <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
    736         <div class="application-passwords hide-if-no-js" id="application-passwords-section">
    737                 <h2><?php _e( 'Application Passwords' ); ?></h2>
    738                 <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p>
    739                         <?php
    740                         if ( is_multisite() ) {
    741                                 $blogs       = get_blogs_of_user( $user_id, true );
    742                                 $blogs_count = count( $blogs );
    743                                 if ( $blogs_count > 1 ) {
    744                                         ?>
    745                                         <p>
    746                                                 <?php
    747                                                 printf(
    748                                                         /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */
    749                                                         _n(
    750                                                                 'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.',
    751                                                                 'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.',
    752                                                                 $blogs_count
    753                                                         ),
    754                                                         admin_url( 'my-sites.php' ),
    755                                                         number_format_i18n( $blogs_count )
    756                                                 );
    757                                                 ?>
    758                                         </p>
     735<?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
     736        <h2><?php _e( 'Application Passwords' ); ?></h2>
     737
     738        <table class="form-table" role="presentation">
     739                <tr>
     740                        <th><?php _e( 'Application Passwords' ); ?></th>
     741                        <td>
     742                                <div class="application-passwords hide-if-no-js" id="application-passwords-section">
     743                                        <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p>
    759744                                        <?php
    760                                 }
    761                         }
     745                                        if ( is_multisite() ) {
     746                                                $blogs       = get_blogs_of_user( $user_id, true );
     747                                                $blogs_count = count( $blogs );
     748                                                if ( $blogs_count > 1 ) {
     749                                                        ?>
     750                                                        <p>
     751                                                                <?php
     752                                                                printf(
     753                                                                        /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */
     754                                                                        _n(
     755                                                                                'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.',
     756                                                                                'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.',
     757                                                                                $blogs_count
     758                                                                        ),
     759                                                                        admin_url( 'my-sites.php' ),
     760                                                                        number_format_i18n( $blogs_count )
     761                                                                );
     762                                                                ?>
     763                                                        </p>
     764                                                        <?php
     765                                                }
     766                                        }
    762767
    763                         if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) {
    764                                 ?>
    765                         <div class="create-application-password form-wrap">
    766                                 <div class="form-field">
    767                                         <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
    768                                         <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
    769                                         <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
    770                                 </div>
     768                                        if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) {
     769                                                ?>
     770                                                <div class="create-application-password form-wrap">
     771                                                        <div class="form-field">
     772                                                                <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
     773                                                                <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
     774                                                                <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
     775                                                        </div>
    771776
    772                                 <?php
    773                                 /**
    774                                 * Fires in the create Application Passwords form.
    775                                 *
    776                                 * @since 5.6.0
    777                                 *
    778                                 * @param WP_User $profileuser The current WP_User object.
    779                                 */
    780                                 do_action( 'wp_create_application_password_form', $profileuser );
    781                                 ?>
     777                                                        <?php
     778                                                        /**
     779                                                        * Fires in the create Application Passwords form.
     780                                                        *
     781                                                        * @since 5.6.0
     782                                                        *
     783                                                        * @param WP_User $profileuser The current WP_User object.
     784                                                        */
     785                                                        do_action( 'wp_create_application_password_form', $profileuser );
     786                                                        ?>
    782787
    783                                 <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
    784                         </div>
    785                 <?php } else { ?>
    786                         <div class="notice notice-error inline">
    787                                 <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
    788                         </div>
    789                 <?php } ?>
     788                                                        <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
     789                                                </div>
     790                                        <?php } else { ?>
     791                                                <div class="notice notice-error inline">
     792                                                        <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
     793                                                </div>
     794                                        <?php } ?>
    790795
    791                 <div class="application-passwords-list-table-wrapper">
    792                         <?php
    793                         $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
    794                         $application_passwords_list_table->prepare_items();
    795                         $application_passwords_list_table->display();
    796                         ?>
    797                 </div>
    798         </div>
     796                                        <div class="application-passwords-list-table-wrapper">
     797                                                <?php
     798                                                $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
     799                                                $application_passwords_list_table->prepare_items();
     800                                                $application_passwords_list_table->display();
     801                                                ?>
     802                                        </div>
     803                                </div>
     804                        </td>
     805                </tr>
     806        </table>
    799807<?php endif; ?>
    800808
    801809                <?php