PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.2.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.2.0
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / templates / profile / tabs.php

tabs.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.2.0, at templates/profile/tabs.php

107 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for displaying user profile tabs.
4 *
5 * This template can be overridden by copying it to yourtheme/learnpress/profile/tabs.php.
6 *
7 * @author ThimPress
8 * @package Learnpress/Templates
9 * @version 4.0.2
10 */
11
12 defined( 'ABSPATH' ) || exit();
13
14 if ( ! isset( $user ) || ! isset( $profile ) ) {
15 return;
16 }
17 ?>
18
19 <div id="profile-nav">
20
21 <?php do_action( 'learn-press/before-profile-nav', $profile ); ?>
22
23 <ul class="lp-profile-nav-tabs">
24
25 <?php
26 /**
27 * @var LP_Profile_Tab $profile_tab
28 */
29 foreach ( $profile->get_tabs()->tabs() as $tab_key => $profile_tab ) {
30 if ( ! is_object( $profile_tab ) || ! $profile_tab || $profile_tab->is_hidden() || ! $profile_tab->user_can_view() ) {
31 continue;
32 }
33
34 // Admin view another user profile
35 if ( $profile->get_user()->get_id() !== get_current_user_id() && current_user_can( ADMIN_ROLE ) ) {
36 $tab_key_hidden_admin_view_user = [ 'settings', 'logout', 'orders', 'gradebook' ];
37 if ( in_array( $tab_key, $tab_key_hidden_admin_view_user ) ) {
38 continue;
39 }
40 }
41
42 $slug = $profile->get_slug( $profile_tab, $tab_key );
43 $link = $profile->get_tab_link( $tab_key, true );
44 $tab_classes = array( esc_attr( $tab_key ) );
45
46 $sections = $profile_tab->sections();
47
48 if ( $sections && sizeof( $sections ) > 1 ) {
49 $tab_classes[] = 'has-child';
50 }
51
52 if ( $profile->is_current_tab( $tab_key ) ) {
53 $tab_classes[] = 'active';
54 }
55 ?>
56
57 <li class="<?php echo implode( ' ', $tab_classes ); ?>">
58 <a href="<?php echo esc_url_raw( $link ); ?>" data-slug="<?php echo esc_attr( $link ); ?>">
59 <?php
60 if ( ! empty( $profile_tab->get( 'icon' ) ) ) {
61 echo wp_kses_post( $profile_tab->get( 'icon' ) );
62 }
63 ?>
64 <?php echo apply_filters( 'learn_press_profile_' . $tab_key . '_tab_title', $profile_tab->get( 'title' ), $tab_key ); ?>
65 </a>
66
67 <?php if ( $sections && sizeof( $sections ) > 1 ) { ?>
68
69 <ul class="profile-tab-sections">
70 <?php
71 foreach ( $sections as $section_key => $section_data ) {
72
73 $classes = array( esc_attr( $section_key ) );
74 if ( $profile->is_current_section( $section_key, $section_key ) ) {
75 $classes[] = 'active';
76 }
77
78 $section_slug = $profile->get_slug( $section_data, $section_key );
79 $section_link = $profile->get_tab_link( $tab_key, $section_slug );
80 ?>
81
82 <li class="<?php echo implode( ' ', $classes ); ?>">
83 <a href="<?php echo esc_url_raw( $section_link ); ?>">
84 <?php
85 if ( ! empty( $section_data['icon'] ) ) {
86 echo wp_kses_post( $section_data['icon'] );
87 }
88 ?>
89 <?php echo apply_filters( 'learn_press_profile_' . $tab_key . '_tab_title', $section_data['title'], $tab_key ); ?>
90 </a>
91 </li>
92
93 <?php } ?>
94
95 </ul>
96
97 <?php } ?>
98
99 </li>
100 <?php } ?>
101
102 </ul>
103
104 <?php do_action( 'learn-press/after-profile-nav', $profile ); ?>
105
106 </div>
107