E.g. with Jomsocial and phpbb3 and other forum/social networking components.
My site has a phpbb3 forum. I would like to integrate avatars from the forum with K2.
The code appears to be in utilities.php if anyone who is good with Php can help....
// Get user avatar
function getAvatar($userID, $email = NULL, $width = 50) {
$params = &JComponentHelper::getParams('com_k2');
if ($userID == 'alias')
$avatar = JURI::root().'components/com_k2/images/placeholder/user.png';
else if ($userID == 0) {
if ($params->get('gravatar') && !is_null($email)) {
$avatar = '
www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().'components/com_k2/images/placeholder/user.png');
} else {
$avatar = JURI::root().'components/com_k2/images/placeholder/user.png';
}
} else if (is_numeric($userID) && $userID > 0) {
$db = &JFactory::getDBO();
$query = "SELECT image FROM #__k2_users WHERE userID={$userID}";
$db->setQuery($query);
$avatar = $db->loadResult();
if ( empty($avatar)) {
if ($params->get('gravatar') && !is_null($email)) {
$avatar = '
www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().'components/com_k2/images/placeholder/user.png');
} else {
$avatar = JURI::root().'components/com_k2/images/placeholder/user.png';
}
}
else {
$avatar = JURI::root().'media/k2/users/'.$avatar;
}
}
return $avatar;
}