Created
April 28, 2022 15:01
-
-
Save launchthatbrand/d508653415b96def73597576d9ab0e68 to your computer and use it in GitHub Desktop.
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
function require_onboarding( $can_access, $user_id, $post_id ) { | |
$wpflearndash = get_post_meta( $post_id, 'wpf-settings-learndash', true ); | |
$wpflearndash = $wpflearndash['tag_link'][0]; | |
if ( is_user_logged_in() && !current_user_can( 'manage_options' ) // if use is logged in and not an admin... | |
&& !wpf_has_tag( 'status - disclaimer signed' ) // and the user doesn't have the tag 'status - disclaimer signed'... | |
&& ( !empty( array_filter( wp_fusion()->access->get_post_access_meta( $post_id ))) || !empty($wpflearndash) ) // and the wpf settings array exists OR the learndash linked tag exists... | |
) { | |
return false; //... then access is denied. | |
} | |
return $can_access; // Otherwise use the default access rules | |
} | |
add_filter( 'wpf_user_can_access', 'require_onboarding', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment