Forked from LMNTL/pmprozapier_email_after_change_level.php
Last active
April 4, 2021 03:54
-
-
Save travislima/de47dc5e143b1c0345bcce5e1c01b528 to your computer and use it in GitHub Desktop.
Send WP new user email and PMPro admin change email after registering a member through a PMPro Zapier zap
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 WP new user email and PMPro admin change email after registering a member through a PMPro Zapier zap | |
* Requires Paid Memberships Pro and PMPro Zapier add on to be installed and activated - https://www.paidmembershipspro.com/add-ons/pmpro-zapier/ | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_zapier_email_after_change_level( $level_id, $user_id ){ | |
if( isset( $_SERVER["REQUEST_URI"] ) && ( strpos( $_SERVER["REQUEST_URI"], "pmpro_zapier_webhook" ) !== false ) ){ | |
$user = get_userdata( $user_id ); | |
$pmpro_email = new PMProEmail(); | |
$pmpro_email->sendAdminChangeEmail( $user ); | |
wp_new_user_notification( $user_id, null, 'both' ); | |
} | |
} | |
add_action( 'pmpro_after_change_membership_level', 'my_pmpro_zapier_email_after_change_level', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Send the New User Email to Members Added via Zapier" at Paid Memberships Pro here: https://www.paidmembershipspro.com/send-signup-emails-to-zapier-added-pmpro-members/