Skip to content

Instantly share code, notes, and snippets.

@champsupertramp
Last active November 22, 2019 11:35
Show Gist options
  • Save champsupertramp/59830f60a167f5523f00c99a223b13bf to your computer and use it in GitHub Desktop.
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
<?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