course-filter
5 years ago
dashboard
5 years ago
email
5 years ago
global
5 years ago
loop
5 years ago
profile
5 years ago
shortcode
5 years ago
single
5 years ago
template-part
5 years ago
widget
5 years ago
archive-course-init.php
5 years ago
archive-course.php
5 years ago
course-none.php
5 years ago
dashboard.php
5 years ago
instructor-setting.php
5 years ago
login.php
5 years ago
public-profile-setting.php
5 years ago
single-assignment.php
5 years ago
single-course-enrolled-announcements.php
5 years ago
single-course-enrolled-overview.php
5 years ago
single-course-enrolled-questions.php
5 years ago
single-course-enrolled-subpage.php
5 years ago
single-course-enrolled.php
5 years ago
single-course-instructor.php
5 years ago
single-course.php
5 years ago
single-lesson.php
5 years ago
single-preview-lesson.php
5 years ago
single-quiz.php
5 years ago
student-public-profile.php
5 years ago
template.php
5 years ago
student-public-profile.php
191 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for displaying student & instructor Public Profile. |
| 4 | * It is used for both of instructor and student. Separate file has not been introduced due to complicacy and backward compatibility. -JK |
| 5 | * |
| 6 | * @since v.1.0.0 |
| 7 | * |
| 8 | * @author Themeum |
| 9 | * @url https://themeum.com |
| 10 | * |
| 11 | * @package TutorLMS/Templates |
| 12 | * @version 1.4.3 |
| 13 | */ |
| 14 | |
| 15 | $user_name = sanitize_text_field(get_query_var('tutor_student_username')); |
| 16 | $get_user = tutor_utils()->get_user_by_login($user_name); |
| 17 | |
| 18 | if(!is_object($get_user) || !property_exists($get_user, 'ID')){ |
| 19 | wp_redirect(get_home_url().'/404'); |
| 20 | exit; |
| 21 | } |
| 22 | |
| 23 | $user_id = $get_user->ID; |
| 24 | $is_instructor = tutor_utils()->is_instructor($user_id); |
| 25 | |
| 26 | $profile_layout = tutor_utils()->get_option(($is_instructor ? 'instructor' : 'student').'_public_profile_layout', 'pp-circle'); |
| 27 | !$is_instructor ? $profile_layout='pp-circle' : 0; // For now |
| 28 | |
| 29 | $tutor_user_social_icons = tutor_utils()->tutor_user_social_icons(); |
| 30 | |
| 31 | foreach ($tutor_user_social_icons as $key => $social_icon){ |
| 32 | $url = get_user_meta($user_id, $key, true); |
| 33 | $tutor_user_social_icons[$key]['url']=$url; |
| 34 | } |
| 35 | |
| 36 | get_header(); |
| 37 | ?> |
| 38 | |
| 39 | <?php |
| 40 | // Rating content |
| 41 | ob_start(); |
| 42 | if($is_instructor){ |
| 43 | $instructor_rating = tutor_utils()->get_instructor_ratings($user_id); |
| 44 | ?> |
| 45 | <div class="tutor-rating-container"> |
| 46 | <div class="ratings"> |
| 47 | <span class="rating-generated"> |
| 48 | <?php tutor_utils()->star_rating_generator($instructor_rating->rating_avg); ?> |
| 49 | </span> |
| 50 | |
| 51 | <?php |
| 52 | echo " <span class='rating-digits'>{$instructor_rating->rating_avg}</span> "; |
| 53 | echo " <span class='rating-total-meta'>({$instructor_rating->rating_count})</span> "; |
| 54 | ?> |
| 55 | </div> |
| 56 | </div> |
| 57 | <?php |
| 58 | } |
| 59 | $rating_content=ob_get_clean(); |
| 60 | |
| 61 | |
| 62 | // Social media content |
| 63 | ob_start(); |
| 64 | foreach ($tutor_user_social_icons as $key => $social_icon){ |
| 65 | $url = $social_icon['url']; |
| 66 | echo !empty($url) ? '<a href="'.$url.'" target="_blank" rel="noopener noreferrer nofollow" class="'.$social_icon['icon_classes'].'" title="'.$social_icon['label'].'"></a>' : ''; |
| 67 | } |
| 68 | $social_media=ob_get_clean(); |
| 69 | ?> |
| 70 | |
| 71 | <?php do_action('tutor_student/before/wrap'); ?> |
| 72 | |
| 73 | <div <?php tutor_post_class('tutor-full-width-student-profile tutor-page-wrap tutor-user-public-profile tutor-user-public-profile-'.$profile_layout); ?>> |
| 74 | <div class="tutor-container photo-area"> |
| 75 | <div class="cover-area"> |
| 76 | <div style="background-image:url(<?php echo tutor_utils()->get_cover_photo_url($user_id); ?>)"></div> |
| 77 | <div></div> |
| 78 | </div> |
| 79 | <div class="pp-area"> |
| 80 | <div class="profile-pic" style="background-image:url(<?php echo get_avatar_url($user_id, array('size' => 150)); ?>)"></div> |
| 81 | |
| 82 | <div class="profile-name"> |
| 83 | <div class="profile-rating-media content-for-mobile"> |
| 84 | <?php echo $rating_content; ?> |
| 85 | <div class="tutor-social-container content-for-desktop"> |
| 86 | <?php echo $social_media; ?> |
| 87 | </div> |
| 88 | </div> |
| 89 | |
| 90 | <h3><?php echo $get_user->display_name; ?></h3> |
| 91 | <?php |
| 92 | if($is_instructor){ |
| 93 | $course_count = tutor_utils()->get_course_count_by_instructor($user_id); |
| 94 | $student_count = tutor_utils()->get_total_students_by_instructor($user_id); |
| 95 | ?> |
| 96 | <span> |
| 97 | <span><?php echo $course_count; ?></span> |
| 98 | <?php $course_count>1 ? _e('Courses', 'tutor') : _e('Course', 'tutor'); ?> |
| 99 | </span> |
| 100 | <span><span>•</span></span> |
| 101 | <span> |
| 102 | <span><?php echo $student_count;?></span> |
| 103 | <?php $student_count>1 ? _e('Students', 'tutor') : _e('Student', 'tutor'); ?> |
| 104 | </span> |
| 105 | <?php |
| 106 | } |
| 107 | else{ |
| 108 | $enrolled_course = tutor_utils()->get_enrolled_courses_by_user($user_id); |
| 109 | $enrol_count = is_object($enrolled_course) ? $enrolled_course->found_posts : 0; |
| 110 | |
| 111 | $complete_count = tutor_utils()->get_completed_courses_ids_by_user($user_id); |
| 112 | $complete_count = $complete_count ? count($complete_count) : 0; |
| 113 | ?> |
| 114 | <span> |
| 115 | <span><?php echo $enrol_count; ?></span> |
| 116 | <?php $enrol_count>1 ? _e('Courses Enrolled', 'tutor') : _e('Course Enrolled', 'tutor'); ?> |
| 117 | </span> |
| 118 | <span><span>•</span></span> |
| 119 | <span> |
| 120 | <span><?php echo $complete_count; ?></span> |
| 121 | <?php $complete_count>1 ? _e('Courses Completed', 'tutor') : _e('Course Completed', 'tutor'); ?> |
| 122 | </span> |
| 123 | <?php |
| 124 | } |
| 125 | ?> |
| 126 | </div> |
| 127 | |
| 128 | <div class="tutor-social-container content-for-mobile"> |
| 129 | <?php echo $social_media; ?> |
| 130 | </div> |
| 131 | |
| 132 | <div class="profile-rating-media content-for-desktop"> |
| 133 | <?php echo $rating_content; ?> |
| 134 | <div class="tutor-social-container content-for-desktop"> |
| 135 | <?php |
| 136 | foreach ($tutor_user_social_icons as $key => $social_icon){ |
| 137 | $url = $social_icon['url']; |
| 138 | echo !empty($url) ? '<a href="'.$url.'" target="_blank" rel="noopener noreferrer nofollow" class="'.$social_icon['icon_classes'].'" title="'.$social_icon['label'].'"></a>' : ''; |
| 139 | } |
| 140 | ?> |
| 141 | </div> |
| 142 | </div> |
| 143 | </div> |
| 144 | </div> |
| 145 | |
| 146 | |
| 147 | <div class="tutor-container" style="overflow:auto"> |
| 148 | <div class="tutor-user-profile-sidebar"> |
| 149 | <?php // tutor_load_template('profile.badge', ['profile_badges'=>(new )]); ?> |
| 150 | </div> |
| 151 | <div class="tutor-user-profile-content"> |
| 152 | |
| 153 | <h3><?php _e('Biography', 'tutor'); ?></h3> |
| 154 | <?php tutor_load_template('profile.bio'); ?> |
| 155 | |
| 156 | <?php |
| 157 | if($is_instructor){ |
| 158 | ?> |
| 159 | <h3><?php _e('Courses', 'tutor'); ?></h3> |
| 160 | <?php |
| 161 | add_filter('courses_col_per_row', function(){ |
| 162 | return 3; |
| 163 | }); |
| 164 | |
| 165 | tutor_load_template('profile.courses_taken'); |
| 166 | ?> |
| 167 | |
| 168 | <?php |
| 169 | /* if(tutor_utils()->get_option('show_courses_completed_by_student')){ |
| 170 | echo '<h3>',__('Course Completed', 'tutor'),'</h3>'; |
| 171 | tutor_load_template('profile.enrolled_course'); |
| 172 | } */ |
| 173 | ?> |
| 174 | |
| 175 | <?php |
| 176 | /* if(tutor_utils()->get_option('students_own_review_show_at_profile')){ |
| 177 | echo '<h3>',__('Reviews Wrote', 'tutor'),'</h3>'; |
| 178 | tutor_load_template('profile.reviews_wrote'); |
| 179 | } */ |
| 180 | ?> |
| 181 | <?php |
| 182 | } |
| 183 | ?> |
| 184 | </div> |
| 185 | </div> |
| 186 | </div> |
| 187 | <?php do_action('tutor_student/after/wrap'); ?> |
| 188 | |
| 189 | <?php |
| 190 | get_footer(); |
| 191 |