course-filter
4 years ago
dashboard
4 years ago
email
4 years ago
global
4 years ago
loop
4 years ago
profile
4 years ago
shortcode
4 years ago
single
4 years ago
template-part
4 years ago
widget
4 years ago
archive-course-init.php
5 years ago
archive-course.php
4 years ago
course-none.php
5 years ago
dashboard.php
4 years ago
feature_disabled.php
4 years ago
instructor-setting.php
4 years ago
login.php
4 years ago
permission-denied.php
4 years ago
public-profile-setting.php
4 years ago
single-assignment.php
4 years ago
single-course-enrolled-announcements.php
4 years ago
single-course-enrolled-overview.php
4 years ago
single-course-enrolled-questions.php
4 years ago
single-course-enrolled-subpage.php
4 years ago
single-course-enrolled.php
4 years ago
single-course-instructor.php
4 years ago
single-course.php
4 years ago
single-lesson.php
4 years ago
single-preview-lesson.php
4 years ago
single-quiz.php
4 years ago
student-public-profile.php
4 years ago
template.php
4 years ago
student-public-profile.php
195 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 | tutor_utils()->tutor_custom_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="' . esc_url( $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 esc_url( 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 esc_url( 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 | } else { |
| 107 | $enrolled_course = tutor_utils()->get_enrolled_courses_by_user( $user_id ); |
| 108 | $enrol_count = is_object( $enrolled_course ) ? $enrolled_course->found_posts : 0; |
| 109 | |
| 110 | $complete_count = tutor_utils()->get_completed_courses_ids_by_user( $user_id ); |
| 111 | $complete_count = $complete_count ? count( $complete_count ) : 0; |
| 112 | ?> |
| 113 | <span> |
| 114 | <span><?php echo $enrol_count; ?></span> |
| 115 | <?php $enrol_count > 1 ? _e( 'Courses Enrolled', 'tutor' ) : _e( 'Course Enrolled', 'tutor' ); ?> |
| 116 | </span> |
| 117 | <span><span>•</span></span> |
| 118 | <span> |
| 119 | <span><?php echo $complete_count; ?></span> |
| 120 | <?php $complete_count > 1 ? _e( 'Courses Completed', 'tutor' ) : _e( 'Course Completed', 'tutor' ); ?> |
| 121 | </span> |
| 122 | <?php |
| 123 | } |
| 124 | ?> |
| 125 | </div> |
| 126 | |
| 127 | <div class="tutor-social-container content-for-mobile"> |
| 128 | <?php echo $social_media; ?> |
| 129 | </div> |
| 130 | |
| 131 | <div class="profile-rating-media content-for-desktop"> |
| 132 | <?php echo $rating_content; ?> |
| 133 | <div class="tutor-social-container content-for-desktop"> |
| 134 | <?php |
| 135 | foreach ( $tutor_user_social_icons as $key => $social_icon ) { |
| 136 | $url = $social_icon['url']; |
| 137 | echo ! empty( $url ) ? '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer nofollow" class="' . $social_icon['icon_classes'] . '" title="' . $social_icon['label'] . '"></a>' : ''; |
| 138 | } |
| 139 | ?> |
| 140 | </div> |
| 141 | </div> |
| 142 | </div> |
| 143 | </div> |
| 144 | |
| 145 | |
| 146 | <div class="tutor-container" style="overflow:auto"> |
| 147 | <div class="tutor-user-profile-sidebar"> |
| 148 | <?php // tutor_load_template('profile.badge', ['profile_badges'=>(new )]); ?> |
| 149 | </div> |
| 150 | <div class="tutor-user-profile-content"> |
| 151 | |
| 152 | <h3><?php _e( 'Biography', 'tutor' ); ?></h3> |
| 153 | <?php tutor_load_template( 'profile.bio' ); ?> |
| 154 | |
| 155 | <?php |
| 156 | if ( $is_instructor ) { |
| 157 | ?> |
| 158 | <h3><?php _e( 'Courses', 'tutor' ); ?></h3> |
| 159 | <?php |
| 160 | add_filter( |
| 161 | 'courses_col_per_row', |
| 162 | function() { |
| 163 | return 3; |
| 164 | } |
| 165 | ); |
| 166 | |
| 167 | tutor_load_template( 'profile.courses_taken' ); |
| 168 | ?> |
| 169 | |
| 170 | <?php |
| 171 | /* |
| 172 | if(tutor_utils()->get_option('show_courses_completed_by_student')){ |
| 173 | echo '<h3>',__('Course Completed', 'tutor'),'</h3>'; |
| 174 | tutor_load_template('profile.enrolled_course'); |
| 175 | } */ |
| 176 | ?> |
| 177 | |
| 178 | <?php |
| 179 | /* |
| 180 | if(tutor_utils()->get_option('students_own_review_show_at_profile')){ |
| 181 | echo '<h3>',__('Reviews Wrote', 'tutor'),'</h3>'; |
| 182 | tutor_load_template('profile.reviews_wrote'); |
| 183 | } */ |
| 184 | ?> |
| 185 | <?php |
| 186 | } |
| 187 | ?> |
| 188 | </div> |
| 189 | </div> |
| 190 | </div> |
| 191 | <?php do_action( 'tutor_student/after/wrap' ); ?> |
| 192 | |
| 193 | <?php |
| 194 | tutor_utils()->tutor_custom_footer(); |
| 195 |