PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 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 All 139 releases
← All changes | templates/profile/tabs.php +20 -10 4.2.04.4.8 View file →
@@ -5,35 +5,38 @@
5 5 * This template can be overridden by copying it to yourtheme/learnpress/profile/tabs.php.
6 6 *
7 7 * @author ThimPress
8 8 * @package Learnpress/Templates
9 - * @version 4.0.2
9 + * @version 4.0.4
10 10 */
11 11
12 12 defined( 'ABSPATH' ) || exit();
13 13
14 +/**
15 + * @var LP_Profile $profile
16 + */
14 17 if ( ! isset( $user ) || ! isset( $profile ) ) {
15 18 return;
16 19 }
17 20 ?>
18 21
19 -<div id="profile-nav">
22 +<div id="profile-nav" class="profile-nav">
20 23
21 24 <?php do_action( 'learn-press/before-profile-nav', $profile ); ?>
22 25
23 26 <ul class="lp-profile-nav-tabs">
24 -
25 27 <?php
26 28 /**
27 29 * @var LP_Profile_Tab $profile_tab
28 30 */
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 + $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 ) ) {
31 34 continue;
32 35 }
33 36
34 37 // Admin view another user profile
35 - if ( $profile->get_user()->get_id() !== get_current_user_id() && current_user_can( ADMIN_ROLE ) ) {
38 + if ( $profile->get_user()->get_id() !== $profile->get_user_current()->get_id() && current_user_can( ADMIN_ROLE ) ) {
36 39 $tab_key_hidden_admin_view_user = [ 'settings', 'logout', 'orders', 'gradebook' ];
37 40 if ( in_array( $tab_key, $tab_key_hidden_admin_view_user ) ) {
38 41 continue;
39 42 }
@@ -39,9 +42,10 @@
39 42 }
40 43 }
41 44
42 45 $slug = $profile->get_slug( $profile_tab, $tab_key );
43 - $link = $profile->get_tab_link( $tab_key, true );
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';
44 48 $tab_classes = array( esc_attr( $tab_key ) );
45 49
46 50 $sections = $profile_tab->sections();
47 51
@@ -54,12 +58,12 @@
54 58 }
55 59 ?>
56 60
57 61 <li class="<?php echo implode( ' ', $tab_classes ); ?>">
58 - <a href="<?php echo esc_url_raw( $link ); ?>" data-slug="<?php echo esc_attr( $link ); ?>">
62 + <a href="<?php echo esc_url_raw( $link ); ?>" data-slug="<?php echo esc_attr( $link ); ?>" target="<?php echo esc_attr( $target ); ?>">
59 63 <?php
60 64 if ( ! empty( $profile_tab->get( 'icon' ) ) ) {
61 - echo wp_kses_post( $profile_tab->get( 'icon' ) );
65 + echo wp_kses_post( str_replace(array('fas fa-','fa fa-'),'lp-icon-', $profile_tab->get( 'icon' ) ));
62 66 }
63 67 ?>
64 68 <?php echo apply_filters( 'learn_press_profile_' . $tab_key . '_tab_title', $profile_tab->get( 'title' ), $tab_key ); ?>
65 69 </a>
@@ -85,9 +89,15 @@
85 89 if ( ! empty( $section_data['icon'] ) ) {
86 90 echo wp_kses_post( $section_data['icon'] );
87 91 }
88 92 ?>
89 - <?php echo apply_filters( 'learn_press_profile_' . $tab_key . '_tab_title', $section_data['title'], $tab_key ); ?>
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 + ); ?>
90 100 </a>
91 101 </li>
92 102
93 103 <?php } ?>