Is there a way to add a unique number to the confirmation (confirmation#)

I would like to add a unique incremental # to the appointment that would be included in the emails sent to the user and admin.

Is this possible?

Thanks,
Chris

  • chris

    I found the function that handles the placeholder replacement....

    function _replace( $text, $user, $service, $worker, $datetime, $price, $deposit, $phone='', $note='', $address='', $email='', $city='' ) {
    /*
    return str_replace(
    array( "SITE_NAME", "CLIENT", "SERVICE_PROVIDER", "SERVICE", "DATE_TIME", "PRICE", "DEPOSIT", "PHONE", "NOTE", "ADDRESS", "EMAIL", "CITY" ),
    array( wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), $user, $worker, $service, mysql2date( $this->datetime_format, $datetime ), $price, $deposit, $phone, $note, $address, $email, $city ),
    $text
    );
    */
    $balance = !empty($price) && !empty($deposit)
    ? (float)$price - (float)$deposit
    : (!empty($price) ? $price : 0.0)
    ;
    $replacement = array(
    'SITE_NAME' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES),
    'CLIENT' => $user,
    'SERVICE_PROVIDER' => $worker,
    'SERVICE' => $service,
    'DATE_TIME' => mysql2date($this->datetime_format, $datetime),
    'PRICE' => $price,
    'DEPOSIT' => $deposit,
    'BALANCE' => $balance,
    'PHONE' => $phone,
    'NOTE' => $note,
    'ADDRESS' => $address,
    'EMAIL' => $email,
    'CITY' => $city,
    );
    foreach($replacement as $macro => $repl) {
    $text = preg_replace('/' . preg_quote($macro, '/') . '/U', $repl, $text);
    }
    return $text;
    }

    Is the variable for the appointment ID available to this function? so I could add something like $appointment_id to the variables and 'CONFIRMATION' => $appointment_id ?

    I found $app->ID, which is how it is called for the appointments page, but apparently it is not available to this function. is there a way to make it available?

  • Hoang Ngo

    Hi @chris,

    I hope you are well today and I'm sorry about the delay.

    You are too close for archive this, that's the right place :slight_smile:.

    But we have another way without modify the core code, we can use the filter name "app_confirmation_message".

    Here is an example for how to use it in this case :

    add_filter( 'app_confirmation_message', 'update_appointment_email_body', 10, 3 );
    function update_appointment_email_body( $body, $r, $app_id ) {
    	return str_replace( 'APP_ID', $app_id, $body );
    }

    So this will be replace the APP_ID in your confirm message (which can be update in backend setting page) with the appointment id.

    If you have any issues please don't hesitate to let us know so we can assist

    Best Regards
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.