Skip to content

Commit

Permalink
Merge pull request GeoDirectory#26 from mistergiri/master
Browse files Browse the repository at this point in the history
Notification incorrect from email - FIXED
  • Loading branch information
NomadDevs authored and NomadDevs committed Mar 23, 2016
2 parents 0388edb + df6044f commit 15e77cc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.0.6
Notification incorrect from email - FIXED

v1.0.5
Email notifications not working - FIXED
Compliment line break and clickable support removed. Use filter to override - CHANGED
Expand Down
36 changes: 35 additions & 1 deletion includes/bp-compliments-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,40 @@ function bp_compliments_new_compliment_email_notification($args = array()) {
%s', 'bp-compliments' ), $settings_link );
}

// check for GeoDirectory plugin settings first
if (function_exists('geodir_sendEmail')) {
$sitefromEmail = get_option('site_email');
$sitefromEmailName = get_site_emailName();
} else {
$sitefromEmail = get_option( 'admin_email' );
$sitefromEmailName = stripslashes(get_option('blogname'));
}


/**
* Filters the notification from email.
*
* @since 1.0.6
* @package BuddyPress_Compliments
*
* @param string $sitefromEmail Notification from email.
*/
$sitefromEmail = apply_filters( 'bp_compliments_notification_from_email', $sitefromEmail );

/**
* Filters the notification from name.
*
* @since 1.0.6
* @package BuddyPress_Compliments
*
* @param string $sitefromEmail Notification from name.
*/
$sitefromEmailName = apply_filters( 'bp_compliments_notification_from_name', $sitefromEmailName );

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";

// Send the message

/**
Expand Down Expand Up @@ -224,7 +258,7 @@ function bp_compliments_new_compliment_email_notification($args = array()) {
* @param string $compliment_link Compliment Link.
*/
$message = apply_filters( 'bp_compliments_notification_message', $message, $sender_name, $compliment_link );
wp_mail( $to, $subject, $message );
wp_mail( $to, $subject, $message, $headers );
}

/**
Expand Down

0 comments on commit 15e77cc

Please sign in to comment.