WC_Shortcode_My_Account::my_account_add_noticesprivate staticWC 1.0

Add notices to the my account page.

Historically a filter has existed to render a message above the my account page content while the user is logged out. See woocommerce_my_account_message.

Метод класса: WC_Shortcode_My_Account{}

Хуки из метода

Возвращает

null. Ничего (null).

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

$result = WC_Shortcode_My_Account::my_account_add_notices();

Код WC_Shortcode_My_Account::my_account_add_notices() WC 10.5.2

private static function my_account_add_notices() {
	global $wp;

	if ( ! is_user_logged_in() ) {
		/**
		 * Filters the message shown on the 'my account' page when the user is not logged in.
		 *
		 * @since 2.6.0
		 */
		$message = apply_filters( 'woocommerce_my_account_message', '' );

		if ( ! empty( $message ) ) {
			wc_add_notice( $message );
		}
	}

	// After password reset, add confirmation message.
	if ( ! empty( $_GET['password-reset'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		wc_add_notice( __( 'Your password has been reset successfully.', 'woocommerce' ) );
	}

	// After logging out without a nonce, add confirmation message.
	if ( isset( $wp->query_vars['customer-logout'] ) && is_user_logged_in() ) {
		/* translators: %s: logout url */
		wc_add_notice( sprintf( __( 'Are you sure you want to log out? <a href="%s">Confirm and log out</a>', 'woocommerce' ), wc_logout_url() ) );
	}

	if ( get_user_option( 'default_password_nag' ) && ( wc_is_current_account_menu_item( 'dashboard' ) || wc_is_current_account_menu_item( 'edit-account' ) ) ) {
		wc_add_notice(
			sprintf(
				// translators: %s: site name.
				__( 'Your account with %s is using a temporary password. We emailed you a link to change your password.', 'woocommerce' ),
				esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) )
			),
			'notice',
			array(),
			true
		);
	}
}