<?php get_header(); ?>
<?php if(get_option('tigu_homepage-news-ticker') == 'true' && get_option('tigu_newsticker_author') == 'true'): ?>
<div class="newstickers" style="height:36px;"><?php jnewsticker_display( get_option('tigu_ticker_choosed_id') ) ?></div>
<?php endif; ?>
<!-- START AUTHOR AREA -->
<div id="main">
<div class="grids_box_sidebar">
<div class="widget-title">
<h3>
<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>

<?php echo $curauth->nickname; ?>'s <?php _e('profile', 'Gameleon'); ?>
</h3>
</div>
</div>

<div class="block">
<div class="grid-author-page">

    <?php
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>
<?php /* identify author */ $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
<div class="profile-avatar"><?php echo get_avatar( $curauth->ID, 80 ); ?></div>
<h2>
<?php if ($curauth->first_name && $curauth->last_name): ?>
<?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?>
 <?php else: ?>
<?php echo $curauth->nickname; ?>
<?php endif; ?>
</h2> 


<div class="position">

<?php if ($curauth->position): ?>
<?php echo $curauth->position; ?> 
<?php _e('at', 'Gameleon'); ?> 
<?php endif; ?>
<?php if ($curauth->user_url): ?><a href="<?php echo $curauth->user_url; ?>" target="_blank"><?php endif; ?><?php if ($curauth->company): ?><?php echo $curauth->company; ?><?php else: ?><?php echo $curauth->user_url; ?><?php endif; ?><?php if ($curauth->user_url): ?></a><?php endif; ?> 
</div>
<div>
<div class="tooltip" title="Twitter">
<?php if ( get_user_meta( $curauth->ID, 'twitter', true ) ) { ?>
<a href="<?php echo get_user_meta($curauth->ID, 'twitter', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/twitter.png" alt="Twitter" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="Facebook">
<?php if ( get_user_meta( $curauth->ID, 'facebook', true ) ) { ?>
<a href="<?php echo get_user_meta($curauth->ID, 'facebook', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/facebook.png" alt="Facebook" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="Dribbble">
<?php if ( get_user_meta( $curauth->ID, 'dribbble', true ) ) { ?>
<a href="<?php echo get_user_meta($curauth->ID, 'dribbble', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/dribbble.png" alt="Dribbble" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="Yahoo YIM">
<?php if ( get_user_meta( $curauth->ID, 'yim', true ) ) { ?>
<a href="ymsgr:sendIM?<?php echo get_user_meta($curauth->ID, 'yim', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/yahoo.png" alt="Yahoo YIM" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="Google+">
<?php if ( get_user_meta( $curauth->ID, 'google', true ) ) { ?>
<a href="<?php echo get_user_meta($curauth->ID, 'google', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/google.png" alt="Google" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="Youtube">
<?php if ( get_user_meta( $curauth->ID, 'youtube', true ) ) { ?>
<a href="<?php echo get_user_meta($curauth->ID, 'youtube', true); ?>" target="_blank">
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/youtube.png" alt="Youtube" />
</a>
<?php } ?>
</div>

<div class="tooltip" title="RSS FEED">
<a href="<?php echo get_author_feed_link($curauth->ID, true); ?>" >
<img src="<?php echo get_template_directory_uri(); ?>/images/profile/rss.png" alt="RDD FEED" />
</a>
</div>

</div>

<!-- START USER DESCRIPTION -->

<?php if ($curauth->user_description): ?>
<div class="aboutme">
<?php echo $curauth->user_description; ?>
</div>
 <?php else: ?>
<div style="padding-top:12px;">&nbsp;&nbsp;<?php _e('This user hasn\'t filled out his biographical info yet.', 'Gameleon'); ?>
</div>
<?php endif; ?> 

<!-- END USER DESCRIPTION -->

</div>
</div>

<?php if (have_posts()): the_post(); ?>
<?php if(get_option('tigu_all_post', 'false') == 'true'): ?>

<!-- ************ START AUTHOR POSTS ************ -->

<?php   

if( get_option('tigu_author_post_order', 'Date') == 'Date')  {

query_posts($query_string . '&paged='.$paged .'&orderby=date&order='.get_option('tigu_author_post_ascdesc').'&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 

} elseif ( get_option('tigu_author_post_order', 'Name') == 'Name')  {

query_posts($query_string . '&paged='.$paged .'&orderby=title&order='.get_option('tigu_author_post_ascdesc').'&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 

} elseif ( get_option('tigu_author_post_order', 'Number of Views') == 'Number of Views')  {

query_posts($query_string . '&paged='.$paged .'meta_key=post_views_count&orderby=meta_value_num&order='.get_option('tigu_author_post_ascdesc').'&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 

} elseif ( get_option('tigu_author_post_order', 'Popularity') == 'Popularity')  {

query_posts($query_string . '&paged='.$paged .'&orderby=comment_count&order='.get_option('tigu_author_post_ascdesc').'&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 

} elseif ( get_option('tigu_author_post_order', 'Random') == 'Random')  {

query_posts($query_string . '&paged='.$paged .'&orderby=rand&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 

} else { 

query_posts($query_string . '&paged='.$paged .'&orderby=date&order='.get_option('tigu_author_post_ascdesc').'&posts_per_page='.get_option('tigu_author_posts_number') . '&paged='.$paged); 
}	

?>

<?php if( get_option('tigu_author_posts', 'All post list with toggle option') == 'All post list with toggle option') : ?>

<h5 class="toggle" ><a href="#"><?php _e('Show All posts by', 'Gameleon'); ?> <?php echo $curauth->nickname; ?></a></h5>
<div style="display: none;" class="toggle-content">
<?php else: ?>
<div class="grids_box_sidebar"><div class="widget-title"><h3><?php _e('All posts by', 'Gameleon'); ?>  <?php echo $curauth->nickname; ?></h3></div></div>
    <div class="block">
<?php endif; ?>

<div class="profile">
<div class="grid-category-page">
<?php rewind_posts(); ?>
<?php while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>">
<?php
    if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    $icon = '<span class="' . get_post_format($post->ID) . '-icon"></span>';
  } else {
    $icon = '';
  }
?>

<div class="category-games-page">
<div class="content">

<?php if(has_post_thumbnail()): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'widget-image-thumb'); ?>
<div class="grid-image"><a class=<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>"hover_play_small-wp"<?php else: ?>"hover_play_small"<?php endif; ?> href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo $image[0]; ?>" width="76" height="60" alt="<?php the_title(); ?>" />

</a><?php echo $icon; ?></div>

<?php elseif ( is_myarcade_game() ) : ?>
<div class="grid-image"><a class=<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>"hover_play_small-wp"<?php else: ?>"hover_play_small"<?php endif; ?> href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php myarcade_thumbnail( 76, 60 ) ?></a><?php echo $icon; ?></div>
<?php else: ?>
<div class="grid-image"><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-76.png" width="76" height="60" alt="<?php the_title(); ?>" />

</a><?php echo $icon; ?></div>
<?php endif; ?>

  <h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<?php if(get_option('tigu_shorten_titles') == 'true'): ?>
<?php $shorttitle = substr(the_title('','',FALSE),0,26); ?><?php echo $shorttitle; if (strlen($shorttitle) >25){ echo '&hellip;'; } ?>
<?php else: ?>
<?php the_title(); ?>
<?php endif; ?></a></h2>

<p style="padding-top:6px">
<?php echo get_excerpt(get_option('tigu_author_post_excerpt', '83')); ?>
</p>


<!-- START AUTHOR META -->
<div class="clear"></div>
<div class="somepadd-author block-meta">

<?php if(get_option('tigu_postdatetime_author', 'true') == 'true'): ?>
<span class="postdatetime-wp">
<?php the_time('Y-m-d') ?>
</span>
<?php endif; ?>

<?php if(get_option('tigu_mostplayed_author', 'true') == 'true'): ?>
<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<span class="postviews-wp" title="<?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> "><?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?></span>
<?php else: ?>
<span class="clubs" title="<?php _e('Played', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> "><?php echo getMostPlayed(get_the_ID()); ?> <?php _e('plays', 'Gameleon'); ?></span>
<?php endif; ?>
<?php endif; ?>

<?php if(get_option('tigu_likes_author', 'true') == 'true'): ?>
<span class="minilikes">
<?php _e('Likes', 'Gameleon'); ?>: <?php echo $wp_superlike->show_likes($post->ID);?>
</span>
<?php endif; ?>

<?php if(get_option('tigu_comments_author', 'false') == 'true'): ?>
<?php $comment_count = get_comment_count($post->ID); ?>

<?php if ($comment_count['approved'] > 0) : ?>
<span class="heading-comments-exist">
<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>
</span>
<?php else: ?>
<span class="heading-comments">
<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>
</span>
<?php endif; ?>

<?php endif; ?>

</div>
<!-- END AUTHOR METAS -->

    </div>
    </div>
    </div>
<?php endwhile;?> 
<?php wp_reset_query(); ?>
    </div>
    </div>


<?php kriesi_pagination($pages = '', $range = 2); ?>

    </div>
<?php endif; ?>
<?php else: ?>

<?php if(get_option('tigu_no_posts_author', 'true') == 'true'): ?>
<div class="grid-author-page">
<?php _e('No posts by this author.', 'Gameleon'); ?>
 </div>
<?php endif; ?>

<!-- ************ END AUTHOR POSTS*************** -->
<?php endif; ?> 


    </div>

<!-- END AUTHOR AREA -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>