Topic-icon avatar to custom component

Active Subscriptions:

None
12 years 1 month ago #20661 by purplechris
Hey guys i assume this would be a plugin needed but do you have any guidelines on inputting the linkedin avatar image for the user in to a custom component?
The topic has been locked.
Support Specialist
12 years 1 month ago #20740 by alzander
Replied by alzander on topic avatar to custom component
Unfortunately, we haven't created a developer guide for JLinked yet. It's a pretty easy process to create a profile plugin though, and it's what we'd recommend.

Basically, you can look at something like the JomSocial profile plugin we distribute. That's a bit complex for your needs if you just want the avatar. The following bit of code is what you'll need:
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_ROOT . DS . 'components' . DS . 'com_jlinked' . DS . 'libraries' . DS . 'linkedinprofile.php');
include_once(JPATH_SITE . DS . 'components' . DS . 'com_jlinked' . DS . 'libraries' . DS . 'jlinkeddata.php');

class plgJLinkedProfilesMyComponent extends JLinkedProfileLibrary
{
    function __construct(&$subject, $params)
    {
        $this->settings = array();
        $this->_componentFolder = JPATH_SITE; // can put a Directory here to check that your component is installed
        parent::__construct($subject, $params);
    }
    
    function jlinkedProfilesOnRegister($joomlaId)
    {
        $socialUserId = $this->socialLibrary->getLinkedInMemberId();
        $this->migrateSocialAvatarToProfile($joomlaId, $socialUserId);
    }

    function updateAvatar($socialAvatar, $userId, $liUserId)
    {
        $socialAvatarFile = $this->getAvatarPath() . DS . $socialAvatar;
        // File is now saved on your server at $socialAvatarFile. Move it, save it, or do what you want here.
    }
}
Again, that's simplistic.. The only code you should need to edit are in the last function. Obviously, you'll need to create an XML file and install the plugin as well, but you can simply copy the XML file from another plugin and modify.

Please let us know how that goes, and good luck!
Alex
The topic has been locked.