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.0 3.6.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 1 year ago dashboard 8 months ago ecommerce 7 months ago email 9 months ago global 3 years ago instructor 3 years ago loop 9 months ago modal 3 years ago profile 3 years ago shortcode 1 year ago single 8 months ago template-part 1 year ago widget 3 years ago archive-course-init.php 9 months ago archive-course.php 3 years ago course-embed.php 1 year ago course-none.php 3 years ago dashboard.php 1 year ago feature_disabled.php 3 years ago login-form.php 1 year ago login.php 3 years ago metabox-wrapper.php 3 years ago permission-denied.php 3 years ago public-profile.php 8 months ago single-assignment.php 3 years ago single-content-loader.php 2 years ago single-course.php 9 months ago single-lesson.php 3 years ago single-preview-lesson.php 3 years ago single-quiz.php 1 year ago template.php 3 years ago
public-profile.php
219 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 * @package Tutor\Templates
8 * @author Themeum <support@themeum.com>
9 * @link https://themeum.com
10 * @since 1.0.0
11 */
12
13 use TUTOR\Input;
14 use Tutor\Models\CourseModel;
15
16 // Get the accessed user data.
17 $user_name = sanitize_text_field( get_query_var( 'tutor_profile_username' ) );
18 $get_user = tutor_utils()->get_user_by_login( $user_name );
19
20 // Show not found page if user not exists.
21 if ( ! is_object( $get_user ) || ! property_exists( $get_user, 'ID' ) ) {
22 wp_safe_redirect( get_home_url() . '/404' );
23 exit;
24 }
25
26 // Prepare meta data to render the page based on user and view type.
27 $user_id = $get_user->ID;
28 $is_instructor = Input::has( 'view' ) ? 'instructor' === Input::get( 'view' ) : tutor_utils()->is_instructor( $user_id, true );
29 $layout_key = $is_instructor ? 'public_profile_layout' : 'student_public_profile_layout';
30 $profile_layout = tutor_utils()->get_option( $layout_key, 'private' );
31 $user_type = $is_instructor ? 'instructor' : 'student';
32
33 if ( 'private' === $profile_layout ) {
34 // Disable profile access then.
35 wp_safe_redirect( get_home_url() );
36 exit;
37 }
38
39 // Prepare social media URLs od the user.
40 $tutor_user_social_icons = tutor_utils()->tutor_user_social_icons();
41 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
42 $url = get_user_meta( $user_id, $key, true );
43 $tutor_user_social_icons[ $key ]['url'] = $url;
44 }
45
46 tutor_utils()->tutor_custom_header();
47 ?>
48
49 <?php
50 ob_start();
51
52 // Rating content.
53 if ( $is_instructor ) {
54 $instructor_rating = tutor_utils()->get_instructor_ratings( $user_id );
55 ?>
56 <div class="tutor-rating-container">
57 <div class="ratings">
58 <span class="rating-generated">
59 <?php tutor_utils()->star_rating_generator( $instructor_rating->rating_avg ); ?>
60 </span>
61 <span class='rating-digits'>
62 <?php echo esc_html( number_format( $instructor_rating->rating_avg, 2 ) ); ?>
63 </span>
64 <span class='rating-total-meta tutor-fs-7 tutor-color-muted'>
65 (<?php echo esc_html( number_format( $instructor_rating->rating_count, 2 ) ); ?>)
66 </span>
67 </div>
68 </div>
69 <?php
70 }
71
72 $rating_content = ob_get_clean();
73 $allowed_html_for_rating = array(
74 'div' => array( 'class' => true ),
75 'span' => array( 'class' => true ),
76 'i' => array( 'class' => true ),
77 );
78
79 // Social media content.
80 ob_start();
81
82 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
83 $url = $social_icon['url'];
84 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>' : '';
85 }
86
87 $social_media = ob_get_clean();
88 $allowed_html_for_social = array(
89 'a' => array(
90 'href' => true,
91 'class' => true,
92 'target' => true,
93 'rel' => true,
94 'title' => true,
95 ),
96 );
97
98 ?>
99
100 <?php
101 //phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
102 do_action( 'tutor_profile/' . $user_type . '/before/wrap' );
103 ?>
104 <?php $user_identifier = $is_instructor ? 'tutor-instructor' : 'tutor-student'; ?>
105 <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 ); ?> >
106 <div class="tutor-container photo-area">
107 <div class="cover-area">
108 <div style="background-image:url(<?php echo esc_url( tutor_utils()->get_cover_photo_url( $user_id ) ); ?>)"></div>
109 <div></div>
110 </div>
111 <div class="pp-area">
112 <div class="profile-pic" style="background-image:url(<?php echo esc_url( get_avatar_url( $user_id, array( 'size' => 300 ) ) ); ?>)"></div>
113
114 <div class="profile-name tutor-color-white">
115 <div class="profile-rating-media content-for-mobile">
116 <?php echo wp_kses( $rating_content, $allowed_html_for_rating ); ?>
117 <div class="tutor-social-container content-for-desktop">
118 <?php echo wp_kses( $social_media, $allowed_html_for_social ); ?>
119 </div>
120 </div>
121
122 <h3><?php echo esc_html( $get_user->display_name ); ?></h3>
123 <?php
124 if ( $is_instructor ) {
125 $course_count = CourseModel::get_course_count_by_instructor( $user_id );
126 $student_count = tutor_utils()->get_total_students_by_instructor( $user_id );
127 ?>
128 <span>
129 <span><?php echo esc_html( $course_count ); ?></span>
130 <?php $course_count > 1 ? esc_html_e( 'Courses', 'tutor' ) : esc_html_e( 'Course', 'tutor' ); ?>
131 </span>
132 <span>
133 <span></span>
134 </span>
135 <span>
136 <span><?php echo esc_html( $student_count ); ?></span>
137 <?php $student_count > 1 ? esc_html_e( 'Students', 'tutor' ) : esc_html_e( 'Student', 'tutor' ); ?>
138 </span>
139 <?php
140 } else {
141 $enrolled_course = CourseModel::get_enrolled_courses_by_user( $user_id );
142 $enrol_count = is_object( $enrolled_course ) ? $enrolled_course->found_posts : 0;
143
144 $complete_count = tutor_utils()->get_completed_courses_ids_by_user( $user_id );
145 $complete_count = $complete_count ? count( $complete_count ) : 0;
146 ?>
147 <span>
148 <span><?php echo esc_html( $enrol_count ); ?></span>
149 <?php $enrol_count > 1 ? esc_html_e( 'Courses Enrolled', 'tutor' ) : esc_html_e( 'Course Enrolled', 'tutor' ); ?>
150 </span>
151 <span><span></span></span>
152 <span>
153 <span><?php echo esc_html( $complete_count ); ?></span>
154 <?php $complete_count > 1 ? esc_html_e( 'Courses Completed', 'tutor' ) : esc_html_e( 'Course Completed', 'tutor' ); ?>
155 </span>
156 <?php
157 }
158 ?>
159 </div>
160
161 <div class="tutor-social-container content-for-mobile">
162 <?php echo wp_kses( $social_media, $allowed_html_for_social ); ?>
163 </div>
164
165 <div class="profile-rating-media content-for-desktop">
166 <?php echo wp_kses( $rating_content, $allowed_html_for_rating ); ?>
167 <div class="tutor-social-container content-for-desktop">
168 <?php echo wp_kses( $social_media, $allowed_html_for_social ); ?>
169 </div>
170 </div>
171 </div>
172 </div>
173
174 <div class="tutor-container" style="overflow:auto">
175 <div class="tutor-user-profile-sidebar">
176
177 </div>
178 <div class="tutor-user-profile-content tutor-d-block tutor-mt-72">
179 <h3><?php esc_html_e( 'Biography', 'tutor' ); ?></h3>
180 <?php tutor_load_template( 'profile.bio' ); ?>
181
182 <?php
183 if ( $is_instructor ) {
184 ?>
185 <h3><?php esc_html_e( 'Courses', 'tutor' ); ?></h3>
186 <?php
187 add_filter(
188 'courses_col_per_row',
189 function() {
190 return 3;
191 }
192 );
193
194 tutor_load_template( 'profile.courses_taken' );
195 ?>
196 <?php
197 }
198 ?>
199 </div>
200 </div>
201 </div>
202 <?php
203 //phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
204 do_action( 'tutor_profile/' . $user_type . '/after/wrap' );
205 tutor_utils()->tutor_custom_footer();
206
207 /**
208 * If user not logged in load tutor login modal.
209 * It will appear on enroll btn click.
210 *
211 * @since 2.1.3
212 */
213 if ( ! is_user_logged_in() ) {
214 $login_modal = tutor()->path . '/views/modal/login.php';
215 if ( file_exists( $login_modal ) ) {
216 tutor_load_template_from_custom_path( $login_modal );
217 }
218 }
219