static function profile()
 {
     global $wp_query, $wp;
     if (isset($wp_query->query['user'])) {
         $user = get_user_by('login', $wp_query->query['user']);
     } else {
         $user = get_user_by('id', get_current_user_id());
     }
     $output = '';
     ob_start();
     if (!$user) {
         if (empty($wp_query->query['user'])) {
             learn_press_get_template('profile/private-area.php');
         } else {
             learn_press_display_message(sprintf(__('The user %s in not available!', 'learn_press'), $wp_query->query['user']), 'error');
         }
     } else {
         $user = LP_User::get_user($user->id);
         $tabs = learn_press_user_profile_tabs($user);
         if (!empty($wp->query_vars['view'])) {
             $current = $wp->query_vars['view'];
         } else {
             $tab_keys = array_keys($tabs);
             $current = reset($tab_keys);
         }
         if (!learn_press_current_user_can_view_profile_section($current, $user)) {
             learn_press_get_template('profile/private-area.php');
         } else {
             if (!empty($tabs) && !empty($tabs[$current])) {
                 learn_press_get_template('profile/index.php', array('user' => $user, 'tabs' => $tabs, 'current' => $current));
             } else {
                 if ($wp->query_vars['view'] == LP()->settings->get('profile_endpoints.profile-order-details')) {
                     /*
                     						$current_user = wp_get_current_user();
                     						if ( $wp_query->query_vars['user'] != $current_user->user_login ) {
                     							learn_press_get_template( 'profile/private-area.php' );
                     							return;
                     						}*/
                     $order_id = 0;
                     if (!empty($wp->query_vars['id'])) {
                         $order_id = $wp->query_vars['id'];
                     }
                     $order = learn_press_get_order($order_id);
                     if (!$order) {
                         learn_press_display_message(__('Invalid order!', 'learn_press'), 'error');
                     } else {
                         learn_press_get_template('profile/order-details.php', array('user' => $user, 'order' => $order));
                     }
                 }
             }
         }
     }
     $output .= ob_get_clean();
     return $output;
 }
Beispiel #2
0
<?php

/**
 * User Profile tabs
 *
 * @author  ThimPress
 * @package LearnPress/Templates
 * @version 1.0
 */
if (!defined('ABSPATH')) {
    exit;
}
global $wp_query;
$tabs = learn_press_user_profile_tabs($user);
if (!empty($wp_query->query_vars['tab'])) {
    $current = $wp_query->query_vars['tab'];
} else {
    $current = reset(array_keys($tabs));
}
if (!empty($tabs)) {
    ?>

	<div class="user-profile-tabs learn-press-tabs-wrapper">

		<?php 
    foreach ($tabs as $id => $tab) {
        ?>
			<div class="panel entry-content learn-press-tab" id="tab-<?php 
        echo esc_attr($id);
        ?>
">