wsf_action_email_attachments

Description

The wsf_action_email_attachments filter allows you to modify the Attachments array when sending emails using the Send Email action.

The array has the following format:

array(

    // An attachment
    array(

        // Absolute path to file
        'path' => '/absolute/path/to/file',

        // Whether to delete the file after the email is sent
        'unlink' => false
    )
);

 

Usage

add_filter( 'wsf_action_email_attachments', 'my_hook_function', 10, 5 );

Parameters

  1. $attachments Array
    An array of attachments. Each attachment element is an array containing the file absolute path and whether to unlink the file after the email is send.
  2. $form Form Object
    The form object.
  3. $submit Submit Object
    The submit object.
  4. $action Array
    The action configuration.
  5. $temp_path String
    The temporary path WS Form is using for file attachments.

Example

// Callback function for the wsf_action_email_attachments filter hook
function my_hook_function( $attachments, $form, $submit, $action, $temp_path ) {
    
    // Add an attachment
    $attachments[] = array(

        // Attachment
        array(

            // Absolute path to file
            'path' => '/absolute/path/to/file',

            // Whether to delete the file after the email is sent
            'unlink' => false
        )
    );

    // Return value
    return $attachments;
}

// Add a callback function for the wsf_action_email_attachments filter hook
add_filter( 'wsf_action_email_attachments', 'my_hook_function', 10, 5 );

 

Source File

This hook can be found in: <plugin root>/includes/actions/class-ws-form-action-email.php