English (United Kingdom)

apply_filters_ref_array( 'vikappointments_before_send_mail_employee_registration', bool $send, string &$subject, string &$content, array $employee )

Fires before sending a notification e-mail during the employee registration process.


Description

Trigger hook to allow external plugins to manipulate the e-mail subject and text sent to the administrator(s) after a successful employee registration.

It is possible to use this hook to do other kind of stuff after the employee registration, since this is the last triggered hook.


Parameters

$send

(bool)  False to prevent the e-mail sending.

&$subject

(string)  The e-mail subject.

&$content

(string)  The e-mail (HTML) content.

$employee

(array)  An array containing the details filled by the employee, such as firstname, lastname and email.


Example

The example below explains how to take advantage of this filter to send a notification e-mail also to the employee that has just registered an account.

/**
 * Trigger hook to allow external plugins to manipulate the e-mail subject and text
 * sent to the administrator(s) after a successful employee registration.
 *
 * @param  boolean  $send      False to prevent the e-mail sending.
 * @param  string   &$subject  The e-mail subject.
 * @param  string   &$content  The e-mail (HTML) content.
 * @param  array    $employee  An array containing the details filled by the employee.
 */
add_filter('vikappointments_before_send_mail_employee_registration', function($send, &$subject, &$content, $employee) {
    // send a notification e-mail also to the employee
    VAPApplication::getInstance()->sendMail(
        // the sender e-mail address
        VikAppointments::getSenderMail(),
        // the sender name
        VAPFactory::getConfig()->get('agencyname'),
        // the recipient e-mail address
        $employee['email'],
        // the reply-to e-mail address
        VikAppointments::getSenderMail(),
        // the e-mail subject
        'Subject goes here...',
        // the e-mail body
        '<p>Mail body goes here...</p>',
        // the attachments to include (none in this case)
        $attachments = null,
        // true in case the body contains HTML tags, false in case of plain text
        $is_html = true
    );

    return $send;
}, 10, 4);

Changelog

Version Description
1.2 Introduced.
Last Update: 2024-03-05
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information