Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/5a11fbeb62d8cee1297c92dc8c378caf to your computer and use it in GitHub Desktop.
Save kimwhite/5a11fbeb62d8cee1297c92dc8c378caf to your computer and use it in GitHub Desktop.
Delete User on PMPro Approvals Deny. Delete denied user.
<?php // do not copy this line.
/**
* Automatically give user a set level when their approval is denied.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_approvals_change_member_on_deny( $user_id, $level_id ) {
// Set the ID of the alternate membership level
$alternate_level_id = 1; // Replace with your desired level ID
// Assign the user to the alternate membership level
pmpro_changeMembershipLevel($alternate_level_id, $user_id);
}
add_action( 'pmpro_approvals_after_deny_member', 'pmpro_approvals_change_member_on_deny', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment