| 1 |
<?php |
| 2 |
/** |
| 3 |
* Profile tabs template (default) |
| 4 |
* |
| 5 |
* @ver 0.0.1 |
| 6 |
*/ |
| 7 |
$css_class = ! empty( $args['css_class'] ) ? esc_attr( $args['css_class'] ) : ''; |
| 8 |
$output = ! empty( $args['output'] ) ? esc_attr( $args['output'] ) : ''; |
| 9 |
$account_page = uwp_get_page_id( 'account_page', false ); |
| 10 |
$tabs_array = $args['tabs_array']; |
| 11 |
$active_tab = $args['active_tab']; |
| 12 |
|
| 13 |
do_action( 'uwp_template_before', 'profile-tabs' ); |
| 14 |
$user = uwp_get_displayed_user(); |
| 15 |
if ( ! $user ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
echo '<div class="uwp-profile-content">'; |
| 20 |
if ( $output === '' || $output == 'head' ) { |
| 21 |
?> |
| 22 |
<div class="uwp-profile-nav"> |
| 23 |
<ul class="item-list-tabs-ul"> |
| 24 |
<?php |
| 25 |
if ( ! empty( $tabs_array ) ) { |
| 26 |
foreach ( $tabs_array as $tab ) { |
| 27 |
$tab_id = $tab['tab_key']; |
| 28 |
$tab_url = uwp_build_profile_tab_url( $user->ID, $tab_id, false ); |
| 29 |
|
| 30 |
$active = $active_tab == $tab_id ? ' active' : ''; |
| 31 |
|
| 32 |
if ( $active_tab == $tab_id ) { |
| 33 |
$active_tab_content = $tab['tab_content_rendered']; |
| 34 |
} |
| 35 |
|
| 36 |
?> |
| 37 |
<li id="uwp-profile-<?php echo esc_attr( $tab_id ); ?>" |
| 38 |
class="<?php echo esc_attr( $active ); ?>"> |
| 39 |
<a href="<?php echo esc_url( $tab_url ); ?>"> |
| 40 |
<span class="uwp-profile-tab-label uwp-profile-<?php echo esc_attr( $tab_id ); ?>-label "><?php esc_html_e( $tab['tab_name'], 'userswp' ); ?></span> |
| 41 |
</a> |
| 42 |
</li> |
| 43 |
<?php |
| 44 |
} |
| 45 |
} |
| 46 |
?> |
| 47 |
</ul> |
| 48 |
<?php |
| 49 |
$can_user_edit_account = apply_filters( 'uwp_user_can_edit_own_profile', true, $user->ID ); |
| 50 |
?> |
| 51 |
<?php if ( $account_page && is_user_logged_in() && ( get_current_user_id() == $user->ID ) && $can_user_edit_account ) { ?> |
| 52 |
<div class="uwp-edit-account"> |
| 53 |
<a href="<?php echo esc_url( get_permalink( $account_page ) ); ?>" |
| 54 |
title="<?php esc_attr_e( 'Edit Account', 'userswp' ); ?>"><i class="fas fa-cog"></i></a> |
| 55 |
</div> |
| 56 |
<?php } ?> |
| 57 |
</div> |
| 58 |
<?php |
| 59 |
} |
| 60 |
if ( $output === '' || $output == 'body' ) { |
| 61 |
if ( isset( $active_tab_content ) && ! empty( $active_tab_content ) ) { |
| 62 |
?> |
| 63 |
<div class="uwp-profile-entries"> |
| 64 |
<?php |
| 65 |
echo $active_tab_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 66 |
?> |
| 67 |
</div> |
| 68 |
<?php } ?> |
| 69 |
<?php } |
| 70 |
echo '</div>'; |
| 71 |
do_action( 'uwp_template_after', 'profile-tabs' ); ?> |