Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Last active March 13, 2020 15:16
Show Gist options
  • Save ronalfy/8db08f126b9f46d4ec9da4feb55b20bc to your computer and use it in GitHub Desktop.
Save ronalfy/8db08f126b9f46d4ec9da4feb55b20bc to your computer and use it in GitHub Desktop.
Paid Memberships Pro Log Out User After Confirmation Pending Approval
<?php
function pmpro_custom_pages_shortcode_confirmation( $content ) {
if ( is_user_logged_in() ) {
if ( class_exists( 'PMPro_Approvals' ) ) {
global $current_user;
$approval_levels = PMPro_Approvals::getApprovalLevels();
foreach ( $approval_levels as $level ) {
if ( ! PMPro_Approvals::isApproved( $current_user->ID, $level ) ) {
wp_logout();
break;
}
}
}
};
return $content;
}
add_filter( 'pmpro_pages_shortcode_confirmation', 'pmpro_custom_pages_shortcode_confirmation', 20, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment