Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function add_attachments($data = null, $model = null) {
if (!empty($model) && $model == "History") {
if (!empty($_FILES)) {
foreach ($_FILES as $fkey => $fval) {
$data['newattachments'][] = array(
'title' => "title for attachment",
'filename' => "/absolute/path/to/the/attachment.ext",
);
}
}
}
return $data;
}
add_filter('newsletters_db_data_before_validate', 'add_attachments', 10, 2);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.