Express expiration date&time in user Booking Confirmation mail

Free and Premium WordPress Plugins & Themes Forums WordPress Themes Alpenhouse Express expiration date&time in user Booking Confirmation mail

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #897002
    Van Hove
    Participant

    Hello

    In MotoPress AlpenHouse theme, General Settings, time zone is set to UTC+1 (Brussels time).
    The Email sent to the customer after he reserved an accommodation contains an expiration date&time. This is expressed as UTC.

    Confirm
    Note: link expires on December 18, 2019 17:26 UTC

    Is it possible to make it adjust to our time zone automatically (as most of our guests/customers come out of our own time region).

    Thanks
    Carine

    #898466
    Steve
    Keymaster

    Hello Van Hove,

    You can use a filter to modify any macros in email. To use time zone set in WordPress setting follow these steps.

    1. Upload and activate child-theme or create a new plugin for custom code.
    2. Add this code to functions.php of your theme or custom plugin

    
    function mycustom_mphb_email_replace_tag($replaceText, $tag, $booking = null)
    {
        if ($tag == 'user_confirm_link_expire' && $booking) {
            $gmtOffset = (int)(get_option('gmt_offset') * HOUR_IN_SECONDS);
            $expireTime = $booking->retrieveExpiration('user');
            $replaceText = date_i18n(MPHB()->settings()->dateTime()->getDateTimeFormatWP(), $expireTime + $gmtOffset);
        }
    
       return $replaceText;
    }
    add_filter('mphb_email_replace_tag', 'mycustom_mphb_email_replace_tag', 10, 3);
    

    3. Remove UTC text from email template.

    If you feel difficulties by implementing these changes, you may take advantage of the Extended Support service and contact us with details. We’ll gladly help you.

    #900179
    Paul MANDL
    Participant

    Thanks Steve – works great!

    I added the code with https://wordpress.org/plugins/code-snippets/

    Cheers, Paul

    • This reply was modified 1 month, 4 weeks ago by Paul MANDL.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.