Automattic\WooCommerce\Internal\StockNotifications\Frontend
SignupService::get_signup_user_message
Get the signup user message for the signup code.
Method of the class: SignupService{}
No Hooks.
Returns
String. The signup user message.
Usage
$SignupService = new SignupService(); $SignupService->get_signup_user_message( $signup_code, $notification ): string;
- $signup_code(string) (required)
- The signup code.
- $notification(Notification) (required)
- The notification.
SignupService::get_signup_user_message() SignupService::get signup user message code WC 10.3.6
public function get_signup_user_message( string $signup_code, Notification $notification ): string {
$message = '';
$has_action_button = false;
switch ( $signup_code ) {
case self::SIGNUP_SUCCESS:
/* translators: Product name */
$message = sprintf( esc_html__( 'You have successfully signed up! You will be notified when "%s" is back in stock.', 'woocommerce' ), $notification->get_product_name() );
break;
case self::SIGNUP_SUCCESS_DOUBLE_OPT_IN:
$message = esc_html__( 'Thanks for signing up! Please complete the sign-up process by following the verification link sent to your e-mail.', 'woocommerce' );
break;
case self::SIGNUP_SUCCESS_ACCOUNT_CREATED:
/* translators: Product name */
$message = sprintf( esc_html__( 'You have successfully signed up and will be notified when "%s" is back in stock! Note that a new account has been created for you; please check your e-mail for details.', 'woocommerce' ), $notification->get_product_name() );
break;
case self::SIGNUP_SUCCESS_ACCOUNT_CREATED_DOUBLE_OPT_IN:
$message = esc_html__( 'Thanks for signing up! An account has been created for you. Please complete the sign-up process by following the verification link sent to your e-mail.', 'woocommerce' );
break;
case self::SIGNUP_ALREADY_JOINED:
$message = esc_html__( 'You have already joined this waitlist.', 'woocommerce' );
break;
case self::SIGNUP_ALREADY_JOINED_DOUBLE_OPT_IN:
$notice_text = esc_html__( 'You have already joined this waitlist. Please complete the sign-up process by following the verification link sent to your e-mail.', 'woocommerce' );
$url = $this->notification_management_service->get_resend_verification_email_url( $notification );
$button_class = wc_wp_theme_get_element_class_name( 'button' );
$wp_button_class = $button_class ? ' ' . $button_class : '';
$message = sprintf(
'<a href="%s" class="button wc-forward%s">%s</a> %s',
$url,
$wp_button_class,
esc_html_x( 'Resend verification', 'notice action', 'woocommerce' ),
$notice_text
);
$has_action_button = true;
break;
default:
$message = '';
break;
}
if ( is_user_logged_in() && ! $has_action_button ) {
$button_class = \wc_wp_theme_get_element_class_name( 'button' );
$wp_button_class = $button_class ? ' ' . $button_class : '';
$message = sprintf( '<a href="%s" class="button wc-forward%s">%s</a> %s', \wc_get_account_endpoint_url( 'stock-notifications' ), $wp_button_class, esc_html_x( 'Manage notifications', 'notice action', 'woocommerce' ), $message );
}
return $message;
}