• Resolved jono_hooper

    (@jono_hooper)


    Hi there,

    Thankyou for this plugin; it’s a very neat package. A question though, is it possible to change the subject line in the booking emails received by the customer to the admin email? For example, it would be great if the email subject contained the name of the person requesting the booking.

    Your help is much appreciated.

    Cheers!

    https://wordpress.org/plugins/booking-system/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author DOTonPAPER

    (@dotonpaper)

    Hello,

    I’m sorry but this is not available in the current version of the booking system. To achieve this you will need to modify the function sendMessage() in file booking-system/dopbs-email.php.

    Thank you

    Thread Starter jono_hooper

    (@jono_hooper)

    Thankyou DOTonPAPER,

    Excuse my lack of knowledge modifying functions such as these, but I have found (under ‘Email to admin’) the
    $subject = OPBS_EMAIL_TO_ADMIN_SUBJECT; line of code, which I believe is where I want to change the email subject line. It appears that $subject is sourcing the contents of the email subject from OPBS_EMAIL_TO_ADMIN_SUBJECT; but I don’t know where to find this source to change what appears in the email subject line.

    Hopefully that makes sense and you could point me further in the right direction.

    Plugin Author DOTonPAPER

    (@dotonpaper)

    That constant is in booking-system/translation/frontend/en.php but you should modify @line 148 in booking-system/dopbsp-email.php:

    if ($i === 0 || $i === 1){
        $subject .= $form_item['value'];
    }
    
    Thread Starter jono_hooper

    (@jono_hooper)

    Ah yes I’ve since found where the constant was located.

    I had a look in the booking-system/dopbsp-email.php file at line 148 but this is what exists there

    case 'booking_canceled':
    
                            $subject = DOPBS_EMAIL_CANCELED_SUBJECT;
    
                            $message = DOPBS_EMAIL_CANCELED_MESSAGE;
    
                            $template_path = DOPBS_Plugin_URL.'emails/'.$settings->template_email.'/book-canceled-email.html';
    
                            break;

    This doesn’t seem like the correct place where I modify the code. It sounds simple enough but just can’t find the right place to modify.

    Really appreciate your help so far.

    Plugin Author DOTonPAPER

    (@dotonpaper)

    You should have something like this around that line:

    if ($form_item['value'] == 'true' || $form_item['value'] == 'on'){
        $value = DOPBS_BOOKING_FORM_CHECKED;
    }
    elseif ($form_item['value'] == 'false' || $form_item['value'] == ''){
        $value = DOPBS_BOOKING_FORM_UNCHECKED;
    }
    else{
        $value = $form_item['value'];
    }

    Add the modifications after.

    Thread Starter jono_hooper

    (@jono_hooper)

    Thankyou,
    I have found the code where you said to put the modification after, below

    if ($form_item['value'] == 'true' || $form_item['value'] == 'on'){
    
                                $value = DOPBS_BOOKING_FORM_CHECKED;
    
                            }
    
                            elseif ($form_item['value'] == 'false' || $form_item['value'] == ''){
    
                                $value = DOPBS_BOOKING_FORM_UNCHECKED;
    
                            }
    
                            else{
    
                                $value = $form_item['value'];
    
                            }
    
    						if ($i === 0 || $i === 1){
    							$subject .= $form_item['value'];
    						}

    But think I’m missing adding something into the modified part, like telling it to include the user’s name into the subject.

    I tried it but only received an email with the subject ‘0’.

    Thread Starter jono_hooper

    (@jono_hooper)

    My apologies DOTonPAPER,

    The ‘0’ value returned in the email subject line was as a result of previous fiddling I’d done in the en.php file.

    Your method of adding that new code beneath the existing code did add the user’s/sender name to the incoming email subject line, however it was added to the ‘Your booking request has been sent’ confirmation email, rather than to the ‘You received a booking request’ email sent to the admin address.

    Where about in the dopbsp-email.php can I include the new code so that the user’s name is included in the admin ‘You received a booking request’ email subject?

    Thanks for your patience with me!

    Plugin Author DOTonPAPER

    (@dotonpaper)

    Hello,

    Yes you can add it. It should work.

    Thread Starter jono_hooper

    (@jono_hooper)

    Hi,

    Yes I had added what you told me to, but the user’s name was only added to the confirmation email that the user receives after booking, NOT to the email the admin receives notifying them of the booking.

    I’d like it so that the admin can see the name of the user in the subject line of the notification email sent to admin.

    Cheers.

    Plugin Author DOTonPAPER

    (@dotonpaper)

    Hello,

    I’m sorry for the late response. Do you still need help with the issue?

    Thank you

    Thread Starter jono_hooper

    (@jono_hooper)

    Hey,
    That would be great if you could continue your assistance, which is greatly appreciated. Please see my previous post to understand were I’m having the problem. I can explain further what I’d like the code to do if you’re unsure.

    Cheers.

    Plugin Author DOTonPAPER

    (@dotonpaper)

    Hello,

    Please go to emails/default/ folder, and edit the templates there.

    Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom email subject line’ is closed to new replies.