<em class="ceo-display-inline-block"></em>
<?php if ( is_user_logged_in() ) { ?>
<?php
	global $current_user;
	$current_user = wp_get_current_user();
	$authorID = $current_user->ID;
?>
<div class="head-avatar">
	<a href="#" class="avatar ceo-display-inline-block"><?php echo get_avatar($authorID, 36); ?></a>
	<div class="user-down ceo-position-top-right ceo-margin-medium-right ceo-animation-slide-top-small">
		<div class="user-down-main b-r-4 ceo-overflow-hidden ceo-background-default">
			<div class="user-info ceo-position-relative">
                <?php if(true){
                    global $wpdb;
                    $okMoney = erphpGetUserOkMoney();
                    $userMoney=$wpdb->get_row("select * from ".$wpdb->iceinfo." where ice_user_id=".get_current_user_id());

                    $userTypeId=getUsreMemberType();
                    if($userTypeId==7)
                    {
                        $userTypename= "包月会员";
                    }
                    elseif ($userTypeId==8)
                    {
                        $userTypename= "包季会员";
                    }
                    elseif ($userTypeId==9)
                    {
                        $userTypename= "包年会员";
                    }
                    elseif ($userTypeId==10)
                    {
                        $userTypename= "终身会员";
                    }
                    else
                    {
                        $userTypename= '普通用户';
                    }

                    if(!$userMoney){
                        $okMoney=0;
                    }else{
                        $okMoney=$userMoney->ice_have_money - $userMoney->ice_get_money;

                    }
                    $total_money   = $wpdb->get_var("SELECT SUM(ice_price) FROM $wpdb->icealipay WHERE ice_success>0 and ice_user_id=".get_current_user_id());
                    if(empty($total_money)){
                        $total_money='0';
                    }
                    ?>
				<div class="user-down-info ceo-grid-small ceo-position-relative ceo-position-z-index" ceo-grid>
					<div class="ceo-width-auto">
						<div class="avatar">
							<?php $get_avatar_html=get_avatar($authorID, 50);
							if($get_avatar_html){
                                $get_avatar_html=str_replace(array('http://','https://'),'//',$get_avatar_html);
                            }
                            echo $get_avatar_html;
							?>
						</div>
					</div>
					<div class="ceo-width-expand ceo-padding-top-4">
					    <ul>
						<h4 class="ceo-text-bolder"><?php echo $current_user->display_name; ?></h4><i><?php echo $userTypename;?></i>
						</ul>
						<p class="ceo-text-small ceo-text-muted ceo-margin-remove"style="font-size: 0.675rem;"><?php the_author_meta( 'description', $authorID ); ?></p>
					</div>
				</div>
                <div>
                    <li class="first">
                        <?php if(_ceo('ceo_user_t_yexf') == true ): ?>
                        <div class="user-money clearfix">
                            <div class="money-left">余额：<?php echo sprintf("%.2f",$okMoney);?><t>消费：<?php echo intval($userMoney->ice_get_money)?></t></div>
                        </div>
                        <?php endif; ?>
                        
                        <?php if(_ceo('ceo_user_t_vip') == true ): ?>
                        <div class="user-vip clearfix">
                            <div class="vip-left">
                                <?php echo $userTypename;?><v onclick="javascript:location.href='<?php if(_ceo('ceo_user_t_vip_sz'))echo _ceo('ceo_user_t_vip_sz')['ceo_user_t_vip_link']; ?>';"><?php if(_ceo('ceo_user_t_vip_sz'))echo _ceo('ceo_user_t_vip_sz')['ceo_user_t_vip_title']; ?></v>
                                <div class="down-left"><?php if(_ceo('ceo_user_t_vip_sz'))echo _ceo('ceo_user_t_vip_sz')['ceo_user_t_vip_desc']; ?></div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </li>
                </div>
                <?php }?>
                <div class="ceo-usertc">
                    <ul class="ceo-czgr">
                        <li class="ceo-users-z">
                        <a class="ceo-cz" href="<?php if(_ceo('ceo_user_tg_sz'))echo _ceo('ceo_user_tg_sz')['ceo_user_tg_link']; ?>">
                            <i class="iconfont <?php if(_ceo('ceo_user_tg_sz'))echo _ceo('ceo_user_tg_sz')['ceo_user_tg_icon']; ?>"></i> <?php if(_ceo('ceo_user_tg_sz'))echo _ceo('ceo_user_tg_sz')['ceo_user_tg_title']; ?></a>  
                        </li>
                        <li class="ceo-users-z">
                        <a class="ceo-gr" href="<?php if(_ceo('ceo_user_gr_sz'))echo _ceo('ceo_user_gr_sz')['ceo_user_gr_link']; ?>">
                    		<i class="iconfont <?php if(_ceo('ceo_user_gr_sz'))echo _ceo('ceo_user_gr_sz')['ceo_user_gr_icon']; ?>"></i> <?php if(_ceo('ceo_user_gr_sz'))echo _ceo('ceo_user_gr_sz')['ceo_user_gr_title']; ?>
                    	</a>
                        </li>
                    </ul>
                    <span class="ceo-users-s">
                        <a href="<?php if(_ceo('ceo_user_sc_sz'))echo _ceo('ceo_user_sc_sz')['ceo_user_sc_link']; ?>"> <?php if(_ceo('ceo_user_sc_sz'))echo _ceo('ceo_user_sc_sz')['ceo_user_sc_title']; ?></a>
                    </span>
                </div>
				<div class="ceo-user-t user-info-menu ceo-padding-small ceo-background-default ceo-margin-top ceo-position-relative ceo-position-z-index">
					<div class="ceo-grid-small" ceo-grid>
						<div class="ceo-width-1-4 ceo-text-center">
							<a href="/author/<?php echo the_author_meta( 'user_login',$authorID ); ?>"  class="ceo-display-block ceo-text-small ceo-text-muted">主页</a>
						</div>
						<div class="ceo-width-1-4 ceo-text-center">
							<a href="<?php echo home_url(user_trailingslashit('/user/settings')); ?>"  class="ceo-display-block ceo-text-small ceo-text-muted">资料</a>
						</div>
						<?php if(current_user_can('level_4')){ ?>

						<div class="ceo-width-1-4 ceo-text-center">
							<a href="<?php echo admin_url(); ?>" target="_blank" class="ceo-display-block ceo-text-small ceo-text-muted">后台</a>
						</div>

						<?php } ?>
						<div class="ceo-width-1-4 ceo-text-center">
							<a href="<?php echo wp_logout_url( home_url() ); ?>"  class="ceo-display-block ceo-text-small ceo-text-muted">退出</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<?php }else{?>
<?php if(_ceo('head_login') == true ): ?>
<?php if(_ceo('modal_login') == 1 ){ ?>
	<a href="#modal-login"class="head-login b-r-4 change-color ceo-display-inline-block ceo-text-small" ceo-toggle>登录</a>
<?php }else { ?>
	<a href="<?php echo home_url(user_trailingslashit('/user/login')); ?>" class="head-login b-r-4 change-color ceo-display-inline-block ceo-text-small">登录
	</a>
<?php } ?>
<?php endif; ?>
<?php }?>
