Last active
March 13, 2020 15:16
-
-
Save ronalfy/8db08f126b9f46d4ec9da4feb55b20bc to your computer and use it in GitHub Desktop.
Paid Memberships Pro Log Out User After Confirmation Pending Approval
This file contains hidden or 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 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