
<?php
$action = get_query_var('action') ?: 'collection';
$user_id        = get_current_user_id();
get_header();

$action_file = get_template_directory().'/user/action/'.$action.'.php';

?>
<section class="ceo-background-default ceo-position-relative">
	<div class="author-head ceo-inline ceo-width-1-1 ceo-overflow-hidden">
	    <img src="<?php echo _ceo('user_default_thum'); ?>">
	</div>
</section>
<section class="ceo-container ceo-margin-medium-bottom" style="transform: translateY(-50px);">
	<div ceo-grid>
		<div class="ceo-user-sidebar sidebar k-width-auto">
			<div class="side-author b-r-4 ceo-background-default ceo-overflow-hidden">
				<div class="user-info ceo-padding-small ceo-position-relative">
					<div class="ceo-grid-small ceo-position-relative ceo-position-z-index" ceo-grid>
						<div class="avatar ceo-width-auto">
							<?php echo get_avatar( $user_id,'60' ); ?>
						</div>
						<div class="ceo-user-name ceo-width-expand">
							<p class="ceo-text-bolder ceo-margin-remove"><?php the_author_meta('nickname',$user_id); ?></p>
							<p class="ceo-text-small ceo-text-muted">
								<?php echo the_author_meta('user_description', $user_id);?>
							</p>
						</div>
					</div>
					<div class="side-author-count b-r-4 ceo-padding-small ceo-background-default ceo-margin-top ceo-position-relative ceo-position-z-index">
						<ul class="ceo-grid-collapse" ceo-grid>
							<li class="ceo-width-1-3 ceo-display-inline-block ceo-text-center">
								<p class="ceo-h4 ceo-margin-remove"><?php echo count_user_posts($user_id); ?></p>
								<span class="ceo-text-small">文章</span>
							</li>
							<li class="ceo-width-1-3 ceo-display-inline-block ceo-text-center">
								<p class="ceo-h4 ceo-margin-remove"><?php echo cx_posts_views($user_id); ?></p>
								<span class="ceo-text-small">浏览</span>
							</li>
							<li class="ceo-width-1-3 ceo-display-inline-block ceo-text-center">
								<p class="ceo-h4 ceo-margin-remove"><?php echo count_collection_posts($user_id) ?></p>
								<span class="ceo-text-small">收藏</span>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="user-data ceo-background-default">
				<div class="user-data-title b-b">
					<span class="ceo-display-inline-block">我的资料</span>
				</div>
				<ul class="ceo-list ceo-padding-remove ceo-margin-remove-bottom">
					<li class="b-b ceo-text-small">UID：<?php echo get_the_author_meta('ID',$user_id); ?></li>
					<li class="b-b ceo-text-small">QQ：<?php echo get_the_author_meta('qq',$user_id); ?></li>
					<li class="b-b ceo-text-small">微信：<?php echo get_the_author_meta('weixinhaoma',$user_id); ?></li>
					<li class="ceo-text-small">微博：<?php echo the_author_meta( 'weibo', $user_id); ?></li>
					<li class="ceo-text-small">邮箱：<?php echo the_author_meta( 'user_email', $user_id); ?></li>
				</ul>
			</div>
		</div>
		<div class="ceo-width-expand">
			<ul class="ceo-user-apps-a user-menu author-menu ceo-padding-remove ceo-margin-remove">
				<li class="ceo-display-inline-block <?php if($action == '' || $action == 'collection') echo 'ceo-active';?>">
					<a href="<?php echo home_url(user_trailingslashit('/user/collection')); ?>" class="ceo-display-inline-block ceo-position-relative">
						<i class="iconfont icon-collection"></i> 我的收藏
					</a>
				</li>
				<li class="ceo-display-inline-block <?php if($action == 'comment') echo 'ceo-active';?>" class="ceo-display-inline-block">
					<a href="<?php echo home_url(user_trailingslashit('/user/comment')); ?>" class="ceo-display-block ceo-position-relative">
						<i class="iconfont icon-comments"></i> 我的评论
					</a>
				</li>
				<li class="ceo-display-inline-block <?php if($action == 'settings') echo 'ceo-active';?>" class="ceo-display-inline-block">
					<a href="<?php echo home_url(user_trailingslashit('/user/settings')); ?>" class="ceo-display-block ceo-position-relative">
						<i class="iconfont icon-bussiness-man"></i>个人资料
					</a>
				</li>
				<li class="ceo-display-inline-block <?php if($action == 'security') echo 'ceo-active';?>" class="ceo-display-inline-block">
					<a href="<?php echo home_url(user_trailingslashit('/user/security')); ?>" class="ceo-display-block ceo-position-relative">
						<i class="iconfont icon-security"></i> 账号安全
					</a>
				</li>
                <li class="ceo-display-inline-block <?php if($action == 'settings2') echo 'ceo-active';?>" class="ceo-display-inline-block">
                    <a href="<?php echo home_url(user_trailingslashit('/users?pd=money')); ?>" class="ceo-display-block ceo-position-relative">
                        <i class="iconfont icon-cart-full"></i>商城中心
                    </a>
                </li>
				<li class="ceo-display-inline-block <?php if($action == 'security2') echo 'ceo-active';?>" class="ceo-display-inline-block">
					<a href="<?php echo home_url(user_trailingslashit('tougao')); ?>" class="ceo-display-block ceo-position-relative">
						<i class="iconfont icon-bianji"></i> 创作中心
					</a>
				</li>
				<li class="ceo-display-inline-block">
					<a href="<?php echo wp_logout_url( home_url() ); ?>" class="ceo-display-block ceo-position-relative"><i class="iconfont icon-resonserate"></i> 退出登录</a>
				</li>
			</ul>
			<div class="user-content ceo-margin-medium-top">

				<?php
				if(!is_file($action_file)){
					include(get_template_directory().'/user/action/settings.php'); //用户中心默认页面
				}else{
					include($action_file);
				}?>

			</div>
		</div>
	</div>
</section>
<?php get_footer(); ?>
