Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Last active February 14, 2022 13:23
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 MaryOJob/8dc3d7b20df14345570388b6b3ac4db5 to your computer and use it in GitHub Desktop.
Save MaryOJob/8dc3d7b20df14345570388b6b3ac4db5 to your computer and use it in GitHub Desktop.
Change membership level on approval, if member is approved when using the Approvals Add On
<?php // Do not copy this line
/**
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_level_if_approved( $user_id, $level_id ) {
pmpro_changeMembershipLevel( 9, $user_id ); // where 9 is the level ID you want them changed to upon approval
}
add_action( 'pmpro_approvals_after_approve_member', 'my_pmpro_change_level_if_approved', 10, 2 );
@createque
Copy link

That would be great solution for my case, but unfortunately the code doesn't work - nothing happens after member approval (membership level doesn`t change) :(

@MaryOJob
Copy link
Author

@createque tested the recipe, still works

@createque
Copy link

@MaryOJob Thanks for confirmation. So, I must check other factors and find issue…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment