PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.1
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.4.1, at templates/profile/tabs.php

117 lines 3.3 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.4
10 */
11
12 defined( 'ABSPATH' ) || exit();
13
14 /**
15 * @var LP_Profile $profile
16 */
17 if ( ! isset( $user ) || ! isset( $profile ) ) {
18 return;
19 }
20 ?>
21
22 <div id="profile-nav" class="profile-nav">
23
24 <?php do_action( 'learn-press/before-profile-nav', $profile ); ?>
25
26 <ul class="lp-profile-nav-tabs">
27 <?php
28 /**
29 * @var LP_Profile_Tab $profile_tab
30 */
31 $tabs = $profile->get_tabs()->tabs();
32 foreach ( $tabs as $tab_key => $profile_tab ) {
33 if ( ! is_object( $profile_tab ) || ! $profile_tab || $profile_tab->is_hidden() || ! $profile->current_user_can( 'view-tab-' . $tab_key ) ) {
34 continue;
35 }
36
37 // Admin view another user profile
38 if ( $profile->get_user()->get_id() !== $profile->get_user_current()->get_id() && current_user_can( ADMIN_ROLE ) ) {
39 $tab_key_hidden_admin_view_user = [ 'settings', 'logout', 'orders', 'gradebook' ];
40 if ( in_array( $tab_key, $tab_key_hidden_admin_view_user ) ) {
41 continue;
42 }
43 }
44
45 $slug = $profile->get_slug( $profile_tab, $tab_key );
46 $link = $profile_tab->get( 'link' ) ? $profile_tab->get( 'link' ) : $profile->get_tab_link( $tab_key, true );
47 $target = $profile_tab->get( 'target' ) ? $profile_tab->get( 'target' ) : '_self';
48 $tab_classes = array( esc_attr( $tab_key ) );
49
50 $sections = $profile_tab->sections();
51
52 if ( $sections && sizeof( $sections ) > 1 ) {
53 $tab_classes[] = 'has-child';
54 }
55
56 if ( $profile->is_current_tab( $tab_key ) ) {
57 $tab_classes[] = 'active';
58 }
59 ?>
60
61 <li class="<?php echo implode( ' ', $tab_classes ); ?>">
62 <a href="<?php echo esc_url_raw( $link ); ?>" data-slug="<?php echo esc_attr( $link ); ?>" target="<?php echo esc_attr( $target ); ?>">
63 <?php
64 if ( ! empty( $profile_tab->get( 'icon' ) ) ) {
65 echo wp_kses_post( str_replace(array('fas fa-','fa fa-'),'lp-icon-', $profile_tab->get( 'icon' ) ));
66 }
67 ?>
68 <?php echo apply_filters( 'learn_press_profile_' . $tab_key . '_tab_title', $profile_tab->get( 'title' ), $tab_key ); ?>
69 </a>
70
71 <?php if ( $sections && sizeof( $sections ) > 1 ) { ?>
72
73 <ul class="profile-tab-sections">
74 <?php
75 foreach ( $sections as $section_key => $section_data ) {
76
77 $classes = array( esc_attr( $section_key ) );
78 if ( $profile->is_current_section( $section_key, $section_key ) ) {
79 $classes[] = 'active';
80 }
81
82 $section_slug = $profile->get_slug( $section_data, $section_key );
83 $section_link = $profile->get_tab_link( $tab_key, $section_slug );
84 ?>
85
86 <li class="<?php echo implode( ' ', $classes ); ?>">
87 <a href="<?php echo esc_url_raw( $section_link ); ?>">
88 <?php
89 if ( ! empty( $section_data['icon'] ) ) {
90 echo wp_kses_post( $section_data['icon'] );
91 }
92 ?>
93 <?php echo apply_filters(
94 'learn_press_profile_' . $tab_key . '_tab_title',
95 $section_data['title'],
96 $tab_key,
97 $section_key,
98 $section_data
99 ); ?>
100 </a>
101 </li>
102
103 <?php } ?>
104
105 </ul>
106
107 <?php } ?>
108
109 </li>
110 <?php } ?>
111
112 </ul>
113
114 <?php do_action( 'learn-press/after-profile-nav', $profile ); ?>
115
116 </div>
117