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.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / public-profile.php
tutor / templates Last commit date
course-filter 3 years ago dashboard 3 years ago email 4 years ago global 4 years ago instructor 4 years ago loop 3 years ago modal 4 years ago profile 4 years ago shortcode 4 years ago single 3 years ago template-part 3 years ago widget 4 years ago archive-course-init.php 3 years ago archive-course.php 3 years ago course-embed.php 3 years ago course-none.php 3 years ago dashboard.php 3 years ago feature_disabled.php 3 years ago instructor-setting.php 3 years ago login-form.php 3 years ago login.php 3 years ago permission-denied.php 3 years ago public-profile.php 3 years ago single-assignment.php 3 years ago single-content-loader.php 3 years ago single-course.php 3 years ago single-lesson.php 3 years ago single-preview-lesson.php 3 years ago single-quiz.php 3 years ago template.php 3 years ago
public-profile.php
192 lines
1 <?php
2 /**
3 * Template for displaying student & instructor Public Profile.
4 * It is used for both of instructor and student.
5 * Separate file has not been introduced due to complicacy and backward compatibility.
6 *
7 * @author Themeum
8 * @link https://themeum.com
9 * @package TutorLMS/Templates
10 * @since 1.0.0
11 * @version 1.4.3
12 */
13
14 // Get the accessed user data
15 $user_name = sanitize_text_field( get_query_var( 'tutor_profile_username' ) );
16 $get_user = tutor_utils()->get_user_by_login( $user_name );
17
18 // Show not found page if user not exists
19 if ( ! is_object( $get_user ) || ! property_exists( $get_user, 'ID' ) ) {
20 wp_redirect( get_home_url() . '/404' );
21 exit;
22 }
23
24 // Prepare meta data to render the page based on user and view type
25 $user_id = $get_user->ID;
26 $is_instructor = isset( $_GET['view'] ) ? $_GET['view'] === 'instructor' : tutor_utils()->is_instructor( $user_id, true );
27 $layout_key = $is_instructor ? 'public_profile_layout' : 'student_public_profile_layout';
28 $profile_layout = tutor_utils()->get_option( $layout_key, 'private' );
29 $user_type = $is_instructor ? 'instructor' : 'student';
30
31 if ( 'private' === $profile_layout ) {
32 // Disable profile access then.
33 wp_redirect( get_home_url() );
34 exit;
35 }
36
37 // Prepare social media URLs od the user
38 $tutor_user_social_icons = tutor_utils()->tutor_user_social_icons();
39 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
40 $url = get_user_meta( $user_id, $key, true );
41 $tutor_user_social_icons[ $key ]['url'] = $url;
42 }
43
44 tutor_utils()->tutor_custom_header();
45 ?>
46
47 <?php
48 ob_start();
49
50 // Rating content.
51 if ( $is_instructor ) {
52 $instructor_rating = tutor_utils()->get_instructor_ratings( $user_id );
53 ?>
54 <div class="tutor-rating-container">
55 <div class="ratings">
56 <span class="rating-generated">
57 <?php tutor_utils()->star_rating_generator( $instructor_rating->rating_avg ); ?>
58 </span>
59 <span class='rating-digits'>
60 <?php echo esc_html( number_format( $instructor_rating->rating_avg, 2 ) ); ?>
61 </span>
62 <span class='rating-total-meta tutor-fs-7 tutor-color-muted'>
63 (<?php echo esc_html( number_format( $instructor_rating->rating_count, 2 ) ); ?>)
64 </span>
65 </div>
66 </div>
67 <?php
68 }
69
70 $rating_content = ob_get_clean();
71
72 // Social media content
73 ob_start();
74
75 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
76 $url = $social_icon['url'];
77 echo ! empty( $url ) ? '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer nofollow" class="' . esc_attr( $social_icon['icon_classes'] ) . '" title="' . esc_attr( $social_icon['label'] ) . '"></a>' : '';
78 }
79
80 $social_media = ob_get_clean();
81 ?>
82
83 <?php do_action( 'tutor_profile/' . $user_type . '/before/wrap' ); ?>
84 <?php $user_identifier = $is_instructor ? 'tutor-instructor' : 'tutor-student'; ?>
85 <div <?php tutor_post_class( 'tutor-wrap-parent tutor-full-width-student-profile tutor-page-wrap tutor-user-public-profile tutor-user-public-profile-' . $profile_layout . ' ' . $user_identifier ); ?> >
86 <div class="tutor-container photo-area">
87 <div class="cover-area">
88 <div style="background-image:url(<?php echo tutor_utils()->get_cover_photo_url( $user_id ); ?>)"></div>
89 <div></div>
90 </div>
91 <div class="pp-area">
92 <div class="profile-pic" style="background-image:url(<?php echo get_avatar_url( $user_id, array( 'size' => 300 ) ); ?>)"></div>
93
94 <div class="profile-name tutor-color-white">
95 <div class="profile-rating-media content-for-mobile">
96 <?php echo $rating_content; ?>
97 <div class="tutor-social-container content-for-desktop">
98 <?php echo $social_media; ?>
99 </div>
100 </div>
101
102 <h3><?php echo $get_user->display_name; ?></h3>
103 <?php
104 if ( $is_instructor ) {
105 $course_count = tutor_utils()->get_course_count_by_instructor( $user_id );
106 $student_count = tutor_utils()->get_total_students_by_instructor( $user_id );
107 ?>
108 <span>
109 <span><?php echo $course_count; ?></span>
110 <?php $course_count > 1 ? _e( 'Courses', 'tutor' ) : _e( 'Course', 'tutor' ); ?>
111 </span>
112 <span>
113 <span></span>
114 </span>
115 <span>
116 <span><?php echo $student_count; ?></span>
117 <?php $student_count > 1 ? _e( 'Students', 'tutor' ) : _e( 'Student', 'tutor' ); ?>
118 </span>
119 <?php
120 } else {
121 $enrolled_course = tutor_utils()->get_enrolled_courses_by_user( $user_id );
122 $enrol_count = is_object( $enrolled_course ) ? $enrolled_course->found_posts : 0;
123
124 $complete_count = tutor_utils()->get_completed_courses_ids_by_user( $user_id );
125 $complete_count = $complete_count ? count( $complete_count ) : 0;
126 ?>
127 <span>
128 <span><?php echo $enrol_count; ?></span>
129 <?php $enrol_count > 1 ? _e( 'Courses Enrolled', 'tutor' ) : _e( 'Course Enrolled', 'tutor' ); ?>
130 </span>
131 <span><span></span></span>
132 <span>
133 <span><?php echo $complete_count; ?></span>
134 <?php $complete_count > 1 ? _e( 'Courses Completed', 'tutor' ) : _e( 'Course Completed', 'tutor' ); ?>
135 </span>
136 <?php
137 }
138 ?>
139 </div>
140
141 <div class="tutor-social-container content-for-mobile">
142 <?php echo $social_media; ?>
143 </div>
144
145 <div class="profile-rating-media content-for-desktop">
146 <?php echo $rating_content; ?>
147 <div class="tutor-social-container content-for-desktop">
148 <?php
149 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
150 $url = $social_icon['url'];
151 echo ! empty( $url ) ? '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer nofollow" class="' . $social_icon['icon_classes'] . '" title="' . $social_icon['label'] . '"></a>' : '';
152 }
153 ?>
154 </div>
155 </div>
156 </div>
157 </div>
158
159
160 <div class="tutor-container" style="overflow:auto">
161 <div class="tutor-user-profile-sidebar">
162 <?php // tutor_load_template('profile.badge', ['profile_badges'=>(new )]); ?>
163 </div>
164 <div class="tutor-user-profile-content tutor-d-block tutor-mt-72">
165 <h3><?php _e( 'Biography', 'tutor' ); ?></h3>
166 <?php tutor_load_template( 'profile.bio' ); ?>
167
168 <?php
169 if ( $is_instructor ) {
170 ?>
171 <h3><?php _e( 'Courses', 'tutor' ); ?></h3>
172 <?php
173 add_filter(
174 'courses_col_per_row',
175 function() {
176 return 3;
177 }
178 );
179
180 tutor_load_template( 'profile.courses_taken' );
181 ?>
182 <?php
183 }
184 ?>
185 </div>
186 </div>
187 </div>
188 <?php
189
190 do_action( 'tutor_profile/' . $user_type . '/after/wrap' );
191 tutor_utils()->tutor_custom_footer();
192