Skip to content

Commit 0830968

Browse files
authored
Merge pull request #67 from SparkPost/FAD-3599-doc
Add docs for hooks
2 parents 23ff711 + ad36dd9 commit 0830968

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

docs/hooks.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Plugin Hooks
2+
SparkPost's WordPress plugin has a number of hooks that can be used to modify how it works and/or inject new functionality around its lifecycle.
3+
4+
### Convention
5+
Hook names are prefixed with `wpsp_`.
6+
7+
### List of hooks
8+
9+
| Hook Name | Type | Description (Purpose)
10+
| ------------- |-------------|:----------------:|
11+
| wpsp_get_settings | Filter | Tap into settings objects
12+
| wpsp_init_mailer | Action | Modify/replace http mailer instance
13+
| wpsp_get_http_lib | Filter | Modify/replace http library
14+
| wpsp_before_send | Action |
15+
| wpsp_after_send | Action |
16+
| wpsp_handle_response | Filter | Custom handler for http response. **Return a boolean to indicate the success or failure of the transmission and to stop further processing.**
17+
| wpsp_recipients | Filter |
18+
| wpsp_open_tracking | Filter |
19+
| wpsp_click_tracking | Filter |
20+
| wpsp_template_id | Filter | Use a different template ID
21+
| wpsp_substitution_content_tag_name| Filter | Use a different tag for content substitution. By default you needed to use `content` tag
22+
| wpsp_sender_email | Filter |
23+
| wpsp_sender_name | Filter |
24+
| wpsp_response_body | Filter |
25+
| wpsp_api_key | Filter | Use different API Key/Password
26+
| wpsp_request_headers | Filter |
27+
| wpsp_reply_to | Filter |
28+
| wpsp_body_headers | Filter |
29+
| wpsp_smtp_msys_api | Filter |

mailer.http.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function get_request_body()
7777
$body = array();
7878

7979
// add recipients
80-
$body['recipients'] = apply_filters('wpsp_recipients', $this->get_recipients());
80+
$body['recipients'] = $this->get_recipients();
8181

8282
// enable engagement tracking
8383
$body['options'] = array(
@@ -410,6 +410,6 @@ protected function get_headers()
410410
$formatted_headers['CC'] = $this->stringify_recipients($cc);
411411
}
412412

413-
return apply_filters('spwp_body_headers', $formatted_headers);
413+
return apply_filters('wpsp_body_headers', $formatted_headers);
414414
}
415415
}

0 commit comments

Comments
 (0)