Skip to content

Instantly share code, notes, and snippets.

@tribulant
Created January 12, 2016 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tribulant/f126e91427898a766462 to your computer and use it in GitHub Desktop.
Save tribulant/f126e91427898a766462 to your computer and use it in GitHub Desktop.
<?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