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 | |
add_action('template_redirect', function () { | |
if (is_user_logged_in()) { | |
$q_object = get_queried_object(); | |
if (($q_object) && (is_a($q_object, 'WP_Post')) && ($q_object->post_type == 'sfwd-courses')) { | |
if (sfwd_lms_has_access($q_object->ID)) { | |
$steps = learndash_get_course_steps($q_object->ID); | |
if (count($steps)) { | |
wp_redirect(get_permalink($steps[0])); |
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... | |