‘Missing fields’]);
}
// Generate Activation Link (Points back to current page with a query param)
// IMPORTANT: In a real system, you would store a unique token in the DB and use that for activation.
// For this example, we pass the data directly in the URL, which is less secure but functional.
$activation_link = add_query_arg([
‘sbl_activate’ => ‘true’,
‘rider_name’ => urlencode($name),
‘rider_phone’ => urlencode($phone),
‘rider_email’ => urlencode($email)
], $current_url);
// Booking Policies Link (Replace # with your actual URL if you have a specific page)
$policy_link = home_url(‘/booking-policies’);
// Email Subject & Body
$subject = “Action Required: Activate your Swiss Black Limo Account”;
$headers = array(‘Content-Type: text/html; charset=UTF-8’);
$message = ”
Welcome, $name!
Thank you for registering with Swiss Black Limo International.
Step 1: Please read our booking rules here:
Booking Policies â Swiss Black Limo International
Step 2: You must activate your account to book a ride:
See you soon!
“;
// Send Mail
$sent = wp_mail($email, $subject, $message, $headers);
if ($sent) {
wp_send_json_success([‘message’ => ‘Email sent’]);
} else {
// In a production environment, you would log the failure and attempt a fallback.
wp_send_json_error([‘message’ => ‘Failed to send email. Check WP mail settings or logs.’]);
}
wp_die(); // Required for all WP AJAX handlers
}
/* * 2. FRONTEND: The Dispatch System UI (HTML/CSS)
*/
add_action(‘wp_footer’, function() {
?>
Views: 22
