title( __( 'Your application is under review', 'tutor' ) ) + ->subtitle( __( 'Only your dashboard home is available while your instructor application is pending.', 'tutor' ) ) + ->attr( 'class', 'tutor-surface-l1 tutor-border tutor-rounded-2xl' ) + ->render(); + } elseif ( $dashboard_page_name ) { do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); /** diff --git a/templates/dashboard/dashboard.php b/templates/dashboard/dashboard.php index 1525d7bbf0..edd99e9210 100644 --- a/templates/dashboard/dashboard.php +++ b/templates/dashboard/dashboard.php @@ -11,6 +11,45 @@ defined( 'ABSPATH' ) || exit; +use Tutor\Components\Alert; +use Tutor\Components\Button; +use Tutor\Components\Constants\Size; +use Tutor\Components\Constants\Variant; +use Tutor\Models\CourseModel; +use TUTOR\Icon; +use TUTOR\Instructors_List; +use TUTOR\User; + +$user_id = get_current_user_id(); +$instructor_status = tutor_utils()->instructor_status( 0, false ); +$instructor_status = is_string( $instructor_status ) ? strtolower( $instructor_status ) : ''; +$is_instructor_pending = Instructors_List::STATUS_PENDING === $instructor_status; +$is_instructor_approved = Instructors_List::STATUS_APPROVED === $instructor_status; +$used_instructor_registration = User::used_instructor_registration( $user_id ); + do_action( 'tutor_before_dashboard_content' ); tutor_load_template( 'dashboard.components.profile-completion' ); + +if ( $is_instructor_pending ) { + tutor_load_template( 'dashboard.instructor.instructor-request-alert' ); + + tutor_load_template( 'dashboard.instructor.dashboard-empty' ); + return; +} + +if ( $is_instructor_approved && $used_instructor_registration ) { + $hide_notice_url = add_query_arg( 'tutor_action', 'hide_instructor_approval_notice' ); + + if ( get_user_meta( $user_id, User::INSTRUCTOR_APPROVAL_NOTICE_META, true ) ) { + tutor_load_template( 'dashboard.instructor.instructor-request-alert', array( 'variant' => 'success' ) ); + } + + $course_count = (int) CourseModel::get_courses_by_instructor( $user_id, CourseModel::get_status_list(), 0, PHP_INT_MAX, true ); + + if ( ! $course_count ) { + tutor_load_template( 'dashboard.instructor.dashboard-empty' ); + return; + } +} + tutor_load_template( 'dashboard.instructor.home' ); diff --git a/templates/dashboard/instructor/dashboard-empty.php b/templates/dashboard/instructor/dashboard-empty.php new file mode 100644 index 0000000000..048c188516 --- /dev/null +++ b/templates/dashboard/instructor/dashboard-empty.php @@ -0,0 +1,60 @@ + + * @link https://themeum.com + * @since 4.0.0 + */ + +defined( 'ABSPATH' ) || exit; + +use Tutor\Components\Button; +use Tutor\Components\Constants\Size; +use Tutor\Components\Constants\Variant; +use TUTOR\Icon; +use TUTOR\Instructors_List; + +$instructor_status = tutor_utils()->instructor_status( 0, false ); +$instructor_status = is_string( $instructor_status ) ? strtolower( $instructor_status ) : ''; + +?> + +
+ +
+

+ +

+

+ +

+ label( __( 'Create Your First Course', 'tutor' ) ) + ->variant( Variant::PRIMARY ) + ->size( Size::MEDIUM ) + ->icon( Icon::ARROW_RIGHT_2, 'right', 20 ) + ->attr( 'class', 'tutor-create-new-course' ) + ->render(); + ?> +
+
+ render_themed_svg( 'images/illustrations/instructor-approved.svg' ); ?> +
+ +
+

+ +

+

+ +

+
+
+ render_themed_svg( 'images/illustrations/instructor-pending.svg' ); ?> +
+ +
diff --git a/templates/dashboard/instructor/instructor-request-alert.php b/templates/dashboard/instructor/instructor-request-alert.php new file mode 100644 index 0000000000..c3d5e486d2 --- /dev/null +++ b/templates/dashboard/instructor/instructor-request-alert.php @@ -0,0 +1,72 @@ + + * @link https://themeum.com + * @since 4.0.0 + */ + +defined( 'ABSPATH' ) || exit; + +use TUTOR\Icon; +use Tutor\Components\Button; +use Tutor\Components\Constants\Size; +use Tutor\Components\Constants\Variant; +use Tutor\Components\SvgIcon; + +$variant = isset( $variant ) ? $variant : 'warning'; +$alert_title = __( 'Application Under Review', 'tutor' ); +$alert_text = __( 'Thank you for applying to become an instructor. Our team is reviewing your application.', 'tutor' ); +$bg_class = 'tutor-surface-warning-hover'; +$icon_class = 'tutor-icon-warning-secondary'; +$icon = Icon::INFO_OCTAGON_FILL; +$hide_notice_url = ''; + +if ( 'success' === $variant ) { + $alert_title = __( 'Application Approved', 'tutor' ); + $alert_text = __( 'Your application has been approved. You can now create and publish courses.', 'tutor' ); + $bg_class = 'tutor-surface-success'; + $icon_class = 'tutor-icon-success-secondary'; + $icon = Icon::BADGE_CHECK; + $hide_notice_url = add_query_arg( 'tutor_action', 'hide_instructor_approval_notice' ); +} + +?> +
+
+ name( $icon ) + ->size( 40 ) + ->attr( 'class', $icon_class ) + ->render(); + ?> +
+
+
+ +
+
+ +
+
+ +
+ label( __( 'Dismiss', 'tutor' ) ) + ->variant( Variant::GHOST ) + ->size( Size::X_SMALL ) + ->icon( Icon::CROSS_2, 'left', 20 ) + ->tag( 'a' ) + ->icon_only() + ->attr( 'href', $hide_notice_url ) + ->attr( 'aria-label', __( 'Dismiss', 'tutor' ) ) + ->render(); + ?> +
+ +
\ No newline at end of file diff --git a/templates/dashboard/student/dashboard-empty.php b/templates/dashboard/student/dashboard-empty.php index 10ee06d7af..a6932fd582 100644 --- a/templates/dashboard/student/dashboard-empty.php +++ b/templates/dashboard/student/dashboard-empty.php @@ -55,7 +55,7 @@ ?>
- <?php esc_html_e( 'Confetti', 'tutor' ); ?> + render_themed_svg( 'images/illustrations/dashboard-empty.svg' ); ?>