hesabixWpTheme/anspress/addons/user/index.php

55 lines
1.7 KiB
PHP

<?php
/**
* پروفایل کاربر — طرح hesabix2
*
* @package Hesabix2
* @subpackage AnsPress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$user_id = ap_current_user_id();
$current_tab = ap_sanitize_unslash( 'tab', 'r', 'questions' );
$login_url = function_exists( 'hesabix2_anspress_login_url' ) ? hesabix2_anspress_login_url() : wp_login_url();
?>
<div id="ap-user" class="ap-user hesabix2-ap-user ap-card-qa bg-white rounded-2xl shadow-sm border border-slate-100 p-5 sm:p-6">
<?php if ( '0' === (string) $user_id && ! is_user_logged_in() ) : ?>
<h1 class="text-xl font-bold text-slate-800 mb-2"><?php esc_html_e( 'برای مشاهدهٔ پروفایل وارد شوید', 'hesabix2' ); ?></h1>
<a href="<?php echo esc_url( $login_url ); ?>" class="inline-flex items-center gap-2 bg-brand-500 hover:bg-brand-600 text-white px-5 py-2.5 rounded-xl font-semibold"><?php esc_html_e( 'ورود', 'hesabix2' ); ?></a>
<?php else : ?>
<div class="ap-user-bio flex gap-4 mb-6 pb-6 border-b border-slate-100">
<div class="ap-user-avatar flex-shrink-0 ring-2 ring-white shadow-sm rounded-full overflow-hidden">
<?php echo get_avatar( $user_id, 80 ); ?>
</div>
<div class="min-w-0 flex-1">
<div class="ap-user-name text-lg font-bold text-slate-800 mb-1">
<?php
echo ap_user_display_name(
array(
'user_id' => $user_id,
'html' => true,
)
);
?>
</div>
<div class="ap-user-about text-slate-600 text-sm leading-relaxed">
<?php echo esc_html( get_user_meta( $user_id, 'description', true ) ); ?>
</div>
</div>
</div>
<?php ap_user_page_tabs(); ?>
<div class="ap-user-tab-content mt-6">
<?php ap_user_page_tab_content(); ?>
</div>
<?php endif; ?>
</div>