| 1 |
<?php |
| 2 |
/** |
| 3 |
* Profile header template (default) |
| 4 |
* |
| 5 |
* @ver 0.0.1 |
| 6 |
*/ |
| 7 |
global $userswp, $uwp_in_user_loop; |
| 8 |
$css_class = ! empty( $args['css_class'] ) ? esc_attr( $args['css_class'] ) : 'border-0'; |
| 9 |
$hide_cover = $args['hide_cover']; |
| 10 |
$allow_change = $args['allow_change']; |
| 11 |
$hide_avatar = $args['hide_avatar']; |
| 12 |
$avatar_url = $args['avatar_url']; |
| 13 |
$banner_url = $args['banner_url']; |
| 14 |
$user_id = $args['user_id']; |
| 15 |
|
| 16 |
if ( $user_id ) { |
| 17 |
$user = get_userdata( $user_id ); |
| 18 |
} else { |
| 19 |
$user = uwp_get_displayed_user(); |
| 20 |
} |
| 21 |
|
| 22 |
if ( ! $user ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
if ( ! $uwp_in_user_loop ){ ?> |
| 27 |
<div class="card shadow-0 border-0 mw-100"><?php } |
| 28 |
|
| 29 |
if ( ! $hide_cover ) { |
| 30 |
if ( $uwp_in_user_loop ) { |
| 31 |
echo '<a href="' . esc_url( uwp_build_profile_tab_url( $user->ID ) ) . '" title="' . esc_attr( $user->display_name ). '">'; |
| 32 |
} ?> |
| 33 |
<img class="card-img-top m-0 p-0 uwp-banner-image" src="<?php echo esc_url( $banner_url ); ?>" |
| 34 |
alt="<?php esc_attr_e( "User banner image", "userswp" ); ?>"> |
| 35 |
<?php if ( $uwp_in_user_loop ) { |
| 36 |
echo '</a>'; |
| 37 |
} ?> |
| 38 |
|
| 39 |
<?php if ( ! $uwp_in_user_loop && is_user_logged_in() && $allow_change && ( get_current_user_id() == $user->ID ) ) { ?> |
| 40 |
<div class="card-img-overlay p-1 bg-shadow-bottom-dd"> |
| 41 |
<?php |
| 42 |
echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 43 |
'type' => 'a', |
| 44 |
'href' => '#', |
| 45 |
'class' => 'btn btn-sm uwp-banner-change-icon btn-outline-secondary border-0', |
| 46 |
'icon' => 'fas fa-camera fa-fw', |
| 47 |
'title' => '', |
| 48 |
'onclick' => "uwp_profile_image_change('banner');return false;", |
| 49 |
'extra_attributes' => array( 'data-toggle' => 'tooltip', 'data-original-title' => esc_html__( 'Update Profile Image', 'userswp' ) |
| 50 |
) |
| 51 |
) ); |
| 52 |
?> |
| 53 |
</div> |
| 54 |
<?php } |
| 55 |
|
| 56 |
} ?> |
| 57 |
|
| 58 |
<div class="card-body <?php if ( ! $uwp_in_user_loop ) { ?>mt-xl-0 pt-0<?php } else { ?>text-center pb-0<?php } ?>"> |
| 59 |
|
| 60 |
<div class="row justify-content-center"> |
| 61 |
|
| 62 |
<?php if ( ! $hide_avatar ) { ?> |
| 63 |
<div class="col <?php if ( $uwp_in_user_loop ) { ?>col-5<?php } ?> text-center tofront "> |
| 64 |
<?php if ( $uwp_in_user_loop ) { |
| 65 |
echo '<a href="' . esc_url( uwp_build_profile_tab_url( $user->ID ) ) . '" title="' . esc_attr( $user->display_name ) . '">'; |
| 66 |
} ?> |
| 67 |
<img class="rounded-circle shadow border border-white border-width-4 p-0 mw-100 <?php if ( ! $hide_cover ) { |
| 68 |
echo "mt-neg5"; |
| 69 |
} ?>" |
| 70 |
src="<?php echo esc_url( $avatar_url ); ?>" alt="<?php esc_html_e( "User avatar", "userswp" ); ?>"> |
| 71 |
<?php if ( $uwp_in_user_loop ) { |
| 72 |
echo '</a>'; |
| 73 |
} ?> |
| 74 |
|
| 75 |
<?php if ( ! $uwp_in_user_loop && is_user_logged_in() && ( get_current_user_id() == $user->ID ) && $allow_change ) { ?> |
| 76 |
<div class="card-img-overlay p-0"> |
| 77 |
<?php |
| 78 |
echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 79 |
'type' => 'a', |
| 80 |
'href' => '#', |
| 81 |
'class' => 'btn btn-sm uwp-banner-change-icon btn-outline-secondary btn-circle border-0 align-self-end mx-auto', |
| 82 |
'icon' => 'fas fa-camera fa-fw', |
| 83 |
'title' => '', |
| 84 |
'onclick' => "uwp_profile_image_change('avatar');return false;", |
| 85 |
'extra_attributes' => array( 'data-toggle' => 'tooltip', 'data-original-title' => esc_html__( 'Update Profile Image', 'userswp' ) |
| 86 |
) |
| 87 |
) ); |
| 88 |
?> |
| 89 |
</div> |
| 90 |
<?php } ?> |
| 91 |
</div> |
| 92 |
<?php } ?> |
| 93 |
|
| 94 |
<div class="col-12 <?php if ( ! $uwp_in_user_loop ) { |
| 95 |
echo $hide_avatar ? "col-xl-8" : "col-xl-6"; ?> text-xl-left text-xl-start pt-xl-1<?php } ?> text-center "> |
| 96 |
<ul class="list-group border-0 m-0 p-0 bg-transparent"> |
| 97 |
<li class="list-group-item border-0 m-0 p-0 bg-transparent uwp-profile-title"> |
| 98 |
<?php |
| 99 |
// User title. |
| 100 |
if ( $uwp_in_user_loop ) { |
| 101 |
$userswp->profile->get_profile_title( $user, $tag = 'h4', 'h4 card-title text-dark font-weight-bold m-0 p-0', 'text-muted', true ); |
| 102 |
} else { |
| 103 |
$userswp->profile->get_profile_title( $user, $tag = 'h2', 'h2 card-title text-dark font-weight-bold m-0 p-0', '', false ); |
| 104 |
} |
| 105 |
?> |
| 106 |
</li> |
| 107 |
</ul> |
| 108 |
<?php echo do_shortcode( "[uwp_user_post_counts disable_greedy=".esc_attr($args['disable_greedy'])."]" ); ?> |
| 109 |
</div> |
| 110 |
<div class="col-12 <?php if ( ! $uwp_in_user_loop ) { ?>col-xl-4 text-xl-right <?php } ?> text-center pt-2"> |
| 111 |
<?php |
| 112 |
echo do_shortcode( "[uwp_button_group]" ); |
| 113 |
?> |
| 114 |
</div> |
| 115 |
</div> |
| 116 |
|
| 117 |
<?php if ( ! $uwp_in_user_loop && is_uwp_profile_page() ) { ?> |
| 118 |
|
| 119 |
<div class="row justify-content-center"> |
| 120 |
<div class="col"> |
| 121 |
</div> |
| 122 |
<div class="col-12 <?php echo $hide_avatar ? "col-xl-8" : "col-xl-6"; ?> text-xl-start text-xl-end pt-xl-1"> |
| 123 |
<?php |
| 124 |
echo do_shortcode( "[uwp_user_actions]" ); |
| 125 |
?> |
| 126 |
</div> |
| 127 |
<div class="col-12 col-xl-4 text-xl-right text-right"> |
| 128 |
<?php |
| 129 |
echo do_shortcode( "[uwp_profile_actions]" ); |
| 130 |
?> |
| 131 |
</div> |
| 132 |
</div> |
| 133 |
|
| 134 |
<?php } ?> |
| 135 |
|
| 136 |
</div> |
| 137 |
|
| 138 |
<?php if ( ! $uwp_in_user_loop ){ ?></div><?php } ?> |
| 139 |
|