diff --git a/assets/icons/earning-fill.svg b/assets/icons/earning-fill.svg new file mode 100644 index 0000000000..2e6f69614b --- /dev/null +++ b/assets/icons/earning-fill.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/passed-fill.svg b/assets/icons/passed-fill.svg new file mode 100644 index 0000000000..981f4ff733 --- /dev/null +++ b/assets/icons/passed-fill.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/src/js/v3/shared/icons/types.ts b/assets/src/js/v3/shared/icons/types.ts index f02cdfbeb0..b8e1525ca0 100644 --- a/assets/src/js/v3/shared/icons/types.ts +++ b/assets/src/js/v3/shared/icons/types.ts @@ -127,6 +127,7 @@ export const icons = [ 'duplicate', 'dwg', 'earning', + 'earningFill', 'edit', 'edit2', 'elementorColorized', @@ -239,6 +240,7 @@ export const icons = [ 'open', 'outlineNone', 'passed', + 'passedFill', 'passing', 'pauseCircle', 'pdf', diff --git a/classes/Dashboard.php b/classes/Dashboard.php index a1040339c5..96112a7146 100644 --- a/classes/Dashboard.php +++ b/classes/Dashboard.php @@ -10,8 +10,6 @@ namespace TUTOR; -use Tutor\Helpers\UrlHelper; - if ( ! defined( 'ABSPATH' ) ) { exit; } diff --git a/classes/Icon.php b/classes/Icon.php index 0cf785ebb3..7877c1d88d 100644 --- a/classes/Icon.php +++ b/classes/Icon.php @@ -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'; @@ -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'; diff --git a/classes/Utils.php b/classes/Utils.php index 08ac972d96..2a9abf450e 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -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; @@ -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 ); diff --git a/templates/dashboard/account/profile.php b/templates/dashboard/account/profile.php index fd1c23063c..728a234ec6 100644 --- a/templates/dashboard/account/profile.php +++ b/templates/dashboard/account/profile.php @@ -10,6 +10,44 @@ */ 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', + ), + ); +} ?>
@@ -17,6 +55,18 @@
+
diff --git a/templates/dashboard/instructor/profile-statistics.php b/templates/dashboard/instructor/profile-statistics.php new file mode 100644 index 0000000000..5b302e3667 --- /dev/null +++ b/templates/dashboard/instructor/profile-statistics.php @@ -0,0 +1,38 @@ + + * @link https://themeum.com + * @since 4.0.0 + */ + +use TUTOR\Icon; +?> + +
+ +
+ + +
+ +
+
+ render_svg_icon( + $stat['icon'], + 24, + 24, + array( 'class' => $stat['icon_class'] ) + ); + ?> +
+
+

+
+
+
+ +
diff --git a/templates/user-profile.php b/templates/user-profile.php new file mode 100644 index 0000000000..5eaf73a576 --- /dev/null +++ b/templates/user-profile.php @@ -0,0 +1,75 @@ + + * @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' ); +?> + +
+
+
+ <?php echo esc_attr( $student_details->user_nicename ); ?> +
+ + + render_svg_icon( Icon::EDIT_2 ); ?> + + + +
+
+ +
+ + +
+
+ render_svg_icon( Icon::MEMBER ); ?> + + user_registered, 'F j, Y' ) ); ?> +
+
+