wp_is_password_reset_allowed_for_user example

<?php _e( 'Confirm Password' ); ?></th> <td> <label> <input type="checkbox" name="pw_weak" class="pw-checkbox" /> <span id="pw-weak-text-label"><?php _e( 'Confirm use of weak password' ); ?></span> </label> </td> </tr> <?php endif; // End Show Password Fields. ?> <?php // Allow admins to send reset password link. ?> <?php if ( ! IS_PROFILE_PAGE && true === wp_is_password_reset_allowed_for_user( $profile_user ) ) : ?> <tr class="user-generate-reset-link-wrap hide-if-no-js"> <th><?php _e( 'Password Reset' ); ?></th> <td> <div class="generate-reset-link"> <button type="button" class="button button-secondary" id="generate-reset-link"> <?php _e( 'Send Reset Link' ); ?> </button> </div> <p class="description"> <?php                                             printf(
                                                
do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' );

    /** * Fires before a new password is retrieved. * * @since 1.5.1 * * @param string $user_login The user login name. */
    do_action( 'retrieve_password', $user->user_login );

    $password_reset_allowed = wp_is_password_reset_allowed_for_user( $user );
    if ( ! $password_reset_allowed ) {
        return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) );
    } elseif ( is_wp_error( $password_reset_allowed ) ) {
        return $password_reset_allowed;
    }

    // Generate something random for a password reset key.     $key = wp_generate_password( 20, false );

    /** * Fires when a password reset key is generated. * * @since 2.5.0 * * @param string $user_login The username for the user. * @param string $key The generated password reset key. */
'<a href="%s" aria-label="%s">%s</a>',
                    esc_url( $author_posts_url ),
                    /* translators: %s: Author's display name. */
                    esc_attr( sprintf( __( 'View posts by %s' )$user_object->display_name ) ),
                    __( 'View' )
                );
            }

            // Add a link to send the user a reset password link by email.             if ( get_current_user_id() !== $user_object->ID
                && current_user_can( 'edit_user', $user_object->ID )
                && true === wp_is_password_reset_allowed_for_user( $user_object )
            ) {
                $actions['resetpassword'] = "<a class='resetpassword' href='" . wp_nonce_url( "users.php?action=resetpassword&amp;users=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Send password reset' ) . '</a>';
            }

            /** * Filters the action links displayed under each user in the Users list table. * * @since 2.8.0 * * @param string[] $actions An array of action links to be displayed. * Default 'Edit', 'Delete' for single site, and * 'Edit', 'Remove' for Multisite. * @param WP_User $user_object WP_User object for the currently listed user. */
Home | Imprint | This part of the site doesn't use cookies.