We work closely with the team at Paid Memberships Pro. This guide will use a custom function to support for membership level change while using WP Zapier.
This will allow you to receive data from Zapier with the key pmpro_level
and accepts the membership level ID’s from Paid Memberships Pro plugin. To cancel the user’s membership level set their pmpro_level
to 0
in your ZAP.

You may paste the following code recipe inside your Child Theme’s functions.php or custom plugin:
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 | |
/** | |
* This requires and integrates with Paid Memberships Pro. | |
* Add this code to your custom plugin / child theme's functions.php | |
*/ | |
function wpzp_change_pmpro_level( $user_id ) { | |
// Bail if PMPro not installed. | |
if ( ! defined( 'PMPRO_VERSION' ) ) { | |
return; | |
} | |
$pmpro_level = isset( $_REQUEST['pmpro_level'] ) ? intval( $_REQUEST['pmpro_level'] ) : ''; | |
if ( empty( $pmpro_level ) && $pmpro_level !== 0 ) { | |
return; | |
} | |
$pmpro_level = apply_filters( 'wpzp_pmpro_level', $pmpro_level ); | |
if ( function_exists( 'pmpro_changeMembershipLevel' ) ) { | |
pmpro_changeMembershipLevel( $pmpro_level, $user_id ); | |
echo json_encode( __( 'PMPro level has been set for this user.', 'wp-zapier' ) ); | |
} | |
} | |
add_action( 'wp_zapier_after_update_user', 'wpzp_change_pmpro_level' ); | |
add_action( 'wp_zapier_after_create_user', 'wpzp_change_pmpro_level' ); |