JW,
Just wanted to get back. We've done some testing and implementing the import of profiles by a link is actually quite easy. The code below 'works'. It's not 100% how we'd do it when we implement it in the next release (explanation below of why), but it should work for you right now. Again, feedback on any improvements would be very very welcome!
Instructions:
Edit /components/com_jlinked/controller.php. At the bottom (before the final }) add this function:
function updateProfile()
{
$jUser = JFactory::getUser();
$jlinkedLibrary = JLinkedApiLibrary::getInstance();
$jlinkedLibrary->setInitialRegistration();
$liMemberId = $jlinkedLibrary->getLinkedInMemberId();
$args = array($jUser->get('id'), $liMemberId);
$app = JFactory::getApplication();
JPluginHelper::importPlugin('jlinkedprofiles');
$app->triggerEvent('jlinkedProfilesImportProfile', $args);
$app->enqueueMessage('Profile Imported!');
$app->redirect('index.php');
}
Notes:
* Feel free to update the enqueueMessage line with a blue-bar message you want the user to see "Profile imported!", or delete that line altogether.
* The last line is a hard-coded redirect for where the user should go after the redirect. Feel free to update that wherever you want on your site
Once that code is added, simply create a link anywhere on your site to the following URL:
index.php?option=com_jlinked&task=updateProfile
When navigated too, all profile plugins will be told to re-import the user's profile from LinkedIn and the user will be redirected to the page set above. If you're putting this in a template file (that supports PHP), you will likely want to add it like this:
$jlinkedLibrary = JLinkedApiLibrary::getInstance();
$liMemberId = $jlinkedLibrary->getMappedLinkedInUserId();
if ($liMemberId)
echo '<a href="index.php?option=com_jlinked&task=updateProfile">Fetch Profile From LinkedIn</a>';
That code will verify that the user has already logged in with LinkedIn (and therefore can fetch their profile). If they haven't, no link will be displayed. That code for displaying the link hasn't been tested, but looks right...
When we implement this, we'll be:
* Removing the call to setInitialRegistration() - That's a bit of a hack to get around a check to make sure we don't import LI profiles outside of registration only.
* Set the redirect to be dynamic (likely going back to the page the import originated on, with some configuration ability to go somewhere else).
* Probably adding a {JLinkedImportProfile} tag (or something like that) to add the link as above
* (Hopefully) more flexibility on what would be imported instead of just overwriting everything. May not be in the first release of this.
Definitely test, test, test! The import code was checked quickly. The link code, not at all. Let us know how it goes for you and feedback is definitely appreciated!
Good luck,
Alex