hubert0070
You can try this tweak to get K2 user avatar:
Open the file: [root]/templates/gk_technews/layouts/default.php
Under this line of code:
$tpl_page_suffix = $page_suffix_output . $error_page != '' ? ' class="' . $page_suffix_output . $error_page . '" ' : '';
Add this code:
//Get K2 user avatar
$db = JFactory::getDBO();
$query = "SELECT * FROM #__k2_users WHERE userID=".(int)$user->id;
$db->setQuery($query, 0, 1);
$profile = $db->loadObject();
if ($profile)
{
if ($profile->image != '')
$user->avatar = JURI::root().'media/k2/users/'.$profile->image;
}
Replace this function:
<?php if($this->API->modules('login')) : ?>
<div id="gkUser">
<?php if($userID === 0) : ?>
<span class="micon">person_outline</span>
<?php else : ?>
<img src="//www.gravatar.com/avatar/<?php echo md5(strtolower(trim($user->get('email')))); ?>?s=40" alt="" />
<span><?php echo $user->get('name'); ?></span>
<span class="micon">more_vert</span>
<?php endif; ?>
<div id="gk-login-submenu"<?php if($userID > 0) : ?> class="gk-user-logged-in"<?php endif; ?>>
<jdoc:include type="modules" name="login" style="none" />
</div>
</div>
<?php endif; ?>
by this:
<?php if($this->API->modules('login')) : ?>
<div id="gkUser">
<?php if(isset($user->avatar)) : ?>
<img src="<?php echo $user->avatar?>" alt=""/>
<?php else : ?>
<img src="//www.gravatar.com/avatar/<?php echo md5(strtolower(trim($user->get('email')))); ?>?s=40" alt="" />
<?php endif; ?>
<span><?php echo $user->name; ?></span>
<span class="micon">more_vert</span>
<div id="gk-login-submenu"<?php if($userID > 0) : ?> class="gk-user-logged-in"<?php endif; ?>>
<jdoc:include type="modules" name="login" style="none" />
</div>
</div>
<?php endif; ?>
Finally, add this css to style the k2 user image:
#gkUser img {
width: 30px;
}
It will look like this:
I attach this file here so you can have a comparison: