| @@ -1,55 +1,55 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template for displaying user profile content. | |
| 4 | - * | |
| 5 | - * This template can be overridden by copying it to yourtheme/learnpress/profile/content.php. | |
| 6 | - * | |
| 7 | - * @author ThimPress | |
| 8 | - * @package Learnpress/Templates | |
| 9 | - * @version 4.0.2 | |
| 10 | - */ | |
| 11 | - | |
| 12 | -defined( 'ABSPATH' ) || exit(); | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * @var LP_Profile_Tab $profile_tab | |
| 16 | - */ | |
| 17 | -if ( ! isset( $user ) || ! isset( $tab_key ) || ! isset( $profile ) || ! isset( $profile_tab ) ) { | |
| 18 | - return; | |
| 19 | -} | |
| 20 | -?> | |
| 21 | - | |
| 22 | -<article id="profile-content" class="lp-profile-content"> | |
| 23 | - <div id="profile-content-<?php echo esc_attr( $tab_key ); ?>"> | |
| 24 | - <?php do_action( 'learn-press/before-profile-content', $tab_key, $profile_tab, $user ); ?> | |
| 25 | - | |
| 26 | - <?php | |
| 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 | - ); | |
| 37 | - } else { | |
| 38 | - do_action( 'learn-press/profile-content', $tab_key, $profile_tab, $user ); | |
| 39 | - } | |
| 40 | - } else { | |
| 41 | - foreach ( $profile_tab->get( 'sections' ) as $key => $section ) { | |
| 42 | - if ( $profile->get_current_section( '', false, false ) === $section['slug'] ) { | |
| 43 | - if ( isset( $section['callback'] ) && is_callable( $section['callback'] ) ) { | |
| 44 | - echo call_user_func_array( $section['callback'], array( $key, $section, $user ) ); | |
| 45 | - } else { | |
| 46 | - do_action( 'learn-press/profile-section-content', $key, $section, $user ); | |
| 47 | - } | |
| 48 | - } | |
| 49 | - } | |
| 50 | - } | |
| 51 | - ?> | |
| 52 | - | |
| 53 | - <?php do_action( 'learn-press/after-profile-content' ); ?> | |
| 54 | - </div> | |
| 55 | -</article> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template for displaying user profile content. | |
| 4 | + * | |
| 5 | + * This template can be overridden by copying it to yourtheme/learnpress/profile/content.php. | |
| 6 | + * | |
| 7 | + * @author ThimPress | |
| 8 | + * @package Learnpress/Templates | |
| 9 | + * @version 4.0.2 | |
| 10 | + */ | |
| 11 | + | |
| 12 | +defined( 'ABSPATH' ) || exit(); | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * @var LP_Profile_Tab $profile_tab | |
| 16 | + */ | |
| 17 | +if ( ! isset( $user ) || ! isset( $tab_key ) || ! isset( $profile ) || ! isset( $profile_tab ) ) { | |
| 18 | + return; | |
| 19 | +} | |
| 20 | +?> | |
| 21 | + | |
| 22 | +<article id="profile-content" class="lp-profile-content"> | |
| 23 | + <div id="profile-content-<?php echo esc_attr( $tab_key ); ?>"> | |
| 24 | + <?php do_action( 'learn-press/before-profile-content', $tab_key, $profile_tab, $user ); ?> | |
| 25 | + | |
| 26 | + <?php | |
| 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 | + ); | |
| 37 | + } else { | |
| 38 | + do_action( 'learn-press/profile-content', $tab_key, $profile_tab, $user ); | |
| 39 | + } | |
| 40 | + } else { | |
| 41 | + foreach ( $profile_tab->get( 'sections' ) as $key => $section ) { | |
| 42 | + if ( $profile->get_current_section( '', false, false ) === $section['slug'] ) { | |
| 43 | + if ( isset( $section['callback'] ) && is_callable( $section['callback'] ) ) { | |
| 44 | + echo call_user_func_array( $section['callback'], array( $key, $section, $user ) ); | |
| 45 | + } else { | |
| 46 | + do_action( 'learn-press/profile-section-content', $key, $section, $user ); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | + ?> | |
| 52 | + | |
| 53 | + <?php do_action( 'learn-press/after-profile-content' ); ?> | |
| 54 | + </div> | |
| 55 | +</article> | |