Skip to content

Commit

Permalink
Email Notification Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cogdog committed Aug 1, 2019
1 parent aac0105 commit 8c60738
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 6 additions & 0 deletions includes/splot-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,9 @@ function splotwriter_get_licences() {
);
}

function set_html_content_type() {
// from http://codex.wordpress.org/Function_Reference/wp_mail
return 'text/html';
}


13 changes: 4 additions & 9 deletions public/class-splotwriter-public.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -777,13 +777,13 @@ public function splotwriter_do_writerform() {
if ( $wNotes ) $message .= '<br /><br />There are some extra notes from the author:<blockquote>' . $wNotes . '</blockquote>';

// turn on HTML mail
add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type') );
add_filter( 'wp_mail_content_type', 'set_html_content_type' );

// mail it!
wp_mail( $to_recipients, $subject, $message);

// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
remove_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type') );
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );

} else {
// updated but still in draft mode
Expand Down Expand Up @@ -1109,7 +1109,7 @@ public function splotwriter_mail_edit_link ( $wid, $mode = 'request' ) {

// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );

if ($mode == 'request') {
if ($mail_sent) {
echo 'Instructions sent via email';
Expand All @@ -1120,6 +1120,7 @@ public function splotwriter_mail_edit_link ( $wid, $mode = 'request' ) {
}



# -----------------------------------------------------------------
# Creative Commons Licensing
# -----------------------------------------------------------------
Expand Down Expand Up @@ -2100,12 +2101,6 @@ public function splotwriter_get_splot_meta_for_api( $object ) {
return ($splot_meta);
}

public function set_html_content_type() {
// from http://codex.wordpress.org/Function_Reference/wp_mail
return 'text/html';
}


// function to get the caption for an attachment (stored as post_excerpt)
// -- h/t http://wordpress.stackexchange.com/a/73894/14945
public function get_attachment_caption_by_id( $post_id ) {
Expand Down
2 changes: 1 addition & 1 deletion splotwriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'SPLOTWRITER_VERSION', '1.1.0' );
define( 'SPLOTWRITER_VERSION', '1.1.1' );

/**
* The code that runs during plugin activation.
Expand Down

0 comments on commit 8c60738

Please sign in to comment.