Created
January 10, 2017 04:41
-
-
Save danielbitzer/d9f3594631d83ff04889e17ab5719470 to your computer and use it in GitHub Desktop.
[Refer A Friend] Dynamic email from name for referral invites, personalize with the advocate's name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('automatewoo/referrals/invite_email/mailer', 'my_filter_referrals_invite_email', 10, 2 ); | |
/** | |
* @param AW_Mailer $mailer | |
* @param AW_Referrals_Referral_Invite_Email $invite | |
* @return AW_Mailer | |
*/ | |
function my_filter_referrals_invite_email( $mailer, $invite ) { | |
$advocate_name = $invite->advocate->get_name(); | |
// OR use the advocate's first name only | |
// $advocate_name = $invite->advocate->get_first_name(); | |
if ( $advocate_name ) { | |
$mailer->from_name = sprintf( __( '%s via %s', 'my-text-domain' ), $advocate_name, $mailer->from_name ); | |
} | |
return $mailer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment