| @@ -5,13 +5,16 @@ | ||
| 5 | 5 | * This template can be overridden by copying it to yourtheme/learnpress/profile/content.php. |
| 6 | 6 | * |
| 7 | 7 | * @author ThimPress |
| 8 | 8 | * @package Learnpress/Templates |
| 9 | - * @version 4.0.0 | |
| 9 | + * @version 4.0.2 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | defined( 'ABSPATH' ) || exit(); |
| 13 | 13 | |
| 14 | +/** | |
| 15 | + * @var LP_Profile_Tab $profile_tab | |
| 16 | + */ | |
| 14 | 17 | if ( ! isset( $user ) || ! isset( $tab_key ) || ! isset( $profile ) || ! isset( $profile_tab ) ) { |
| 15 | 18 | return; |
| 16 | 19 | } |
| 17 | 20 | ?> |
| @@ -16,21 +19,27 @@ | ||
| 16 | 19 | } |
| 17 | 20 | ?> |
| 18 | 21 | |
| 19 | 22 | <article id="profile-content" class="lp-profile-content"> |
| 20 | - <?php learn_press_print_messages( true ); ?> | |
| 21 | 23 | <div id="profile-content-<?php echo esc_attr( $tab_key ); ?>"> |
| 22 | 24 | <?php do_action( 'learn-press/before-profile-content', $tab_key, $profile_tab, $user ); ?> |
| 23 | 25 | |
| 24 | 26 | <?php |
| 25 | - if ( empty( $profile_tab['sections'] ) ) { | |
| 26 | - if ( is_callable( $profile_tab['callback'] ) ) { | |
| 27 | - echo call_user_func_array( $profile_tab['callback'], array( $tab_key, $profile_tab, $user ) ); | |
| 27 | + if ( empty( $profile_tab->get( 'sections' ) ) ) { | |
| 28 | + if ( $profile_tab->get( 'callback' ) && is_callable( $profile_tab->get( 'callback' ) ) ) { | |
| 29 | + echo call_user_func_array( | |
| 30 | + $profile_tab->get( 'callback' ), | |
| 31 | + [ | |
| 32 | + $tab_key, | |
| 33 | + $profile_tab, | |
| 34 | + $user, | |
| 35 | + ] | |
| 36 | + ); | |
| 28 | 37 | } else { |
| 29 | 38 | do_action( 'learn-press/profile-content', $tab_key, $profile_tab, $user ); |
| 30 | 39 | } |
| 31 | 40 | } else { |
| 32 | - foreach ( $profile_tab['sections'] as $key => $section ) { | |
| 41 | + foreach ( $profile_tab->get( 'sections' ) as $key => $section ) { | |
| 33 | 42 | if ( $profile->get_current_section( '', false, false ) === $section['slug'] ) { |
| 34 | 43 | if ( isset( $section['callback'] ) && is_callable( $section['callback'] ) ) { |
| 35 | 44 | echo call_user_func_array( $section['callback'], array( $key, $section, $user ) ); |
| 36 | 45 | } else { |