| 711 | | <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?> |
| 712 | | <tr class="application-passwords hide-if-no-js" id="application-passwords-section"> |
| 713 | | <th><?php _e( 'Application Passwords' ); ?></th> |
| 714 | | <td> |
| 715 | | <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> |
| 716 | | <?php |
| 717 | | if ( is_multisite() ) { |
| 718 | | $blogs = get_blogs_of_user( $user_id, true ); |
| 719 | | $blogs_count = count( $blogs ); |
| 720 | | if ( $blogs_count > 1 ) { |
| 721 | | ?> |
| 722 | | <p> |
| 723 | | <?php |
| 724 | | printf( |
| 725 | | /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */ |
| 726 | | _n( |
| 727 | | 'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.', |
| 728 | | 'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.', |
| 729 | | $blogs_count |
| 730 | | ), |
| 731 | | admin_url( 'my-sites.php' ), |
| 732 | | number_format_i18n( $blogs_count ) |
| 733 | | ); |
| 734 | | ?> |
| 735 | | </p> |
| 736 | | <?php |
| 737 | | } |
| 738 | | } |
| | 711 | </table> |
| 749 | | <?php |
| 750 | | /** |
| 751 | | * Fires in the create Application Passwords form. |
| 752 | | * |
| 753 | | * @since 5.6.0 |
| 754 | | * |
| 755 | | * @param WP_User $profileuser The current WP_User object. |
| 756 | | */ |
| 757 | | do_action( 'wp_create_application_password_form', $profileuser ); |
| 758 | | ?> |
| | 714 | <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?> |
| | 715 | <div class="application-passwords hide-if-no-js" id="application-passwords-section"> |
| | 716 | <h2><?php _e( 'Application Passwords' ); ?></h2> |
| | 717 | <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> |
| | 718 | <?php |
| | 719 | if ( is_multisite() ) { |
| | 720 | $blogs = get_blogs_of_user( $user_id, true ); |
| | 721 | $blogs_count = count( $blogs ); |
| | 722 | if ( $blogs_count > 1 ) { |
| | 723 | ?> |
| | 724 | <p> |
| | 725 | <?php |
| | 726 | printf( |
| | 727 | /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */ |
| | 728 | _n( |
| | 729 | 'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.', |
| | 730 | 'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.', |
| | 731 | $blogs_count |
| | 732 | ), |
| | 733 | admin_url( 'my-sites.php' ), |
| | 734 | number_format_i18n( $blogs_count ) |
| | 735 | ); |
| | 736 | ?> |
| | 737 | </p> |
| | 738 | <?php |
| | 739 | } |
| | 740 | } |
| 760 | | <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?> |
| 761 | | </div> |
| 762 | | <?php } else { ?> |
| 763 | | <div class="notice notice-error inline"> |
| 764 | | <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p> |
| 765 | | </div> |
| 766 | | <?php } ?> |
| | 742 | if ( empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['PHP_AUTH_PW'] ) ) { |
| | 743 | ?> |
| | 744 | <div class="create-application-password form-wrap"> |
| | 745 | <div class="form-field"> |
| | 746 | <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label> |
| | 747 | <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" /> |
| | 748 | <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p> |
| | 749 | </div> |
| 768 | | <div class="application-passwords-list-table-wrapper"> |
| 769 | | <?php |
| 770 | | $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) ); |
| 771 | | $application_passwords_list_table->prepare_items(); |
| 772 | | $application_passwords_list_table->display(); |
| 773 | | ?> |
| 774 | | </div> |
| 775 | | </td> |
| 776 | | </tr> |
| | 751 | <?php |
| | 752 | /** |
| | 753 | * Fires in the create Application Passwords form. |
| | 754 | * |
| | 755 | * @since 5.6.0 |
| | 756 | * |
| | 757 | * @param WP_User $profileuser The current WP_User object. |
| | 758 | */ |
| | 759 | do_action( 'wp_create_application_password_form', $profileuser ); |
| | 760 | ?> |
| | 761 | |
| | 762 | <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?> |
| | 763 | </div> |
| | 764 | <?php } else { ?> |
| | 765 | <div class="notice notice-error inline"> |
| | 766 | <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p> |
| | 767 | </div> |
| | 768 | <?php } ?> |
| | 769 | |
| | 770 | <div class="application-passwords-list-table-wrapper"> |
| | 771 | <?php |
| | 772 | $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) ); |
| | 773 | $application_passwords_list_table->prepare_items(); |
| | 774 | $application_passwords_list_table->display(); |
| | 775 | ?> |
| | 776 | </div> |
| | 777 | </div> |