current_user_can( 'view-tab-courses' );
if ( ! $user_can_view ) {
return;
}
ob_start();
lp_skeleton_animation_html( 4, 'random', 'height: 30px;border-radius:4px;' );
$html_skeleton = ob_get_clean();
$html_li_tabs = '';
$html_filter_contents = '';
foreach ( $courses_created_tab as $key => $created ) {
$html_li_tabs .= sprintf(
'
%s',
esc_attr( $key === '' ? 'active' : '' ),
esc_attr( $key === '' ? 'all' : $key ),
esc_html( $created )
);
$html_filter_contents .= sprintf(
'%s
',
esc_attr( $key === '' ? 'all' : $key ),
esc_attr( $key !== '' ? 'display: none' : '' ),
$html_skeleton
);
}
$show_course_builder_link = $profile->is_current_user() && CourseBuilder::can_view_course_builder();
$tabs_classes = [ 'learn-press-tabs' ];
$course_builder_link = '';
if ( $show_course_builder_link ) {
$tabs_classes[] = 'learn-press-tabs--with-course-builder';
$course_builder_link = sprintf(
'%2$s',
esc_url( CourseBuilder::get_link_course_builder() ),
esc_html__( 'Course Builder', 'learnpress' )
);
}
$section_tabs = [
'wrap' => sprintf( '', esc_attr( implode( ' ', $tabs_classes ) ) ),
'ul' => '
',
'content' => $html_li_tabs,
'ul-end' => '
',
'course-builder' => $course_builder_link,
'wrap-end' => '
',
];
$section_contents = [
'wrap' => '',
'content' => $html_filter_contents,
'input' => sprintf(
'',
sanitize_text_field( htmlentities( wp_json_encode( $args_query_user_courses_created ) ) )
),
'wrap-end' => '
',
];
$section_courses_statistic = apply_filters(
'learn-press/profile/layout/courses/sections/statistic',
[
'wrap' => '',
'skeleton' => $html_skeleton,
'input' => sprintf(
'',
sanitize_text_field( htmlentities( wp_json_encode( $args_query_user_courses_statistic ) ) )
),
'wrap-end' => '
',
],
$args
);
$section_courses_list = apply_filters(
'learn-press/profile/layout/courses/sections/course-list',
[
'wrap' => '',
'filter' => '
',
'tabs' => Template::combine_components( $section_tabs ),
'progress' => Template::combine_components( $section_contents ),
'filter-end' => '
',
'wrap-end' => '
',
],
$args
);
$section = apply_filters(
'learn-press/profile/layout/courses/sections',
[
'wrap' => '',
'statistic' => Template::combine_components( $section_courses_statistic ),
'course-list' => Template::combine_components( $section_courses_list ),
'wrap-end' => '
',
],
$args
);
echo Template::combine_components( $section );
}
}