Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  E-Mail  >  Before Send Content

apply_filters_ref_array( 'vikappointments_before_send_mail_content_{$type}', bool $sendstring &$content, mixed $data )

Fires while fetching the body to include within the notification e-mails.


Description

Plugins can use this filter to manipulate at runtime the body of the e-mail notifications.

The dynamic portion of the hook name, $type, refers to the type of event that triggered the e-mail sending.
Here's a list of supported types:

  • customer
  • admin
  • cancellation
  • employee
  • waitlist
  • package
  • packadmin
  • usernote

This means that, for example, the notification e-mail sent to the administrator, for an appointment, will trigger a filter called vikappointments_before_send_mail_content_admin.


Parameters

$send

(bool)  Use false to prevent the e-mail sending.

&$content

(string)  The current content of the e-mail. Since the argument is passed as reference, it is possible to manipulate it.

$data

(mixed)  The entity to notify. In case of a take-away order, the argument will be a VAPOrderAppointment object.

The hook might specify additional arguments, which can vary according to the current type.


Example

The example below appends a footer at the end of the e-mail. The footer is added only to the notification e-mail sent to the customers for appointments.

/**
 * Triggers a filter to let the plugins be able to handle the content of the e-mail.
 *
 * The hook name is built as:
 * vikappointments_before_send_mail_content_[type]
 *
 * @param  boolean  $send      False to prevent the e-mail sending.
 * @param  string   &$content  The current e-mail content.
 * @param  object   $order     The appointment details.
 */
add_filter('vikappointments_before_send_mail_content_admin', function($send, &$content, $order)
{
    $content .= '<div style="background: #f6f6f6; color: #666; width: 100%; padding: 10px 0; table-layout: fixed; font-family: sans-serif;">';
    $content .= '<div style="max-width: 600px; margin: auto;">';
    $content .= '<p style="text-align: center; font-size: smaller;">VikWP - © ' . JHtml::_('date', 'now', 'Y') . '</p>';
    $content .= '</div>';
    $content .= '</div>';

    return $send;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2023-04-06
Utile?

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.