Created
February 3, 2015 18:13
-
-
Save JudeRosario/260baf98ba814c2ea597 to your computer and use it in GitHub Desktop.
Membership notify me on expiry
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
add_action( 'membership_expire_subscription', 'notify_expiry', 10, 2 ); | |
function notify_expiry( $sub_id, $user_id ) { | |
$user = get_userdata($user_id); | |
// You can also filter only specific subscriptions here | |
$sub = Membership_Plugin::factory()->get_subscription( $sub_id ); | |
// Put your email here | |
$to = '[email protected]' ; | |
$subject = "Membership Expiry" ; | |
// Format email content if needed | |
$message = sprintf(__( '<strong>%s</strong> has left subscription <strong>%s</strong>','membership' ), $user->display_name, $sub->sub_name() ); | |
wp_mail( $to, $subject, $message ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment