Plugin Contributor
rajuru
(@rajuru)
You should be able to solve all of these problem using one or more hook(s).
https://github.com/SparkPost/wordpress-sparkpost/blob/master/docs/hooks.md
Hi rajuru,
It sounds probably obvious for you, but it is not for me.
My objective is to improve the setting page to allow the site administrator to set the parameters (Endpoint, Return-Path, Campaign ID, IP Pool). I don’t see how to do that thanks to the hooks.
Could you provide one or more example, please?
Thank you
-
This reply was modified 9 years ago by
fabscanta.
Plugin Contributor
rajuru
(@rajuru)
Thanks for your specific suggestions. However, settings page is for most generic use cases. Having those extra fields in the settings page may even confuse the non-enterprise users. However, if we see a growing demand for this, we can surely consider that.
You can see this buddyfix example how to use a hook.
In the same way, you can use any of the appropriate hook listed in the previous link. For example, you can customize the whole payload (data sent to sparkpost), using wpsp_request_body hook.
add_filter('wpsp_request_body', function($body){
//you can modify anything in $body here
});
you can customize the payload as transmission api supports.
and to modify the endpoint, you can use
add_action('wpsp_init_mailer', function($obj) {
$obj->endpoint = 'YOUR_API_ENDPOINT_HERE';
});
-
This reply was modified 9 years ago by
rajuru.
-
This reply was modified 9 years ago by
rajuru.
-
This reply was modified 9 years ago by
rajuru.
I think this is more valuable for the plugin to support Enterprise users.
I tried your suggestion for the endpoint. I get a fatal error because $obj->endpoint is protected.
Error: Cannot access protected property WPSparkPost\SparkPostHTTPMailer::$endpoint
We thought that there is a field to do a fork and a pull request where you could review the code and validate it.
Do you think your team could welcome this option as an opportunity of improvement?
Thank you
Plugin Contributor
rajuru
(@rajuru)
Error: Cannot access protected property WPSparkPost\SparkPostHTTPMailer::$endpoint
Ah, that’s a super silly oversight! It must not be protected. I’ve just logged a bug. We’ll fix it ASAP.
Do you think your team could welcome this option as an opportunity of improvement?
Sure. We log all enhancement ideas. Please create an issue in https://github.com/SparkPost/wordpress-sparkpost/issues. We’ll surely consider it based on demand.
Hi rajuru,
That’s great to read your feedback.
My colleague has made the pull request: https://github.com/SparkPost/wordpress-sparkpost/pull/105
Many thanks.