Warning: Declaration of LJXP_Walker_Category_Checklist::start_lvl(&$output, $depth, $args) should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/lj-xp/lj-xp-options.php on line 771

Warning: Declaration of LJXP_Walker_Category_Checklist::end_lvl(&$output, $depth, $args) should be compatible with Walker::end_lvl(&$output, $depth = 0, $args = Array) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/lj-xp/lj-xp-options.php on line 776

Warning: Declaration of LJXP_Walker_Category_Checklist::start_el(&$output, $category, $depth, $args) should be compatible with Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 0) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/lj-xp/lj-xp-options.php on line 781

Warning: Declaration of LJXP_Walker_Category_Checklist::end_el(&$output, $category, $depth, $args) should be compatible with Walker::end_el(&$output, $object, $depth = 0, $args = Array) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/lj-xp/lj-xp-options.php on line 793

Warning: Use of undefined constant odnaknopka - assumed 'odnaknopka' (this will throw an Error in a future version of PHP) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/odnaknopka/ok2.php on line 11

Warning: Use of undefined constant ddsg_language - assumed 'ddsg_language' (this will throw an Error in a future version of PHP) in /var/www/u3357911/data/www/karta39.ru/blog/wp-content/plugins/sitemap-generator/sitemap-generator.php on line 44
Blog » Использование Gravatar в LiveStreet
Главная > разработка > Использование Gravatar в LiveStreet

Использование Gravatar в LiveStreet

Использовать у себя Gravatar.com очень просто. Аватарка выдаётся по url-у с md5-хешем e-mail-а пользователя.
Итого:
в classes\modules\user\entity\User.entity.class.php
находим функцию
public function getProfileAvatarPath($iSize=100) {
if ($this->getProfileAvatar()) {
return DIR_WEB_ROOT.DIR_UPLOADS_IMAGES.'/'.$this->getId().'/avatar_'.$iSize.'x'.$iSize.'.'.$this->getProfileAvatarType();
} else {
return DIR_STATIC_SKIN.'/images/avatar_'.$iSize.'x'.$iSize.'.jpg';
}
}

и изменяем всего одну строчку:
public function getProfileAvatarPath($iSize=100) {
if ($this->getProfileAvatar()) {
return DIR_WEB_ROOT.DIR_UPLOADS_IMAGES.'/'.$this->getId().'/avatar_'.$iSize.'x'.$iSize.'.'.$this->getProfileAvatarType();
} else {
return "http://www.gravatar.com/avatar.php? gravatar_id=".md5( strtolower($this->getMail()) )."&size=".$iSize;
}
}

К сожалению, в комментариях так просто получить аватарку не получится — так как там используется своя функция getUserProfileAvatarPath($iSize=100) из TopicComment.entity.class.php

  1. Пока что нет комментариев.
Необходимо войти на сайт, чтобы написать комментарий.