• Hello!

    I am trying to embed more content below an first embedded video, it’s the first thing that appears on the page. But for some reason when I try to add something below it using a custom fields editor which lives in the user portal for each user, it won’t show up. The php content for the page I am trying to added content for is below, can someone please help. Thanks!

    <?php /*Template Name: following-temp */
     $userID=get_current_user_id();
     ?>
    <?php if(isset($_GET['lesson'])){
            $lesson_id = $_GET['lesson'];
            $lesson_name = $_GET['lessonname']; } ?>
    <?php get_header(); ?>
            <style>
                    .embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; }
                    .embed-container iframe,
                    .embed-container object,
                    .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
            </style>
     <div class='container'>
        <div class='row'>
            <div class='col-lg-12'>
                <h1 class='page-header'><?php the_title(); ?></h1>
                <ol>
                    <li><a href='/'>Home</a></li>
                    <li><a href='/courses/myflex/'>Return to Modules</a></li>
                    <li><a href='/myflexibility-profile/'>MyFLEXibility Profile</a></li>
                    <li><?php the_title(); ?></li>
                </ol>
            </div>
            <?php
            $post_thumbnail = get_the_post_thumbnail( $lesson_id );
            echo '<div class='col-lg-8'>';
            $title =  get_the_title($lesson_id);
            if ('Warm-Ups' == $lesson_name) {
                $title = 'Warm Ups';
            }
            if ('Cool-Down' == $lesson_name) {
                $title = 'Cool Down';
            }
            echo '<h2 class='title'>' . $title . '</h2>';
            echo '<div class='embed-container'>';
            /*
            if warm up is requested to add again, uncomment this one
            if($lesson_id  == 570){
                $post_12 = get_post(2285); 
                echo '<h2 class='fav'> Warm up <h2>';
                $trim_me = $post_12->post_content;
                echo $trim_me;
            } */
    //      echo get_field('follow_along_video',$lesson_id);
            if ('Warm-Ups' == $lesson_name) {
                ?>
                    <iframe src='https://player.vimeo.com/video/311167472' width='640' height='360' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
                <?php
            }
            if ('Hip-Extension' == $lesson_name) {
                the_field('followalong_-_hip_extension_video_embed', 'user_'.get_current_user_id());
            }
            if ('Pike' == $lesson_name) {
                the_field('followalong_-_pike_video_embed', 'user_'.get_current_user_id());
            }
            if ('Straddle' == $lesson_name) {
                the_field('followalong_-_straddle_video_embed', 'user_'.get_current_user_id());
            }
            if ('Shoulders-and-Upper-Back' == $lesson_name) {
                the_field('followalong_-_shoulders_video_embed', 'user_'.get_current_user_id());
            }
            if ('Cool-Down' == $lesson_name) {
                ?>
                    <iframe src='https://player.vimeo.com/video/311167475' width='640' height='360' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
                <?php
            }
            echo '</div>';
            echo '</div>';
            ?>
            <div class='col-lg-4'>
                <div class='hidden-md hidden-lg' style='width:100%; height:40px;'><hr></div>
                <div class='well well-sidebar-rep2'><h4>Navigation</h4>
                    <div id='course_navigation' class='course_navigation'>
                        <div class='ld-course-navigation-widget-content-contaiiner'>
                            <div class='learndash_navigation_lesson_topics_list'>
                                <div class='inactive' id='lesson_list-568'>
                                    <div class='list_arrow collapse lesson_incomplete'></div>
                                    <div class='list_lessons'>
                                        <div class='lesson '>
                                            <a href='/my-video-single/?single=follow-along'>Return to Categories</a>
                                        </div>
                                    </div>
                                </div>
                                <div class='inactive' id='lesson_list-569'>
                                    <div class='list_arrow collapse lesson_incomplete'>
                                    </div>
                                    <div class='list_lessons'>
                                        <div class='lesson'>
                                            <a href='/courses/myflex/'>Return to Modules</a>
                                        </div>
                                    </div>
                                </div>
                                <div class='inactive' id='lesson_list-570'>
                                    <div class='list_arrow collapse lesson_incomplete'></div>
                                    <div class='list_lessons'>
                                        <div class='lesson '>
                                            <a href='/myflexibility-profile/'>Return to MyFLEX</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class='widget_course_return'>
                                Return to <a>'>HOME</a>
                            </div>
                        </div>
                    </div> <!-- Closing <div id='course_navigation'> -->
                </div>
            </div>
            <?php
                echo '<div class='col-lg-8' style='margin-bottom:100px'>';
                $all_lesson = $wpdb->get_results('SELECT result_data,quiz_id,result_percentage FROM <code>wp_custom_learndash</code> WHERE <code>lesson_id</code> = $lesson_id AND user_id = $userID ORDER BY <code>id</code> ASC');
            $array_type_vid = [];
            $result_percentage = [];
            $iter=0;
            foreach ($all_lesson as $key=>$value_lesson) {
                $result_percentage[$value_lesson->quiz_id] = $value_lesson->result_percentage;
                $data_vid =  json_decode($value_lesson->result_data);
                $quiz_id = $value_lesson->quiz_id;
                $dom = new DOMDocument;
                if (strpos($data_vid->data, 'class') !== false) {
                    $dom->loadHTML($data_vid->data);            
                    foreach($dom->getElementsByTagName('div') as $node){
                    $array_type_vid[$quiz_id][$iter][$node->getAttribute('class')] = $dom->saveHTML($node);
                    $iter++;
                    }
                }else{
                             $data_vid =  json_decode($value_lesson->result_data);
                             if($data_vid->data !== 0){
                        echo $data_vid->data.'<br>';
                    }
                    }
            }
    
            #generating the videos here
            foreach ($array_type_vid as $qkey => $value) {
                foreach ($value as $nkey => $item) {
                    #default follow along results
                    if (array_key_exists('follow_along',$item)){
                        echo  '<div class='ins-vid'>'.$item['follow_along'].'</div>';
                    }
                }
                #default test value
                $qkey_data = get_field( 'follow_along_video_test_default',$qkey);
                echo $qkey_data;  
                #for pike active passive test solution  
                if($qkey == 1339){
                    if($result_percentage[$qkey] >= 80){
                        echo  get_field( 'pike_more_80_follow_along',$qkey);
                    }elseif($result_percentage[$qkey] < 80){
                        echo   get_field( 'pike_less_80_follow_along',$qkey);
                    }
                }
                #for straddle extra video
                if($qkey == 1473){
                    if($result_percentage[$qkey] >= 100){
                        echo  get_field( 'straddle_over_100_follow_along',$qkey);
                    }elseif($result_percentage[$qkey] < 100){
                        echo   get_field( 'straddle_less_100_follow_along',$qkey);
                    }
                }
            }
           /* 
            if cool down is requested to add again, uncomment this one
           if($lesson_id == 1325){
                $post_12 = get_post(2287); 
                echo '<h2 class='fav'> Cool Down </h2>';
                $trim_me = $post_12->post_content;
                echo $trim_me;
            } */ 
            ?>
            </div>
    </div>
    <style type='text/css'>
        h2:not(.title){
            font-size: 20px !important;
            font-weight: 600 !important;
            padding-left: 45px !important;
        }
    </style>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • I don’t know exactly what the issue is (sorry), but I do want to point out a serious exploit in your code:
    $lesson_id = $_GET['lesson'];

    WHERE 'lesson_id' ='$lesson_id' AND

    This is vulnerable to SQL injection.

    • This reply was modified 4 years, 11 months ago by DesignSmoke.
Viewing 1 replies (of 1 total)
  • The topic ‘Page only shows half the content’ is closed to new replies.