You've already forked wc-licensed-product
- Remove Current Version field from product license settings - Derive current version from latest product version in database - Refactor email system to use WooCommerce email notification classes - Add LicenseExpirationEmail WC_Email class for expiration warnings - Add customizable email templates (HTML and plain text) - Update settings to link to WooCommerce email configuration - Update translations for new email-related strings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* License Expiration Warning Email (Plain Text)
|
|
*
|
|
* This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/license-expiration.php.
|
|
*
|
|
* @package Jeremias\WcLicensedProduct\Templates\Emails
|
|
* @version 0.0.8
|
|
*
|
|
* @var \Jeremias\WcLicensedProduct\License\License $license
|
|
* @var int $days_remaining
|
|
* @var string $product_name
|
|
* @var string $expiration_date
|
|
* @var string $email_heading
|
|
* @var string $additional_content
|
|
* @var bool $sent_to_admin
|
|
* @var bool $plain_text
|
|
* @var \Jeremias\WcLicensedProduct\Email\LicenseExpirationEmail $email
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
|
|
echo esc_html(wp_strip_all_tags($email_heading));
|
|
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
|
|
|
$customer = get_userdata($license->getCustomerId());
|
|
$customer_name = $customer ? $customer->display_name : __('Customer', 'wc-licensed-product');
|
|
|
|
echo sprintf(esc_html__('Hello %s,', 'wc-licensed-product'), esc_html($customer_name)) . "\n\n";
|
|
|
|
if ($days_remaining === 1) {
|
|
echo sprintf(
|
|
esc_html__('Your license for %s will expire tomorrow (%s).', 'wc-licensed-product'),
|
|
esc_html($product_name),
|
|
esc_html($expiration_date)
|
|
) . "\n\n";
|
|
} else {
|
|
echo sprintf(
|
|
esc_html__('Your license for %1$s will expire in %2$d days (%3$s).', 'wc-licensed-product'),
|
|
esc_html($product_name),
|
|
$days_remaining,
|
|
esc_html($expiration_date)
|
|
) . "\n\n";
|
|
}
|
|
|
|
echo "----------\n";
|
|
echo esc_html__('License Details', 'wc-licensed-product') . "\n";
|
|
echo "----------\n\n";
|
|
|
|
echo esc_html__('Product:', 'wc-licensed-product') . ' ' . esc_html($product_name) . "\n";
|
|
echo esc_html__('License Key:', 'wc-licensed-product') . ' ' . esc_html($license->getLicenseKey()) . "\n";
|
|
echo esc_html__('Domain:', 'wc-licensed-product') . ' ' . esc_html($license->getDomain()) . "\n";
|
|
echo esc_html__('Expires:', 'wc-licensed-product') . ' ' . esc_html($expiration_date) . "\n\n";
|
|
|
|
if ($additional_content) {
|
|
echo "----------\n\n";
|
|
echo esc_html(wp_strip_all_tags(wptexturize($additional_content)));
|
|
echo "\n\n";
|
|
}
|
|
|
|
echo esc_html__('View My Licenses', 'wc-licensed-product') . ': ' . esc_url(wc_get_account_endpoint_url('licenses')) . "\n\n";
|
|
|
|
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
|