0
Welcome Guest! Login
0 items Join Now

K2-phpbb avatar sync

  • K2-phpbb avatar sync

    Posted 15 years 8 months ago
    • Any php experts around that can figure this out?

      I expect it is quite easy. But I know very little about php myself so can't figure it out.

      I think the main piece of code is in K2's helpers / utilities.php file
      // 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 = 'http://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 = 'http://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;
           }

      It would also be nice to link from the comments section to phpbb3's profile page rather than to K2's for non-authors. The non-author profile page seems to be an oversight on joomlaworks' part. There's no need for it.
    • Roeland_A!'s Avatar
    • Roeland_A!
    • Preeminent Rocketeer
    • Posts: 10193
    • Thanks: 71

    Re: K2-phpbb avatar sync

    Posted 15 years 8 months ago
    • What my suggestion would be is having a look at the code of the rokbridge login module;
      that pulls the avatar from phpbb3, combining that code and the code above should provide you with the needed solution.
      It is not that easy, but doable.
    • *Karma comes in many forms, my personal favourite is the random saucepan from the sky* J.Spencer 17-02-2009
  • Re: K2-phpbb avatar sync

    Posted 14 years 11 months ago
    • Did you manage to do it Trump? If so can you share?

Time to create page: 0.084 seconds