: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
update_user_meta( $user_ID, 'default_password_nag', false );
* @param WP_User $old_data
function default_password_nag_edit_user( $user_ID, $old_data ) {
if ( ! get_user_option( 'default_password_nag', $user_ID ) ) {
$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_meta( $user_ID, 'default_password_nag', false );
* @global string $pagenow The filename of the current screen.
function default_password_nag() {
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
$default_password_nag_message = sprintf(
'<p><strong>%1$s</strong> %2$s</p>',
__( 'You are using the auto-generated password for your account. Would you like to change it?' )
$default_password_nag_message .= sprintf(
'<p><a href="%1$s">%2$s</a> | ',
esc_url( get_edit_profile_url() . '#password' ),
__( 'Yes, take me to my profile page' )
$default_password_nag_message .= sprintf(
'<a href="%1$s" id="default-password-nag-no">%2$s</a></p>',
'?default_password_nag=0',
__( 'No thanks, do not remind me again' )
$default_password_nag_message,
'additional_classes' => array( 'error', 'default-password-nag' ),
'paragraph_wrap' => false,
function delete_users_add_js() {
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'] ];
if ( '' !== get_bloginfo( 'name' ) ) {
$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
$site_title = parse_url( home_url(), PHP_URL_HOST );
/* 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( 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 from 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 application 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 = apply_filters( 'wp_authorize_application_redirect_url_invalid_protocols', $bad_protocols, $url );
$invalid_protocols = array_map( 'strtolower', $invalid_protocols );
$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.' )