function get_the_course_details($args = NULL)
{
    $defaults = array('course_id' => get_the_ID());
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $precourse = get_post_meta($course_id, 'vibe_pre_course', true);
    $maximum = get_post_meta($course_id, 'vibe_max_students', true);
    $badge = get_post_meta($course_id, 'vibe_course_badge', true);
    $certificate = get_post_meta($course_id, 'vibe_course_certificate', true);
    $level = vibe_get_option('level');
    if (isset($level) && $level) {
        $levels = get_the_term_list($course_id, 'level', '', ', ', '');
    }
    $course_details = array('price' => '<li>' . bp_course_get_course_credits('course_id=' . $course_id) . '</li>', 'precourse' => isset($precourse) && $precourse != '' ? '<li><i class="icon-clipboard-1"></i> ' . __('* REQUIRES', 'vibe') . ' <a href="' . get_permalink($precourse) . '">' . get_the_title($precourse) . '</a></li>' : '', 'time' => '<li><i class="icon-clock"></i>' . get_the_course_time('course_id=' . $course_id) . '</li>', 'level' => isset($level) && $level && strlen($levels) > 5 ? '<li><i class="icon-bars"></i> ' . $levels . '</li>' : '', 'seats' => isset($maximum) && is_numeric($maximum) && $maximum < 9999 ? '<li><i class="icon-users"></i> ' . $maximum . ' ' . __('SEATS', 'vibe') . '</li>' : '', 'badge' => isset($badge) && $badge && $badge != ' ' ? '<li><i class="icon-award-stroke"></i> ' . __('Course Badge', 'vibe') . '</li>' : '', 'certificate' => vibe_validate($certificate) ? '<li><i class="icon-certificate-file"></i>  ' . __('Course Certificate', 'vibe') . '</li>' : '');
    $course_details = apply_filters('wplms_course_details_widget', $course_details);
    global $post;
    $return = '<div class="course_details">
              <ul>';
    foreach ($course_details as $course_detail) {
        if (isset($course_detail) && strlen($course_detail) > 5) {
            $return .= $course_detail;
        }
    }
    $return .= '</ul>
            </div>';
    return apply_filters('wplms_course_front_details', $return);
}
function bp_course_credits($args = NULL)
{
    echo bp_course_get_course_credits($args);
}
Example #3
0
function thumbnail_generator($custom_post, $featured_style, $cols = 'medium', $n = 100, $link = 0, $zoom = 0)
{
    $return = $read_more = $class = '';
    global $post;
    $more = __('Read more', 'vibe-customtypes');
    if (strlen($custom_post->post_content) > $n) {
        $read_more = '<a href="' . get_permalink($custom_post->ID) . '" class="link">' . $more . '</a>';
    }
    $cache_duration = vibe_get_option('cache_duration');
    if (!isset($cache_duration)) {
        $cache_duration = 0;
    }
    if ($cache_duration) {
        $key = $featured_style . '_' . $custom_post->post_type . '_' . $custom_post->ID;
        if (is_user_logged_in()) {
            $user_id = get_current_user_id();
            $user_meta = get_user_meta($user_id, $custom_post->ID, true);
            if (isset($user_meta)) {
                $key .= '_' . $user_id;
            }
        }
        $result = wp_cache_get($key, 'featured_block');
    } else {
        $result = false;
    }
    if (false === $result) {
        switch ($featured_style) {
            case 'course':
                $return .= '<div class="block courseitem">';
                $return .= '<div class="block_media">';
                $return .= apply_filters('vibe_thumb_featured_image', '<a href="' . get_permalink($custom_post->ID) . '">' . featured_component($custom_post->ID, $cols) . '</a>', $featured_style);
                $return .= '</div>';
                $return .= '<div class="block_content">';
                $return .= apply_filters('vibe_thumb_heading', '<h4 class="block_title"><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style);
                $category = '';
                if (get_post_type($custom_post->ID) == 'course') {
                    $rating = get_post_meta($custom_post->ID, 'average_rating', true);
                    $rating_count = get_post_meta($custom_post->ID, 'rating_count', true);
                    $meta = '<div class="star-rating">';
                    for ($i = 1; $i <= 5; $i++) {
                        if (isset($rating)) {
                            if ($rating >= 1) {
                                $meta .= '<span class="fill"></span>';
                            } elseif ($rating < 1 && $rating > 0.4) {
                                $meta .= '<span class="half"></span>';
                            } else {
                                $meta .= '<span></span>';
                            }
                            $rating--;
                        } else {
                            $meta .= '<span></span>';
                        }
                    }
                    $meta = apply_filters('vibe_thumb_rating', $meta, $featured_style, $rating);
                    $meta .= apply_filters('vibe_thumb_reviews', '(&nbsp;' . (isset($rating_count) ? $rating_count : '0') . '&nbsp;' . __('REVIEWS', 'vibe-customtypes') . '&nbsp;)', $featured_style) . '</div>';
                    $free_course = get_post_meta($custom_post->ID, 'vibe_course_free', true);
                    $meta .= bp_course_get_course_credits(array('id' => $custom_post->ID));
                    $meta .= '<span class="clear"></span>';
                    $instructor_meta = '';
                    if (function_exists('bp_course_get_instructor')) {
                        $instructor_meta .= bp_course_get_instructor();
                    }
                    $meta .= apply_filters('vibe_thumb_instructor_meta', $instructor_meta, $featured_style);
                    $st = get_post_meta($custom_post->ID, 'vibe_students', true);
                    if (isset($st) && $st != '') {
                        $meta .= apply_filters('vibe_thumb_student_count', '<strong>' . $st . ' ' . __('Students', 'vibe-customtypes') . '</strong>');
                    }
                    $return .= $meta;
                }
                $return .= apply_filters('wplms_course_thumb_extras', '');
                // Use this filter to add Extra HTML to the course featured block
                $return .= '</div>';
                $return .= '</div>';
                break;
            case 'course2':
                $return .= '<div class="block courseitem course2">';
                $return .= '<div class="block_media">';
                $return .= apply_filters('vibe_thumb_featured_image', '<a href="' . get_permalink($custom_post->ID) . '">' . featured_component($custom_post->ID, $cols) . '</a>', $featured_style);
                $return .= '</div>';
                $return .= '<div class="block_content">';
                $return .= apply_filters('vibe_thumb_heading', '<h4 class="block_title"><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style);
                $category = '';
                if (get_post_type($custom_post->ID) == 'course') {
                    $rating = get_post_meta($custom_post->ID, 'average_rating', true);
                    $rating_count = get_post_meta($custom_post->ID, 'rating_count', true);
                    $meta = '<div class="star-rating">';
                    for ($i = 1; $i <= 5; $i++) {
                        if (isset($rating)) {
                            if ($rating >= 1) {
                                $meta .= '<span class="fill"></span>';
                            } elseif ($rating < 1 && $rating > 0.4) {
                                $meta .= '<span class="half"></span>';
                            } else {
                                $meta .= '<span></span>';
                            }
                            $rating--;
                        } else {
                            $meta .= '<span></span>';
                        }
                    }
                    $meta = apply_filters('vibe_thumb_rating', $meta, $featured_style, $rating);
                    $meta .= apply_filters('vibe_thumb_reviews', '(&nbsp;' . (isset($rating_count) ? $rating_count : '0') . '&nbsp;' . __('REVIEWS', 'vibe-customtypes') . '&nbsp;)', $featured_style) . '</div>';
                    $free_course = get_post_meta($custom_post->ID, 'vibe_course_free', true);
                    $st = get_post_meta($custom_post->ID, 'vibe_students', true);
                    if (isset($st) && $st != '') {
                        $meta .= apply_filters('vibe_thumb_student_count', '<strong><i class="icon-users"></i>&nbsp;' . $st . '</strong>');
                    }
                    $meta .= '<span class="clear"></span>';
                    $instructor_meta = '';
                    if (function_exists('bp_course_get_instructor')) {
                        $instructor_meta .= bp_course_get_instructor();
                    }
                    $meta .= apply_filters('vibe_thumb_instructor_meta', $instructor_meta, $featured_style);
                    $meta .= bp_course_get_course_credits(array('id' => $custom_post->ID));
                    $return .= $meta;
                }
                $return .= apply_filters('wplms_course_thumb_extras', '');
                // Use this filter to add Extra HTML to the course featured block
                $return .= '</div>';
                $return .= '</div>';
                break;
            case 'side':
                $return .= '<div class="block side">';
                $return .= '<div class="block_media">';
                if (isset($link) && $link) {
                    $return .= '<span class="overlay"></span>';
                }
                if (isset($link) && $link) {
                    $return .= '<a href="' . get_permalink($custom_post->ID) . '" class="hover-link hyperlink"><i class="icon-hyperlink"></i></a>';
                }
                $featured = getPostMeta($custom_post->ID, 'vibe_select_featured');
                if (isset($zoom) && $zoom && has_post_thumbnail($custom_post->ID)) {
                    $return .= '<a href="' . wp_get_attachment_url(get_post_thumbnail_id($custom_post->ID), $cols) . '" class="hover-link pop"><i class="icon-arrows-out"></i></a>';
                }
                $return .= apply_filters('vibe_thumb_featured_image', featured_component($custom_post->ID, $cols), $featured_style);
                $category = '';
                if (get_post_type($custom_post->ID) == 'post') {
                    $cats = get_the_category();
                    if (is_array($cats)) {
                        foreach ($cats as $cat) {
                            $category .= '<a href="' . get_category_link($cat->term_id) . '">' . $cat->cat_name . '</a> ';
                        }
                    }
                }
                $return .= '</div>';
                $category = '';
                if (get_post_type($custom_post->ID) == 'post') {
                    $cats = get_the_category();
                    if (is_array($cats)) {
                        foreach ($cats as $cat) {
                            $category .= '<a href="' . get_category_link($cat->term_id) . '">' . $cat->cat_name . '</a> ';
                        }
                    }
                }
                $return .= '<div class="block_content">';
                $return .= apply_filters('vibe_thumb_heading', '<h4 class="block_title"><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style);
                $return .= apply_filters('vibe_thumb_date', '<div class="date"><small>' . get_the_time('F d,Y') . '' . (strlen($category) > 2 ? ' / ' . $category : '') . ' / ' . get_comments_number('0', '1', '%') . ' ' . __(' Comments', 'vibe-customtypes') . '</small></div>', $featured_style);
                $return .= apply_filters('vibe_thumb_desc', '<p class="block_desc">' . custom_excerpt($n, $custom_post->ID) . '</p>', $featured_style);
                $return .= '</div>';
                $return .= '</div>';
                break;
            case 'images_only':
                $return .= '<div class="block">';
                $return .= '<div class="block_media images_only">';
                if (isset($link) && $link) {
                    $return .= '<span class="overlay"></span>';
                }
                if (isset($link) && $link) {
                    $return .= '<a href="' . get_permalink($custom_post->ID) . '" class="hover-link hyperlink"><i class="icon-hyperlink"></i></a>';
                }
                if (isset($zoom) && has_post_thumbnail($custom_post->ID) && $zoom) {
                    $return .= '<a href="' . wp_get_attachment_url(get_post_thumbnail_id($custom_post->ID), $cols) . '" class="hover-link pop"><i class="icon-arrows-out"></i></a>';
                }
                $return .= apply_filters('vibe_thumb_featured_image', featured_component($custom_post->ID, $cols), $featured_style);
                $return .= '</div>';
                $return .= '</div>';
                break;
            case 'testimonial':
                $return .= '<div class="block testimonials">';
                $author = getPostMeta($custom_post->ID, 'vibe_testimonial_author_name');
                $designation = getPostMeta($custom_post->ID, 'vibe_testimonial_author_designation');
                if (has_post_thumbnail($custom_post->ID)) {
                    $image = get_the_post_thumbnail($custom_post->ID, 'full');
                } else {
                    $image = get_avatar('*****@*****.**', 96);
                }
                $return .= '<div class="testimonial_item style2 clearfix">
                                    <div class="testimonial-content">    
                                        <p>' . custom_excerpt($n, $custom_post->ID) . ($n < strlen($custom_post->post_content) ? $read_more : '') . '</p>
                                       <div class="author">
                                          ' . $image . '  
                                          <h4>' . html_entity_decode($author) . '</h4>
                                          <small>' . html_entity_decode($designation) . '</small>
                                        </div>     
                                    </div>        
                                    
                                </div>';
                $return .= '</div>';
                break;
            case 'blogpost':
                $return .= '<div class="block blogpost">';
                $return .= '<div class="blog-item">
                                ' . apply_filters('vibe_thumb_date', '<div class="blog-item-date">
                                    <span class="day">' . get_the_time('d') . '</span>
                                    <p class="month">' . get_the_time('M') . '\'' . get_the_time('y') . '</p>
                                </div>', $featured_style) . '
                                ' . apply_filters('vibe_thumb_heading', '<h4><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style) . '
                                <p>' . apply_filters('vibe_thumb_desc', custom_excerpt($n, $custom_post->ID), $featured_style) . '</p>
                                </div>';
                $return .= '</div>';
                break;
            case 'event_card':
                $return .= '<div class="event_card">';
                $icon_class = get_post_meta($custom_post->ID, 'vibe_icon', true);
                $color = get_post_meta($custom_post->ID, 'vibe_color', true);
                $start_date = get_post_meta($custom_post->ID, 'vibe_start_date', true);
                $end_date = get_post_meta($custom_post->ID, 'vibe_end_date', true);
                $start_time = get_post_meta($custom_post->ID, 'vibe_start_time', true);
                $end_time = get_post_meta($custom_post->ID, 'vibe_end_time', true);
                $show_location = get_post_meta($custom_post->ID, 'vibe_show_location', true);
                $all_day = get_post_meta($custom_post->ID, 'vibe_all_day', true);
                $location = vibe_sanitize(get_post_meta($custom_post->ID, 'vibe_location', false));
                $repeatable = get_post_meta($custom_post->ID, 'vibe_repeatable', true);
                $repeat_value = get_post_meta($custom_post->ID, 'vibe_repeat_value', true);
                $repeat_unit = get_post_meta($custom_post->ID, 'vibe_repeat_unit', true);
                $repeat_count = get_post_meta($custom_post->ID, 'vibe_repeat_count', true);
                $return .= ' <span class="event_icon" style="color:' . $color . '"><i class="' . $icon_class . '"></i></span>
                        <h4 style="background:' . $color . '"><i class="' . $icon_class . '"></i> ' . __('Event ', 'vibe-customtypes') . '</label><span><a href="' . get_permalink($custom_post->ID) . '">' . get_the_title($custom_post->ID) . '</a></span></h4>
                        <ul>
                        ';
                if (isset($start_date) && $start_date != '') {
                    $return .= '<li><label><i class="icon-calendar"></i> ' . __('Start Date ', 'vibe-customtypes') . '</label><span>' . date('F j Y', strtotime($start_date)) . '</span></li>';
                }
                if (isset($end_date) && $end_date != '') {
                    $return .= '<li><label><i class="icon-calendar"></i> ' . __('End Date ', 'vibe-customtypes') . '</label><span>' . date('F j Y', strtotime($end_date)) . '</span>';
                }
                if (isset($start_time) && $start_time != '') {
                    $return .= '<li><label><i class="icon-clock"></i> ' . __('Start Time ', 'vibe-customtypes') . '</label><span>' . $start_time . '</span>';
                }
                if (isset($end_time) && $end_time != '') {
                    $return .= '<li><label><i class="icon-clock"></i> ' . __('End Time ', 'vibe-customtypes') . '</label><span>' . $end_time . '</span>';
                }
                if (vibe_validate($all_day)) {
                    $return .= '<li><label><i class="icon-circle-full"></i> ' . __('All Day ', 'vibe-customtypes') . '</label><span>' . __('Yes', 'vibe-customtypes') . '</span>';
                }
                if (vibe_validate($repeatable)) {
                    $return .= '<li><label><i class="icon-flash"></i> ' . __('Frequency ', 'vibe-customtypes') . '</label><span>' . __('Every ', 'vibe-customtypes') . (isset($repeat_value) && $repeat_value > 1 ? $repeat_value : '') . ' ' . $repeat_unit . ' ' . __('for ', 'vibe-customtypes') . $repeat_count . ' ' . $repeat_unit . '</span>';
                }
                if (vibe_validate($show_location)) {
                    $return .= '<li><label><i class="icon-pin-alt"></i> ' . __('Venue ', 'vibe-customtypes') . '</label><span>' . (isset($location['staddress']) ? $location['staddress'] : '') . (isset($location['city']) ? ', ' . $location['city'] : '') . (isset($location['state']) ? ', ' . $location['state'] : '') . (isset($location['country']) ? ', ' . $location['country'] : '') . (isset($location['pincode']) ? ' - ' . $location['pincode'] : '') . '</span>';
                }
                $return .= '</ul>
                        <a href="' . get_permalink($custom_post->ID) . '" class="event_full_details tip" title="' . __('View full details', 'vibe-customtypes') . '" style="background:' . $color . '"><i class="icon-plus-1"></i></a>
                    </div>';
                break;
            default:
                $return .= '<div class="block">';
                $return .= '<div class="block_media">';
                if (isset($link) && $link) {
                    $return .= '<a href="' . get_permalink($custom_post->ID) . '" class="hover-link hyperlink"><i class="icon-hyperlink"></i></a>';
                }
                $featured = getPostMeta($custom_post->ID, 'vibe_select_featured');
                if (isset($zoom) && $zoom && has_post_thumbnail($custom_post->ID)) {
                    $return .= '<a href="' . wp_get_attachment_url(get_post_thumbnail_id($custom_post->ID), $cols) . '" class="hover-link pop"><i class="icon-arrows-out"></i></a>';
                }
                $return .= featured_component($custom_post->ID, $cols);
                $category = '';
                if (get_post_type($custom_post->ID) == 'post') {
                    $cats = get_the_category();
                    if (is_array($cats)) {
                        foreach ($cats as $cat) {
                            $category .= '<a href="' . get_category_link($cat->term_id) . '">' . $cat->cat_name . '</a> ';
                        }
                    }
                }
                $return .= '</div>';
                $category = '';
                if (get_post_type($custom_post->ID) == 'post') {
                    $cats = get_the_category();
                    if (is_array($cats)) {
                        foreach ($cats as $cat) {
                            $category .= '<a href="' . get_category_link($cat->term_id) . '">' . $cat->cat_name . '</a> ';
                        }
                    }
                }
                if (get_post_type($custom_post->ID) == 'portfolio') {
                    $cats = get_the_category();
                    if (is_array($cats)) {
                        $category .= '<div class="categories">';
                        if (!is_wp_error(get_the_term_list($custom_post->ID, 'portfolio-type', ' ', ' ', ''))) {
                            $category .= get_the_term_list($custom_post->ID, 'portfolio-type', ' ', ' ', '');
                        }
                        $category .= '</div>';
                    }
                }
                $return .= '<div class="block_content">';
                $return .= apply_filters('vibe_thumb_heading', '<h4 class="block_title"><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style);
                $return .= apply_filters('vibe_thumb_date', '<div class="date"><small>' . get_the_time('F d,Y') . '' . (strlen($category) > 2 ? ' / ' . $category : '') . ' / ' . get_comments_number('0', '1', '%') . ' ' . __('Comments', 'vibe-customtypes') . '</small></div>', $featured_style);
                $return .= apply_filters('vibe_thumb_desc', '<p class="block_desc">' . custom_excerpt($n, $custom_post->ID) . '</p>', $featured_style);
                $return .= '</div>';
                $return .= '</div>';
                break;
        }
        if ($cache_duration) {
            wp_cache_set($course_key, $result, 'featured_block', $cache_duration);
        }
    }
    //end If
    return apply_filters('vibe_featured_thumbnail_style', $return, $custom_post, $featured_style);
}
Example #4
0
function nuthanhtoan()
{
    global $post;
    if (isset($id) && $id) {
        $course_id = $id;
    } else {
        $course_id = get_the_ID();
    }
    // Free Course
    $free_course = get_post_meta($course_id, 'vibe_course_free', true);
    if (!is_user_logged_in() && vibe_validate($free_course)) {
        echo apply_filters('wplms_course_non_loggedin_user', '<a href="#" class="unlogin course_button button full">' . __('TAKE THIS COURSE', 'vibe') . '</a>');
        return;
    }
    $take_course_page_id = vibe_get_option('take_course_page');
    if (function_exists('icl_object_id')) {
        $take_course_page_id = icl_object_id($take_course_page_id, 'page', true);
    }
    $take_course_page = get_permalink($take_course_page_id);
    $user_id = get_current_user_id();
    do_action('wplms_the_course_button', $course_id, $user_id);
    $coursetaken = get_user_meta($user_id, $course_id, true);
    if (isset($free_course) && $free_course && $free_course != 'H' && is_user_logged_in() && (!isset($coursetaken) || !is_numeric($coursetaken))) {
        $duration = get_post_meta($course_id, 'vibe_duration', true);
        $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
        $new_duration = time() + $course_duration_parameter * $duration;
        //parameter 86400
        $new_duration = apply_filters('wplms_free_course_check', $new_duration);
        update_user_meta($user_id, $course_id, $new_duration);
        bp_course_update_user_course_status($user_id, $course_id, 0);
        $group_id = get_post_meta($course_id, 'vibe_group', true);
        if (isset($group_id) && $group_id != '') {
            groups_join_group($group_id, $user_id);
        }
        $coursetaken = $new_duration;
    }
    if (isset($coursetaken) && $coursetaken && is_user_logged_in()) {
        // COURSE IS TAKEN & USER IS LOGGED IN
        if ($coursetaken) {
            // COURSE ACTIVE
            $course_user = bp_course_get_user_course_status($user_id, $course_id);
            // Validates that a user has taken this course
            $new_course_user = get_user_meta($user_id, 'course_status' . $course_id, true);
            // Remove this line in 1.8.5
            if (isset($course_user) && is_numeric($course_user) || isset($free_course) && $free_course && $free_course != 'H' && is_user_logged_in()) {
                // COURSE PURCHASED SECONDARY VALIDATION
                echo '<form action="' . apply_filters('wplms_take_course_page', $take_course_page, $course_id) . '" method="post">';
                if (isset($new_course_user) && is_numeric($new_course_user) && $new_course_user) {
                    // For Older versions
                    switch ($course_user) {
                        case 1:
                            echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('START COURSE', 'vibe') . '">';
                            wp_nonce_field('start_course' . $user_id, 'start_course');
                            break;
                        case 2:
                            echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('HỌC TIẾP', 'vibe') . '">';
                            wp_nonce_field('continue_course' . $user_id, 'continue_course');
                            break;
                        case 3:
                            echo '<a href="#" class="full button">' . __('COURSE UNDER EVALUATION', 'vibe') . '</a>';
                            break;
                        case 4:
                            $finished_course_access = vibe_get_option('finished_course_access');
                            if (isset($finished_course_access) && $finished_course_access) {
                                echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('HOÀN THÀNH', 'vibe') . '">';
                                wp_nonce_field('continue_course' . $user_id, 'continue_course');
                            } else {
                                echo '<a href="#" class="full button">' . __('HOÀN THÀNH', 'vibe') . '</a>';
                            }
                            break;
                        default:
                            $course_button_html = '<a class="course_button button">' . __('COURSE ENABLED', 'vibe') . '<span>' . __('CONTACT ADMIN TO ENABLE', 'vibe') . '</span></a>';
                            echo apply_filters('wplms_default_course_button', $course_button_html, $user_id, $course_id, $course_user);
                            break;
                    }
                } else {
                    switch ($course_user) {
                        case 0:
                            echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('START COURSE', 'vibe') . '">';
                            wp_nonce_field('start_course' . $user_id, 'start_course');
                            break;
                        case 1:
                            echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('HỌC TIẾP', 'vibe') . '">';
                            wp_nonce_field('continue_course' . $user_id, 'continue_course');
                            break;
                        case 2:
                            echo '<a href="#" class="full button">' . __('COURSE UNDER EVALUATION', 'vibe') . '</a>';
                            break;
                        default:
                            $finished_course_access = vibe_get_option('finished_course_access');
                            if (isset($finished_course_access) && $finished_course_access) {
                                echo '<input type="submit" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button" value="' . __('HOÀN THÀNH', 'vibe') . '">';
                                wp_nonce_field('continue_course' . $user_id, 'continue_course');
                            } else {
                                echo '<a href="#" class="full button">' . __('COURSE FINISHED', 'vibe') . '</a>';
                            }
                            break;
                    }
                }
                echo '<input type="hidden" name="course_id" value="' . $course_id . '" />';
                echo '</form>';
            } else {
                $pid = get_post_meta($course_id, 'vibe_product', true);
                // SOME ISSUE IN PROCESS BUT STILL DISPLAYING THIS FOR NO REASON.
                echo '<a href="' . get_permalink($pid) . '" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button">' . __('COURSE ENABLED', 'vibe') . '<span>' . __('CONTACT ADMIN TO ENABLE', 'vibe') . '</span></a>';
            }
        } else {
            $pid = get_post_meta($course_id, 'vibe_product', true);
            $pid = apply_filters('wplms_course_product_id', $pid, $course_id, -1);
            // $id checks for Single Course page or Course page in the my courses section
            if (is_numeric($pid)) {
                $pid = get_permalink($pid);
            }
            echo '<a href="' . $pid . '" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button">' . __('Course Expired', 'vibe') . '&nbsp;<span>' . __('Click to renew', 'vibe') . '</span></a>';
        }
    } else {
        $pid = get_post_meta($course_id, 'vibe_product', true);
        $pid = apply_filters('wplms_course_product_id', $pid, $course_id, 0);
        if (is_numeric($pid)) {
            $pid = get_permalink($pid);
            $check = vibe_get_option('direct_checkout');
            $check = intval($check);
            if (isset($check) && $check) {
                $pid .= '?redirect';
            }
        }
        $extra = '';
        if (isset($pid) && $pid) {
            if (is_user_logged_in()) {
                if (get_post_meta($course_id, 'vibe_coming_soon', true) == 'S') {
                    echo '<a href="#" class="full button hienthikhoahoccomingsoon">' . __('COMING SOON', 'vibe') . '</a></br>';
                    echo '<div class="khoahoccomingsoon anpopupthongtinkhoahoc">';
                    echo '<span>Khóa học đang trong thời gian hoàn thiện, mong các bạn thông cảm</span>';
                    echo '</br>';
                    echo '<span  class="button dongkhoahoccomingsoon">' . __('ĐÓNG', 'vibe') . '</span>';
                    echo '</div>';
                } else {
                    echo '<a href="#" class="full button hienxacnhandangkykhoahoc">' . __('TAKE THIS COURSE', 'vibe') . '</a></br>';
                }
                //echo '<a href="#" class="full button hienxacnhandangkykhoahoc">'.__('TAKE THIS COURSE','vibe').'</a></br>';
                echo '<div class="xacnhandangkykhoahoc anpopupthongtinkhoahoc">';
                echo '<span>Nhấn vào nút "đồng ý" để ghi danh khóa học : ' . get_the_title($course_id) . '</span>';
                echo '</br>';
                echo '<span>Giá tiền khóa học là: ' . bp_course_get_course_credits('course_id=' . $course_id) . '</span></br>';
                echo '<div class="sapxepnutdangkykhoahoc">';
                echo '<a href="' . get_home_url() . '/thanh-toan-khoa-hoc/?course_id=' . $course_id . '" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button">' . __('Đồng ý', 'vibe') . apply_filters('wplms_course_button_extra', $extra, $course_id) . '</a>';
                echo '<span  class="full button huydangkykhoahoc">' . __('Hủy bỏ', 'vibe') . '</span>';
                echo '</div>';
                echo '<form action="' . apply_filters('wplms_take_course_page', $take_course_page, $course_id) . '" method="post" style="display: none" id="vaotranghockhoahoc">';
                wp_nonce_field('start_course' . $user_id, 'start_course');
                echo '<input type="hidden" name="course_id" value="' . $course_id . '" />';
                echo '</form>';
                echo '</div>';
            } else {
                //echo '<a href="#" class="unlogin '.((isset($id) && $id )?'':'course_button full ').'button">'.__('TAKE THIS COURSE','vibe').'</a>';
                if (get_post_meta($course_id, 'vibe_coming_soon', true) == 'S') {
                    echo '<a href="#" class="full button hienthikhoahoccomingsoon">' . __('COMING SOON', 'vibe') . '</a></br>';
                    echo '<div class="khoahoccomingsoon anpopupthongtinkhoahoc">';
                    echo '<span>Khóa học đang trong thời gian hoàn thiện, mong các bạn thông cảm</span>';
                    echo '</br>';
                    echo '<span  class="button dongkhoahoccomingsoon">' . __('ĐÓNG', 'vibe') . '</span>';
                    echo '</div>';
                } else {
                    echo '<a href="#" class="unlogin ' . (isset($id) && $id ? '' : 'course_button full ') . 'button">' . __('TAKE THIS COURSE', 'vibe') . '</a>';
                }
            }
        } else {
            echo '<a href="' . apply_filters('wplms_private_course_button', '#') . '" class="' . (isset($id) && $id ? '' : 'course_button full ') . 'button">' . apply_filters('wplms_private_course_button_label', __('PRIVATE COURSE', 'vibe')) . '</a>';
        }
    }
}
Example #5
0
    function custom_vibe_featured_thumbnail_style($thumbnail_html, $post, $style)
    {
        if ($style == 'modern1') {
            $thumbnail_html = '';
            $thumbnail_html .= '<div class="block modern_course"  data-id="' . $post->ID . '">';
            $thumbnail_html .= '<div class="block_media">';
            $thumbnail_html .= '<a href="' . get_permalink($post->ID) . '">' . featured_component($post->ID, 'medium') . '</a>';
            $thumbnail_html .= '</div>';
            $thumbnail_html .= '<div class="block_content">';
            $thumbnail_html .= '<h4 class="block_title"><a href="' . get_permalink($post->ID) . '" title="' . $post->post_title . '">' . $post->post_title . '</a></h4>';
            $thumbnail_html .= '<div class="course_price">' . bp_course_get_course_credits() . '</div>';
            $thumbnail_html .= '<a href="' . bp_core_get_user_domain($post->post_author) . '" class="modern_course_instructor" 
	        title="' . sprintf(__('Course Author %s', 'wplms_modern'), bp_core_get_user_displayname($post->post_author)) . '">' . bp_core_fetch_avatar(array('item_id' => $post->post_author, 'type' => 'thumb', 'width' => 64, 'height' => 64)) . '</a>';
            $thumbnail_html .= '<div class="course_meta">';
            $reviews = get_post_meta(get_the_ID(), 'average_rating', true);
            $students = get_post_meta(get_the_ID(), 'vibe_students', true);
            $thumbnail_html .= '<span class="dashicons dashicons-groups">' . $students . '</span> ';
            $thumbnail_html .= '<div class="modern-star-rating">';
            for ($i = 1; $i <= 5; $i++) {
                if ($reviews >= 1) {
                    $thumbnail_html .= '<span class="dashicons dashicons-star-filled"></span>';
                } elseif ($reviews < 1 && $reviews >= 0.4) {
                    $thumbnail_html .= '<span class="dashicons dashicons-star-half"></span>';
                } else {
                    $thumbnail_html .= '<span class="dashicons dashicons-star-empty"></span>';
                }
                $reviews--;
            }
            $thumbnail_html .= '</div></div>';
            $thumbnail_html .= '</div></div>';
        }
        return $thumbnail_html;
    }