Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions assets/icons/earning-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/icons/passed-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/src/js/v3/shared/icons/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const icons = [
'duplicate',
'dwg',
'earning',
'earningFill',
'edit',
'edit2',
'elementorColorized',
Expand Down Expand Up @@ -239,6 +240,7 @@ export const icons = [
'open',
'outlineNone',
'passed',
'passedFill',
'passing',
'pauseCircle',
'pdf',
Expand Down
2 changes: 0 additions & 2 deletions classes/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace TUTOR;

use Tutor\Helpers\UrlHelper;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand Down
2 changes: 2 additions & 0 deletions classes/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ final class Icon {
const DUPLICATE = 'duplicate';
const DWG = 'dwg';
const EARNING = 'earning';
const EARNING_FILL = 'earning-fill';
const EDIT = 'edit';
const EDIT_2 = 'edit-2';
const ELEMENTOR_COLORIZED = 'elementor-colorized';
Expand Down Expand Up @@ -255,6 +256,7 @@ final class Icon {
const OPEN = 'open';
const OUTLINE_NONE = 'outline-none';
const PASSED = 'passed';
const PASSED_FILL = 'passed-fill';
const PASSING = 'passing';
const PAUSE_CIRCLE = 'pause-circle';
const PDF = 'pdf';
Expand Down
4 changes: 2 additions & 2 deletions classes/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
use Tutor\Ecommerce\Tax;
use Tutor\Cache\TutorCache;
use Tutor\Models\QuizModel;
use Tutor\Helpers\UrlHelper;
use Tutor\Helpers\HttpHelper;
use Tutor\Models\CourseModel;
use Tutor\Ecommerce\Ecommerce;
use Tutor\Helpers\QueryHelper;
use Tutor\Traits\JsonResponse;
use Tutor\Helpers\DateTimeHelper;
use Tutor\Helpers\UrlHelper;

if ( ! defined( 'ABSPATH' ) ) {
exit;
Expand Down Expand Up @@ -8545,7 +8545,7 @@ public function is_tutor_dashboard( $subpage = null ) {
*
* @return boolean
*/
public function is_tutor_frontend_dashboard( $subpage = null ) {
public function is_tutor_frontend_dashboard( $subpage = '' ) {
global $wp_query;
if ( $wp_query->is_page ) {
$dashboard_page = $this->array_get( 'tutor_dashboard_page', $wp_query->query_vars );
Expand Down
50 changes: 50 additions & 0 deletions templates/dashboard/account/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,63 @@
*/

defined( 'ABSPATH' ) || exit;

use TUTOR\Icon;
use TUTOR\User;
use Tutor\Models\CourseModel;
use Tutor\Models\WithdrawModel;

$statistics = array();
$user = wp_get_current_user();
$show_statistics = User::is_instructor() ? true : false;

if ( $show_statistics ) {
$statistics = array(
array(
'value' => WithdrawModel::get_withdraw_summary( $user->ID )->total_income ?? 0,
'icon' => Icon::EARNING_FILL,
'label' => __( 'Total Earnings', 'tutor' ),
'icon_class' => 'tutor-actions-success-primary',
),
array(
'value' => CourseModel::get_course_count_by_instructor( $user->ID ),
'icon' => Icon::COURSES_FILL,
'label' => __( 'Total Courses', 'tutor' ),
'icon_class' => 'tutor-icon-brand',
),
array(
'value' => tutor_utils()->get_instructor_ratings( $user->ID )->rating_avg ?? 0,
'icon' => Icon::STAR_FILL,
'label' => __( 'Ratings', 'tutor' ),
'icon_class' => 'tutor-text-exception4',
),
array(
'value' => tutor_utils()->get_total_students_by_instructor( $user->ID ) ?? 0,
'icon' => Icon::PASSED_FILL,
'label' => __( 'Total Students', 'tutor' ),
'icon_class' => 'tutor-text-exception5',
),
);
}
?>

<div class="tutor-profile-wrapper">
<?php require_once tutor_get_template( 'account-header' ); ?>

<div class="tutor-profile-container">
<div class="tutor-flex tutor-flex-column tutor-gap-5 tutor-mt-9">
<div class="tutor-user-profile">
<div class="tutor-profile-container">
<?php tutor_load_template( 'user-profile' ); ?>

<?php if ( $show_statistics ) : ?>
<div class="tutor-user-profile-statistics">
<?php tutor_load_template( 'dashboard.instructor.profile-statistics', array( 'statistics' => $statistics ) ); ?>
</div>
<?php endif; ?>

</div>
</div>
</div>
</div>
</div>
38 changes: 38 additions & 0 deletions templates/dashboard/instructor/profile-statistics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Tutor dashboard profile statistics.
*
* @package Tutor\Templates
* @author Themeum <support@themeum.com>
* @link https://themeum.com
* @since 4.0.0
*/

use TUTOR\Icon;
?>

<h5 class="tutor-statistic-title">
<?php esc_html_e( 'Statistics', 'tutor' ); ?>
</h5>


<div class="tutor-statistic-cards">
<?php foreach ( $statistics as $stat ) : ?>
<div class="tutor-statistic-card">
<div class="tutor-statistic-card-icon">
<?php
tutor_utils()->render_svg_icon(
$stat['icon'],
24,
24,
array( 'class' => $stat['icon_class'] )
);
?>
</div>
<div class="tutor-statistic-card-content">
<h3 class="tutor-statistic-card-value"><?php echo esc_html( $stat['value'] ); ?></h3>
<div class="tutor-statistic-card-label"><?php echo esc_html( $stat['label'] ); ?></div>
</div>
</div>
<?php endforeach; ?>
</div>
75 changes: 75 additions & 0 deletions templates/user-profile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* Tutor dashboard profile.
*
* @package Tutor\Templates
* @author Themeum <support@themeum.com>
* @link https://themeum.com
* @since 4.0.0
*/

use TUTOR\Icon;
use TUTOR\User;

$user = wp_get_current_user();
$student_details = get_userdata( $user->ID );
$student_meta = get_user_meta( $user->ID );
$edit_profile_url = tutor_utils()->tutor_dashboard_url( 'account/settings' );
?>

<div class="tutor-profile-card">
<div class="tutor-profile-card-header">
<div class="tutor-avatar tutor-avatar-104 tutor-border tutor-border-2 tutor-border-brand-secondary">
<img src="<?php echo esc_url( get_avatar_url( $user->ID ) ); ?>" alt="<?php echo esc_attr( $student_details->user_nicename ); ?>" class="tutor-avatar-image">
</div>
<?php if ( User::is_student() && User::is_student_view() ) : ?>
<a href="<?php echo esc_url( $edit_profile_url ); ?>" class="tutor-edit-profile-btn">
<?php tutor_utils()->render_svg_icon( Icon::EDIT_2 ); ?>
<span><?php esc_html_e( 'Edit Profile', 'tutor' ); ?></span>
</a>
<?php endif; ?>
</div>
<div class="tutor-profile-card-body">
<div class="tutor-profile-card-body-left">
<div>
<h3 class="tutor-user-profile-title">
<?php esc_html( $student_details->display_name ); ?>
</h3>
<div class="tutor-user-profile-designation">
<?php echo esc_html( $student_meta['_tutor_profile_job_title'][0] ?? '' ); ?>
</div>
<div class="tutor-user-profile-social">
<a href="#"><?php tutor_utils()->render_svg_icon( Icon::FACEBOOK ); ?></a>
<a href="#"><?php tutor_utils()->render_svg_icon( Icon::X ); ?></a>
<a href="#"><?php tutor_utils()->render_svg_icon( Icon::LINKEDIN ); ?></a>
<a href="#"><?php tutor_utils()->render_svg_icon( Icon::GITHUB ); ?></a>
<a href="#"><?php tutor_utils()->render_svg_icon( Icon::GLOBE ); ?></a>
</div>
</div>
</div>
<div class="tutor-profile-card-body-right">
<div class="tutor-user-profile-bio">
<?php echo esc_html( $student_meta['_tutor_profile_bio'][0] ?? '' ); ?>
</div>
<ul class="tutor-user-profile-details">
<li>
<?php echo esc_html__( 'Username', 'tutor-pro' ); ?> :
<span><?php echo esc_html( $student_details->user_login ); ?></span>
</li>
<li>
<?php echo esc_html__( 'Email', 'tutor-pro' ); ?> :
<span><?php echo esc_html( $student_details->user_email ); ?></span>
</li>
<li>
<?php echo esc_html__( 'Phone', 'tutor-pro' ); ?> :
<span></span>
</li>
</ul>
</div>
<div class="tutor-profile-member-since">
<?php tutor_utils()->render_svg_icon( Icon::MEMBER ); ?>
<?php echo esc_html__( 'Member since', 'tutor-pro' ); ?>
<?php echo esc_html( tutor_i18n_get_formated_date( $student_details->user_registered, 'F j, Y' ) ); ?>
</div>
</div>
</div>
Loading