<div class="nd_logged_in nd_user">

<div style="margin-right:-10px">

<?php if(function_exists('bp_is_active') ): ?>
<a href="<?php echo bp_loggedin_user_domain(); ?>"><?php bp_loggedin_user_avatar( 'type=thumb&width=70&height=70' ); ?></a>
<?php else: ?>
<a href="<?php echo get_author_posts_url(get_the_author_meta($current_user->ID, 'ID' )); ?><?php echo $current_user->display_name; ?>"><?php echo get_avatar( $current_user->ID, '70' ); ?></a>
<?php endif; ?>
</div>

	<p><strong><?php _e('Welcome','Gameleon'); ?> <?php echo $current_user->display_name; ?> !</strong></p>

<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
	<?php
		if ($last_login = (int) get_user_meta($current_user->ID, 'nd_login_time', true)) echo '<p>'.__('You last logged in on ','Gameleon').date_i18n(__('l \t\h\e jS \of F, Y \a\t h:ia','Gameleon'), $last_login).'.</p>';

		$posts = wp_count_posts('post')->publish - (int) get_user_meta($current_user->ID, 'nd_num_posts', true);
		$comments = wp_count_comments()->approved - (int) get_user_meta($current_user->ID, 'nd_num_comments', true);

		echo '<p>';
		echo _n('Since last logging in there has been ', 'Since last logging in there have been ', $posts, 'Gameleon');
		echo '<span class="count">'.$posts.'</span>';
		echo _n('new post and ', 'new posts and ', $posts, 'Gameleon');
		echo '<span class="count">'.$comments.'</span>';
		echo _n('new comment', 'new comments', $comments, 'Gameleon');
		echo '</p>';
	?>
<?php else: ?>
	<?php
		if ($last_login = (int) get_user_meta($current_user->ID, 'nd_login_time', true)) echo '<p>'.__('You last logged in on ','Gameleon').date_i18n(__('l \t\h\e jS \of F, Y \a\t h:ia','Gameleon'), $last_login).'.</p>';

		$posts = wp_count_posts('post')->publish - (int) get_user_meta($current_user->ID, 'nd_num_posts', true);
		$comments = wp_count_comments()->approved - (int) get_user_meta($current_user->ID, 'nd_num_comments', true);

		echo '<p>';
		echo _n('Since last logging in there has been ', 'Since last logging in there have been ', $posts, 'Gameleon');
		echo '<span class="count">'.$posts.'</span>';
		echo _n('new game and ', 'new games and ', $posts, 'Gameleon');
		echo '<span class="count">'.$comments.'</span>';
		echo _n('new comment', 'new comments', $comments, 'Gameleon');
		echo '</p>';
	?>
<?php endif; ?>
	<ul class="links">

<?php if(get_option('tigu_dashboard_link') == 'true'): ?>  
<li><a href="<?php echo site_url('/wp-admin/'); ?>"><?php _e('Dashboard','Gameleon'); ?></a></li>
<?php else: ?>
<?php if (current_user_can( 'manage_options' )) :?>
<li><a href="<?php echo site_url('/wp-admin/'); ?>"><?php _e('Dashboard','Gameleon'); ?></a></li>
<?php endif; ?>
<?php endif; ?>

<?php if(function_exists('bp_is_active') ): ?>
<li><a href="<?php bp_loggedin_user_link() ?>settings/" title="<?php bp_member_name() ?>"><?php _e('Edit Profile','Gameleon'); ?></a></li>
<?php else: ?>

<?php if(get_option('tigu_new_profile') == 'true'): ?>  
		<li><a href="<?php echo (get_option('tigu_profile_url')); ?>"><?php _e('Edit Profile','Gameleon'); ?></a></li>
<?php else: ?>
	    <li><a href="<?php echo site_url('/wp-admin/profile.php'); ?>"><?php _e('Edit Profile','Gameleon'); ?></a></li>
<?php endif; ?>

<?php endif; ?>

	   <li><a href="<?php echo wp_logout_url( $current_url ); ?>"><?php _e('Log out','Gameleon'); ?></a></li>
	</ul>
</div>

<?php if(get_option('tigu_activity_tab') == 'true'): ?>
<div class="nd_logged_in nd_recently_viewed" style="display:none;">
<?php if(get_option('tigu_recently_played') == 'true'): ?>
	<strong><p><?php _e('Recently Viewed','Gameleon'); ?></p></strong>
	<?php
		$viewed_posts = get_user_meta($current_user->ID, 'nd_viewed_posts', true);
		if (is_array($viewed_posts) && sizeof($viewed_posts)>0) :
			echo '<ul class="links">';
			$viewed_posts = array_reverse($viewed_posts);
			foreach ($viewed_posts as $viewed) :
				$viewed_post = get_post($viewed);
				if ($viewed_post) echo '<li><a href="'.get_permalink($viewed).'">'.$viewed_post->post_title.'</a></li>';
			endforeach;
			echo '</ul>';
		else :
echo '<p>';
			_e('You have not viewed any posts recently.', 'Gameleon');
echo '</p>';
		endif;
	?>
	<hr/>
 <?php endif; ?>
<?php if(get_option('tigu_recently_comments') == 'true'): ?>
	<p><strong><?php _e('My Recent Comments','Gameleon'); ?></p></strong>
	<?php
		global $wpdb;
		$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
			comment_post_ID, user_id, comment_approved, comment_date_gmt,
			comment_type, SUBSTRING(comment_content,1,30) AS com_excerpt
			FROM $wpdb->comments
			LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
			$wpdb->posts.ID)
			WHERE comment_approved = '1' AND comment_type = '' AND
			post_password = '' AND user_id = '".$current_user->ID."'
			ORDER BY comment_date_gmt DESC LIMIT 5";
		$comments = $wpdb->get_results($sql);
		if ($comments) :
			echo '<ul class="links" style="margin-bottom: 12px">';
			foreach ($comments as $comment) :
				echo '<li><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID.'">&ldquo;'.strip_tags($comment->com_excerpt).'&hellip;&rdquo;</a></li>';
			endforeach;
			echo '</ul>';
		else :
echo '<p style="padding-bottom:12px">';
			_e('You have not made any comments.', 'Gameleon');
echo '</p>';
		endif;
	?> 
 <?php endif; ?>
</div>
 <?php endif; ?>

<!-- WHO IS ONLINE -->

<div class="nd_logged_in nd_online_users" style="display:none;">

<div class="online-users-login">

<p><?php _e('Total users online', 'Gameleon'); ?>: 
<?php $tmp = get_whos_online(); echo $tmp['total_cnt'];?>
</p>

<p><?php _e('Guests online', 'Gameleon'); ?>:
<?php $tmp = get_whos_online(); echo $tmp['guests_cnt'];?>
</p>

<p><?php _e('Registered Online', 'Gameleon'); ?>:
<?php $tmp = get_whos_online(); echo $tmp['loggedin_cnt'];?>
<?php if(get_option('tigu_whosonline_list') == 'true'): ?>
<?php if(function_exists('bp_is_active') ): ?>
<a href="<?php bp_member_permalink() ?>"><?php bp_member_name() ?></a>
<?php else: ?>
<span style="border-right:1px solid #666666"></span><?php $tmp = get_whos_online(); echo $tmp['loggedin_list_links'];?>
<?php endif; ?>
<?php endif; ?>
</p>

<?php if(get_option('tigu_whosonline_avatar') == 'true'): ?>

<?php if(function_exists('bp_is_active') ): ?>
<a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_avatar() ?></a>
<?php else: ?>
<?php $tmp = get_whos_online(); echo $tmp['loggedin_avatars'];?>
<?php endif; ?>

<?php endif; ?>

</div>
</div>
<!-- WHO IS ONLINE -->