<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/**
 * Plain Text Template: User Registration Email
 *
 * Sent to the admin when a new user registers on the platform.
 *
 * @var string   $email_heading
 * @var string   $user_name
 * @var string   $user_email
 * @var int      $user_id
 * @var string   $profile_name
 * @var string   $freelancer_label
 * @var string   $employer_label
 * @var string   $profile_type
 * @var string   $site_title
 * @var bool     $sent_to_admin
 * @var bool     $plain_text
 * @var WC_Email $email
 */

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
echo esc_html( wp_strip_all_tags( $email_heading ) );
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

/* Greeting */
echo esc_html__( 'Hello,', 'gigneo' );
echo "\n\n";

/* Introduction */
printf(
	// translators: %s: Site title.
	esc_html__( 'A new account has been successfully created on %s. Here are the registration details for your review.', 'gigneo' ),
	esc_html( get_bloginfo( 'name' ) )
);
echo "\n\n";

/* Section heading */
echo esc_html__( 'Account details', 'gigneo' );
echo "\n----------\n\n";

/* Username */
echo esc_html__( 'Username:', 'gigneo' ) . ' ' . esc_html( $user_name );
echo "\n";

/* Full name (conditional) */
if ( ! empty( $profile_name ) ) {
	echo esc_html__( 'Full name:', 'gigneo' ) . ' ' . esc_html( $profile_name );
	echo "\n";
}

/* Email address */
echo esc_html__( 'Email address:', 'gigneo' ) . ' ' . esc_html( $user_email );
echo "\n";

/* Account type (conditional) */
if ( ! empty( $profile_type ) ) {
	$type_label = '';
	if ( 'freelancer' === $profile_type ) {
		$type_label = $freelancer_label;
	} elseif ( 'employer' === $profile_type ) {
		$type_label = $employer_label;
	} else {
		$type_label = ucfirst( $profile_type );
	}
	echo esc_html__( 'Account type:', 'gigneo' ) . ' ' . esc_html( $type_label );
	echo "\n";
}

/* Registration date */
echo esc_html__( 'Registered on:', 'gigneo' ) . ' ' . esc_html( wp_date( get_option( 'date_format' ) . ' · ' . get_option( 'time_format' ) ) );
echo "\n\n";

/* Closing note */
echo esc_html__( 'You can manage this account directly from your WordPress admin dashboard. No further action is required unless manual approval is enabled.', 'gigneo' );
echo "\n\n";


// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_footer', $email );
