Diseño y Posicionamiento Web con Joomla › Foros › General › Joomla en General › integrar perfiles de k2 y kunena › Re: integrar perfiles de k2 y kunena
Esto es para integrar el avatar de kunena Kunena 2.0.3 en el K2 v2.6.2
es manual, no hay un plugin y a nosotros nos funciono a la perfeccion:
Problema: Integrar en k2 avatares de kunena.
Solucion: Se edita 1 archivo.
Components/com_k2/helpers/utilities.php
• Se cambia la línea
class K2HelperUtilities
• por la siguiente
class K2HelperUtilities extends JPlugin
• Inmediatamente después que se abre la llave de esta clase se inicializa kunena añadiendo el siguiente código
//Inicializa Kunena
public function __construct(&$subject, $config) {
// Do not load if Kunena version is not supported or Kunena is not installed
if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) return false;
// TODO: Here you should detect your component and return if detection fails!
KunenaForum::setup();
parent::__construct ( $subject, $config );
$this->loadLanguage ( 'plg_kunena_kunena.sys', JPATH_ADMINISTRATOR );
$this->path = dirname ( __FILE__ ) . '/kunena';
}
• Despues de las líneas
// Get user avatar
public static function getAvatar($userID, $email = NULL, $width = 50)
{
• Se añade:
// Initialize variables
$sizex = 90;
$sizey = 90;
$user = KunenaFactory::getUser($userID);
// Get avatar URL "/media/kunena/avatars/path/file.jpg"
$KavatarK2 = $user->getAvatarURL($sizex, $sizey);
• Sustituir el siguiente codigo en los 3 casos existentes:
$avatar = JURI::root(true).'/'.$avatarPath;
• Por el siguiente
//$avatar = JURI::root(true).'/'.$avatarPath;
$avatar = $KavatarK2;
• Sustituir el siguiente codigo en los 2 casos existentes:
$avatar = 'http://www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().$avatarPath);
• Por el siguiente:
//$avatar = 'http://www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().$avatarPath);
$avatar = $KavatarK2;
• Cambiar la línea
$avatar = JURI::root(true).'/media/k2/users/'.$avatar;
• Por
//$avatar = JURI::root(true).'/media/k2/users/'.$avatar;
$avatar = $KavatarK2;
• Cambiar la línea
$avatar = $cbUser->getField('avatar', null, 'csv', 'none', 'profile');
• Por
//$avatar = $cbUser->getField('avatar', null, 'csv', 'none', 'profile');
$avatar = $KavatarK2;
y ya está, a nosotros nos funciono muy bien en estas versiones, Altamente recomendado siempre que se va a hacer un cambio a los archivos, respaldar, respaldar y respaldar, los archivos pero mas importante aun la base de datos, a mi hermano le trono la base de datos varias veces con estos cambios hasta que quedo asi el codigo y ya funciona muy bien
Saludos!!!