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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 3 years ago global 3 years ago instructor 3 years ago loop 3 years ago modal 3 years ago profile 3 years ago shortcode 3 years ago single 3 years ago template-part 3 years ago widget 3 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 metabox-wrapper.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
229 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 'class' => true,
91 'target' => true,
92 'rel' => true,
93 'title' => true,
94 ),
95 );
96 ?>
97
98 <?php
99 //phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
100 do_action( 'tutor_profile/' . $user_type . '/before/wrap' );
101 ?>
102 <?php $user_identifier = $is_instructor ? 'tutor-instructor' : 'tutor-student'; ?>
103 <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 ); ?> >
104 <div class="tutor-container photo-area">
105 <div class="cover-area">
106 <div style="background-image:url(<?php echo esc_url( tutor_utils()->get_cover_photo_url( $user_id ) ); ?>)"></div>
107 <div></div>
108 </div>
109 <div class="pp-area">
110 <div class="profile-pic" style="background-image:url(<?php echo esc_url( get_avatar_url( $user_id, array( 'size' => 300 ) ) ); ?>)"></div>
111
112 <div class="profile-name tutor-color-white">
113 <div class="profile-rating-media content-for-mobile">
114 <?php echo wp_kses( $rating_content, $allowed_html_for_rating ); ?>
115 <div class="tutor-social-container content-for-desktop">
116 <?php echo wp_kses( $social_media, $allowed_html_for_social ); ?>
117 </div>
118 </div>
119
120 <h3><?php echo esc_html( $get_user->display_name ); ?></h3>
121 <?php
122 if ( $is_instructor ) {
123 $course_count = CourseModel::get_course_count_by_instructor( $user_id );
124 $student_count = tutor_utils()->get_total_students_by_instructor( $user_id );
125 ?>
126 <span>
127 <span><?php echo esc_html( $course_count ); ?></span>
128 <?php $course_count > 1 ? esc_html_e( 'Courses', 'tutor' ) : esc_html_e( 'Course', 'tutor' ); ?>
129 </span>
130 <span>
131 <span></span>
132 </span>
133 <span>
134 <span><?php echo esc_html( $student_count ); ?></span>
135 <?php $student_count > 1 ? esc_html_e( 'Students', 'tutor' ) : esc_html_e( 'Student', 'tutor' ); ?>
136 </span>
137 <?php
138 } else {
139 $enrolled_course = tutor_utils()->get_enrolled_courses_by_user( $user_id );
140 $enrol_count = is_object( $enrolled_course ) ? $enrolled_course->found_posts : 0;
141
142 $complete_count = tutor_utils()->get_completed_courses_ids_by_user( $user_id );
143 $complete_count = $complete_count ? count( $complete_count ) : 0;
144 ?>
145 <span>
146 <span><?php echo esc_html( $enrol_count ); ?></span>
147 <?php $enrol_count > 1 ? esc_html_e( 'Courses Enrolled', 'tutor' ) : esc_html_e( 'Course Enrolled', 'tutor' ); ?>
148 </span>
149 <span><span></span></span>
150 <span>
151 <span><?php echo esc_html( $complete_count ); ?></span>
152 <?php $complete_count > 1 ? esc_html_e( 'Courses Completed', 'tutor' ) : esc_html_e( 'Course Completed', 'tutor' ); ?>
153 </span>
154 <?php
155 }
156 ?>
157 </div>
158
159 <div class="tutor-social-container content-for-mobile">
160 <?php echo wp_kses( $social_media, $allowed_html_for_social ); ?>
161 </div>
162
163 <div class="profile-rating-media content-for-desktop">
164 <?php echo wp_kses( $rating_content, $allowed_html_for_rating ); ?>
165 <div class="tutor-social-container content-for-desktop">
166 <?php
167 foreach ( $tutor_user_social_icons as $key => $social_icon ) {
168 $url = $social_icon['url'];
169 if ( ! empty( $url ) ) :
170 ?>
171 <a href="<?php echo esc_url( $url ); ?>"
172 target="_blank" rel="noopener noreferrer nofollow"
173 class="<?php echo esc_attr( $social_icon['icon_classes'] ); ?>"
174 title="<?php esc_attr( $social_icon['label'] ); ?>"></a>
175 <?php
176 endif;
177 }
178 ?>
179 </div>
180 </div>
181 </div>
182 </div>
183
184 <div class="tutor-container" style="overflow:auto">
185 <div class="tutor-user-profile-sidebar">
186
187 </div>
188 <div class="tutor-user-profile-content tutor-d-block tutor-mt-72">
189 <h3><?php esc_html_e( 'Biography', 'tutor' ); ?></h3>
190 <?php tutor_load_template( 'profile.bio' ); ?>
191
192 <?php
193 if ( $is_instructor ) {
194 ?>
195 <h3><?php esc_html_e( 'Courses', 'tutor' ); ?></h3>
196 <?php
197 add_filter(
198 'courses_col_per_row',
199 function() {
200 return 3;
201 }
202 );
203
204 tutor_load_template( 'profile.courses_taken' );
205 ?>
206 <?php
207 }
208 ?>
209 </div>
210 </div>
211 </div>
212 <?php
213 //phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
214 do_action( 'tutor_profile/' . $user_type . '/after/wrap' );
215 tutor_utils()->tutor_custom_footer();
216
217 /**
218 * If user not logged in load tutor login modal.
219 * It will appear on enroll btn click.
220 *
221 * @since 2.1.3
222 */
223 if ( ! is_user_logged_in() ) {
224 $login_modal = tutor()->path . '/views/modal/login.php';
225 if ( file_exists( $login_modal ) ) {
226 tutor_load_template_from_custom_path( $login_modal );
227 }
228 }
229