feat: temp password in emails + WC page redirects to SPA
1. Temp password for auto-registered users:
- Store password in _woonoow_temp_password user meta (CheckoutController)
- Add {user_temp_password} and {login_url} variables (EmailRenderer)
- Update new_customer email template to show credentials
2. WC page redirects to SPA routes:
- Added redirect_wc_pages_to_spa() in TemplateOverride
- Maps: /shop → /store/#/, /cart → /store/#/cart, etc.
- /checkout → /store/#/checkout, /my-account → /store/#/account
- Single products → /store/#/products/{slug}
3. Removed shortcode system:
- Commented out Shortcodes::init() in Bootstrap
- WC pages now redirect to SPA instead
This commit is contained in:
@@ -252,19 +252,14 @@ class EmailRenderer {
|
||||
}
|
||||
|
||||
// Customer variables
|
||||
if ($data instanceof \WC_Customer) {
|
||||
// Generate password reset URL for new customers
|
||||
$set_password_url = '';
|
||||
$user = get_user_by('id', $data->get_id());
|
||||
if ($user) {
|
||||
$reset_key = get_password_reset_key($user);
|
||||
if (!is_wp_error($reset_key)) {
|
||||
$set_password_url = network_site_url(
|
||||
"wp-login.php?action=rp&key={$reset_key}&login=" . rawurlencode($user->user_login),
|
||||
'login'
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($data instanceof \WC_Customer) {
|
||||
// Get temp password from user meta (stored during auto-registration)
|
||||
$user_temp_password = get_user_meta($data->get_id(), '_woonoow_temp_password', true);
|
||||
|
||||
// Generate login URL (pointing to SPA login instead of wp-login)
|
||||
$appearance_settings = get_option('woonoow_appearance_settings', []);
|
||||
$spa_page_id = $appearance_settings['general']['spa_page'] ?? 0;
|
||||
$login_url = $spa_page_id ? get_permalink($spa_page_id) . '#/login' : wp_login_url();
|
||||
|
||||
$variables = array_merge($variables, [
|
||||
'customer_id' => $data->get_id(),
|
||||
@@ -273,7 +268,8 @@ class EmailRenderer {
|
||||
'customer_last_name' => $data->get_last_name(),
|
||||
'customer_email' => $data->get_email(),
|
||||
'customer_username' => $data->get_username(),
|
||||
'set_password_url' => $set_password_url,
|
||||
'user_temp_password' => $user_temp_password ?: '',
|
||||
'login_url' => $login_url,
|
||||
'my_account_url' => get_permalink(wc_get_page_id('myaccount')),
|
||||
'shop_url' => get_permalink(wc_get_page_id('shop')),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user