Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/792fd349420a815c26fa to your computer and use it in GitHub Desktop.
Save amdrew/792fd349420a815c26fa to your computer and use it in GitHub Desktop.
AffiliateWP - Send email to affiliate when their application is pending approval
<?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