Customized confirmation message
On this page we see how to Customize the message that includes the booking confirmation token (the booking confirmation message sent when online payments are disabled).
Starting from version 1.0.2, the Simple Bike Rental plugin sends the confirmation email in HTML format, making the message more readable and professional.
Two WordPress filters have also been introduced to allow developers to customize the subject and content of the message.
In this guide, we will show you how to do it in a few simple steps.
Edit the email subject
You can edit the email subject using the 'simpbire_email_subject' filter in the functions.php file of your theme (or in a custom plugin):
add_filter('simpbire_email_subject', 'custom_sbr_email_subject', 10, 2);
function custom_sbr_email_subject($subject, $nome) {
return "Confirm your bike rental, $nome!";
}
Changing the email content
The 'simpbire_email_message' filter allows you to customize the entire HTML message, including the confirmation link:
add_filter('simpbire_email_message', 'custom_sbr_email_message', 10, 3);
function custom_sbr_email_message($message, $nome, $link) {
return "
<p>Hi $nome,</p>
<p>Thanks for booking your bike with us!</p>
<p>Please confirm your rental by clicking the link below:</p>
<p><a href="\"$link\"";Click here to confirm</a></p>
<p>Looking forward to seeing you!</p>
";
}
You can freely use HTML and insert images, logos, or a custom style.
Security and compatibility
The data provided by the plugin through filters ($name, $link, etc.) are already sanitized and safe to use.
However, if you use data from other sources in your custom message, such as custom fields, user metadata, or user input, we recommend that you always apply WordPress security features.
- esc_html() for normal text
- esc_url() for URLs or images
- esc_attr() for HTML attributes
Need help?
If you have any questions about how to apply these filters, you can contact us through the Contact page or open a discussion in the support forum on WordPress.org.