Last active
August 29, 2015 14:01
-
-
Save amdrew/792fd349420a815c26fa to your computer and use it in GitHub Desktop.
AffiliateWP - Send email to affiliate when their application is pending approval
This file contains 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 | |
/** | |
* Send email to affiliate when their application is pending | |
*/ | |
function affwp_custom_affiliate_pending_email( $affiliate_id, $status ) { | |
// affiliate is pending | |
if ( 'pending' == $status ) { | |
// this is the subject line | |
$subject = 'Your application is pending approval'; | |
// get our message | |
$message = affwp_custom_affiliate_pending_email_body( $affiliate_id ); | |
// send mail | |
affiliate_wp()->emails->send( affwp_get_affiliate_email( $affiliate_id ), $subject, $message ); | |
} | |
} | |
add_action( 'affwp_register_user', 'affwp_custom_affiliate_pending_email', 10, 2 ); | |
/** | |
* The email body of the pending application email | |
*/ | |
function affwp_custom_affiliate_pending_email_body( $affiliate_id ) { | |
$message = sprintf( "Hi %s,", affiliate_wp()->affiliates->get_affiliate_name( $affiliate_id ) ) . "\n\n"; | |
$message .= sprintf( "Thank you so much for applying to become an affiliate on %s. Your application will be reviewed shortly.", get_bloginfo( 'name' ) ) . "\n\n"; | |
$message .= get_bloginfo( 'name' ) . "\n"; | |
$message .= home_url(); | |
return $message; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment