I just realized a major issue. I created a custom email following the instructions on Emails | Developer Docs, and I stored the PHP file in the Bookings→Includes→Email folder, as indicated.
It seems that with every Bookings plugin update, all custom files are deleted (overriden with the new files). This email is very important for my website, and I did not notice the issue since the last update, many weeks ago.
Is there any way to avoid those files to be deleted with every update? If an update would override only its own files (like class-booking-confirm-user, etc) and leave the rest intact , that would be great.
thank you. I forgot to mention that I’d rather not use a child theme, although I’m afraid that’s the only way. I already tried to install a child theme once, and it only worked for the main Rentalhive theme, but somehow the rest of the extensions were not accessible/copied. I can’t remember, sorry for the bad explanation. I basically use a ton of code snippets for everything.
If anyone has tried creating a child theme with Rentalhive, Bookings and Marketplace extensions (and geolocation etc), please let me know if everything worked fine.
Could you please let us know which email you tried to customize? It may be one of the built-in emails, which can be customized in HivePress > Emails, as JSHBV mentioned.
Like I explained at the top “I created a custom email following the instructions on Emails | Developer Docs ”. I did not customize any existing email, I created a new one and called it Custom_Status_Update, and it works perfectly because I can call it whenever I need it. It will send emails to the recipient I choose in my snippet, with my created information.
But, according to the docs, I have to store it as a PHP file in the respective folder, which gets overriden with each update, and that is what I want to avoid. I tried child themes a long time ago, but they don’t seem to be useful when you have Hivepress Extensions. I can’t remember exactly, it just wasn’t what I needed. That’s why I use code snippets everywhere I can. But in this case, I have to save the php file there.
My only question was if the logic of Hivepress updates could be modified to replace only existing files in the respective plugin/extension folder, and not remove added files. I assume it is not possible, but it’s worth a question at least.
Sorry for the confusion – the docs you’ve referenced are developer-specific docs, they explain how the HivePress framework itself is implemented and describe everything in the context of the framework and developing a custom extension. So, in case of your own custom HivePress extension, it’s ok to create emails in the “includes” folder, since you will update your own extension and have full control over it. However, if you just want to customize existing emails, any direct changes within the HivePress plugin, its themes, or extensions may be erased on updates. There are a few solutions:
If you need a completely new email assigned to a custom event, you can choose one of the existing hooks, create a custom code snippet for it, and use the wp_mail function to send a custom email.
To customize the existing HivePress emails, you can do so without code in HivePress/Emails. Changing the email tokens or other email parameters (other than subject and text) is possible via the available email hooks with custom code snippets (these are kept outside of the plugin folder, so they are safe from updates). To customize the common email template (HTML wrapper) of all the HivePress emails, you can copy this template file to the child theme folder, keeping the same path hivepress/templates/email/email-content.php at master · hivepress/hivepress · GitHub