-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachments in templates #108
Conversation
admin.widget.class.php
Outdated
$headers, | ||
$attachments | ||
$headers | ||
, $attachments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, that was just to comment/uncomment quickly with least change.
wordpress-sparkpost.php
Outdated
@@ -35,3 +35,6 @@ | |||
add_filter('wp_mail', array($sp, 'init_sp_http_mailer')); | |||
} | |||
} | |||
define('WP_DEBUG', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these definitely not going to merge! just for aid of development
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Remove/Update the docs around templates and attachments - https://github.com/SparkPost/wordpress-sparkpost/blob/master/docs/templates-attachments.md
- Remove this line in the admin -
- Add in a note about needing
Templates: Preview
permissions
templates.class.php
Outdated
$body = json_decode($response['body']); | ||
|
||
if (property_exists($body, 'errors')) { | ||
$this->edebug('Error in getting template data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can not use edebug
or setError
here since this does not extend PHPMailer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right. good catch. but i'll have to find a way to use it because we need use it. i think php now support mixin. so i may consider mixin this class in http mailer so that i can use whatever HTTP Mailer class has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just pass in $this
from the mailer into the method call to keep it simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha ha, that's clever.
62910c9
to
b4097f3
Compare
@@ -38,35 +40,60 @@ protected function mailSend($header, $body) | |||
|
|||
function sparkpost_send() | |||
{ | |||
$this->edebug('Preparing request data'); | |||
$this->debug('Preparing request data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug
vs edebug
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's one of the ugly things i had to do. we can't call edebug
from templates class
Pulled #97 and dropped into my project. Initial test shows attachment appearing on email - success!. |
admin.widget.class.php
Outdated
} | ||
public function render_include_attachment_field() | ||
{ | ||
echo '<label><input type="checkbox" id="include_attachment" name="include_attachment" value="1" %s />Include Attachment</label>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is %s
in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
|
||
$request_body = $this->get_request_body(); | ||
|
||
if(!$request_body) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just default $request_body
and let the API handle the errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood this. Carry on.
WIP for #97
Here is what it does
🎉
Things to do:
Add notes that customer should add template permission to api key
Notify users in case if API does not have permission
Add unit tests