WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Shortcode_My_Account::retrieve_password() WC 1.0

Handles sending password retrieval email to customer.

Based on retrieve_password() in core wp-login.php.

Это метод класса: WC_Shortcode_My_Account

Возвращает

true/false. True: when finish. False: on error

Использование

$var = WC_Shortcode_My_Account::retrieve_password();

Код WC Shortcode My Account::retrieve password: woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php WC 4.3.0

<?php
public static function retrieve_password() {
	$login = isset( $_POST['user_login'] ) ? sanitize_user( wp_unslash( $_POST['user_login'] ) ) : ''; // WPCS: input var ok, CSRF ok.

	if ( empty( $login ) ) {

		wc_add_notice( __( 'Enter a username or email address.', 'woocommerce' ), 'error' );

		return false;

	} else {
		// Check on username first, as customers can use emails as usernames.
		$user_data = get_user_by( 'login', $login );
	}

	// If no user found, check if it login is email and lookup user based on email.
	if ( ! $user_data && is_email( $login ) && apply_filters( 'woocommerce_get_username_from_email', true ) ) {
		$user_data = get_user_by( 'email', $login );
	}

	$errors = new WP_Error();

	do_action( 'lostpassword_post', $errors );

	if ( $errors->get_error_code() ) {
		wc_add_notice( $errors->get_error_message(), 'error' );

		return false;
	}

	if ( ! $user_data ) {
		wc_add_notice( __( 'Invalid username or email.', 'woocommerce' ), 'error' );

		return false;
	}

	if ( is_multisite() && ! is_user_member_of_blog( $user_data->ID, get_current_blog_id() ) ) {
		wc_add_notice( __( 'Invalid username or email.', 'woocommerce' ), 'error' );

		return false;
	}

	// Redefining user_login ensures we return the right case in the email.
	$user_login = $user_data->user_login;

	do_action( 'retrieve_password', $user_login );

	$allow = apply_filters( 'allow_password_reset', true, $user_data->ID );

	if ( ! $allow ) {

		wc_add_notice( __( 'Password reset is not allowed for this user', 'woocommerce' ), 'error' );

		return false;

	} elseif ( is_wp_error( $allow ) ) {

		wc_add_notice( $allow->get_error_message(), 'error' );

		return false;
	}

	// Get password reset key (function introduced in WordPress 4.4).
	$key = get_password_reset_key( $user_data );

	// Send email notification.
	WC()->mailer(); // Load email classes.
	do_action( 'woocommerce_reset_password_notification', $user_login, $key );

	return true;
}