Last active
March 2, 2020 16:33
-
-
Save femiyb/10c45ecfd571ebc36a65a6b95dcb6b1f to your computer and use it in GitHub Desktop.
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 | |
function action_pmpro_after_change_membership_level( $level_id, $user_id ) | |
{ | |
$user = get_userdata($user_id); | |
$role_levels = array(1,2,3); | |
if(in_array($level_id, $role_levels)) | |
{ | |
$user->add_role( 'subscriber' ); | |
} | |
} | |
// add the action | |
add_action( 'pmpro_after_change_membership_level', 'action_pmpro_after_change_membership_level', 1, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment