Skip to content

Commit

Permalink
Merge branch 'master' into mailchimp
Browse files Browse the repository at this point in the history
  • Loading branch information
noaholsson authored Jun 26, 2023
2 parents f90895f + 9a8f275 commit 6e969e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/Controllers/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ function ($error) {
}
}

// Remove attachments after mail
if (apply_filters('qterest_contact_remove_attachments_after_request', false, $params, $post_id) == true) {
foreach ($attachment_ids as $attachment_id) {
wp_delete_attachment($attachment_id, true);
}
}

return array(
'success' => true,
'success_msg' => $messages['success'],
Expand Down
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ The following messages can be changed

Form submission data can be accessed through the `$params` parameter

#### Filter to remove attachments after request
You can use the following filter to remove attachments after a request
```php
function theme_remove_attachment_after_request($remove, $params, $post_id) {
// You may access $params or $post_id if you wish to remove attachments conditionally
$remove = true;
return $remove;
}
add_filter('qterest_contact_remove_attachments_after_request', 'theme_remove_attachment_after_request', 10, 3);
```

#### Formatting keys (ADMIN)
When looking at a contact request you can see that the name of the field identifies the value. This can be changed by adding a filter to display a better name for the customer. The filter name looks like this `qterest_format_key_${key}`.
```php
Expand Down

0 comments on commit 6e969e6

Please sign in to comment.