Last active
November 22, 2019 11:35
-
-
Save champsupertramp/59830f60a167f5523f00c99a223b13bf to your computer and use it in GitHub Desktop.
Ultimate Member - Redirect Users to custom page when account is still not verified and completed the profile
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 | |
// Current logged in user | |
$user_id = get_current_user_id(); | |
if( class_exists("UM_Verified_Users_API") && class_exists("UM_Profile_Completeness_API") ){ // check if extensions exist and active | |
if( is_user_logged_in() && ! is_page("custom-page-slug") ){ // If user is logged in / don't redirect when in the dashboard or custom page. | |
$get_progress = UM()->Profile_Completeness_API()->get_progress( $user_id ); | |
if ( $get_progress['progress'] == 100 ) { // Check if progress is 100 | |
if ( ! UM()->Verified_Users_API()->api()->is_verified( $user_id ) ) { // Check if user is still not verified | |
wp_redirect("/custom-page-slug/"); exit; // redirect to custom page | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment