Skip to content

Instantly share code, notes, and snippets.

@femiyb
Last active March 2, 2020 16:33
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 femiyb/10c45ecfd571ebc36a65a6b95dcb6b1f to your computer and use it in GitHub Desktop.
Save femiyb/10c45ecfd571ebc36a65a6b95dcb6b1f to your computer and use it in GitHub Desktop.
<?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