$new_data = get_userdata( $user_ID );
// Remove the nag if the password has been changed.
if ( $new_data->user_pass != $old_data->user_pass ) {
delete_user_setting( 'default_password_nag' );
update_user_option( $user_ID, 'default_password_nag', false, true );
* @global string $pagenow
function default_password_nag() {
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
echo '<div class="error default-password-nag">';
echo '<strong>' . __( 'Notice:' ) . '</strong> ';
_e( 'You’re using the auto-generated password for your account. Would you like to change it?' );
printf( '<a href="%s">' . __( 'Yes, take me to my profile page' ) . '</a> | ', get_edit_profile_url() . '#password' );
printf( '<a href="%s" id="default-password-nag-no">' . __( 'No thanks, do not remind me again' ) . '</a>', '?default_password_nag=0' );
function delete_users_add_js() {
jQuery(document).ready( function($) {
var submit = $('#submit').prop('disabled', true);
$('input[name="delete_option"]').one('change', function() {
submit.prop('disabled', false);
$('#reassign_user').focus( function() {
$('#delete_option1').prop('checked', true).trigger('change');
* Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
* See the {@see 'personal_options'} action.
* @param WP_User $user User data object.
function use_ssl_preference( $user ) {
<tr class="user-use-ssl-wrap">
<th scope="row"><?php _e( 'Use https' ); ?></th>
<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked( '1', $user->use_ssl ); ?> /> <?php _e( 'Always use https when visiting the admin' ); ?></label></td>
function admin_created_user_email( $text ) {
$roles = get_editable_roles();
$role = $roles[ $_REQUEST['role'] ];
/* translators: 1: Site title, 2: Site URL, 3: User role. */
You\'ve been invited to join \'%1$s\' at
%2$s with the role of %3$s.
If you do not want to join this site please ignore
this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
wp_specialchars_decode( translate_user_role( $role['name'] ) )
* Checks if the Authorize Application Password request is valid.
* @since 6.2.0 Allow insecure HTTP connections for the local environment.
* @since 6.3.2 Validates the success and reject URLs to prevent javascript pseudo protocol being executed.
* @param array $request {
* The array of request data. All arguments are optional and may be empty.
* @type string $app_name The suggested name of the application.
* @type string $app_id A uuid provided by the application to uniquely identify it.
* @type string $success_url The url the user will be redirected to after approving the application.
* @type string $reject_url The url the user will be redirected to after rejecting the application.
* @param WP_User $user The user authorizing the application.
* @return true|WP_Error True if the request is valid, a WP_Error object contains errors if not.
function wp_is_authorize_application_password_request_valid( $request, $user ) {
if ( isset( $request['success_url'] ) ) {
$validated_success_url = wp_is_authorize_application_redirect_url_valid( $request['success_url'] );
if ( is_wp_error( $validated_success_url ) ) {
$validated_success_url->get_error_code(),
$validated_success_url->get_error_message()
if ( isset( $request['reject_url'] ) ) {
$validated_reject_url = wp_is_authorize_application_redirect_url_valid( $request['reject_url'] );
if ( is_wp_error( $validated_reject_url ) ) {
$validated_reject_url->get_error_code(),
$validated_reject_url->get_error_message()
if ( ! empty( $request['app_id'] ) && ! wp_is_uuid( $request['app_id'] ) ) {
__( 'The app id must be a uuid.' )
* Fires before application password errors are returned.
* @param WP_Error $error The error object.
* @param array $request The array of request data.
* @param WP_User $user The user authorizing the application.
do_action( 'wp_authorize_application_password_request_errors', $error, $request, $user );
if ( $error->has_errors() ) {
* Validates the redirect URL protocol scheme. The protocol can be anything except http and javascript.
* @param string $url - The redirect URL to be validated.
* @return true|WP_Error True if the redirect URL is valid, a WP_Error object otherwise.
function wp_is_authorize_application_redirect_url_valid( $url ) {
$bad_protocols = array( 'javascript', 'data' );
// Based on https://www.rfc-editor.org/rfc/rfc2396#section-3.1
$valid_scheme_regex = '/^[a-zA-Z][a-zA-Z0-9+.-]*:/';
if ( ! preg_match( $valid_scheme_regex, $url ) ) {
'invalid_redirect_url_format',
__( 'Invalid URL format.' )
* Filters the list of invalid protocols used in applications redirect URLs.
* @param string[] $bad_protocols Array of invalid protocols.
* @param string $url The redirect URL to be validated.
$invalid_protocols = array_map( 'strtolower', apply_filters( 'wp_authorize_application_redirect_url_invalid_protocols', $bad_protocols, $url ) );
$scheme = wp_parse_url( $url, PHP_URL_SCHEME );
$host = wp_parse_url( $url, PHP_URL_HOST );
$is_local = 'local' === wp_get_environment_type();
// validates if the proper URI format is applied to the $url
if ( empty( $host ) || empty( $scheme ) || in_array( strtolower( $scheme ), $invalid_protocols, true ) ) {
'invalid_redirect_url_format',
__( 'Invalid URL format.' )
if ( 'http' === $scheme && ! $is_local ) {
'invalid_redirect_scheme',
__( 'The URL must be served over a secure connection.' )