Open isheraz opened 7 years ago
anyone got Linkedin working with this plugin
yes. the access token needs to be refreshed every 2 months or so (I guess this can be done behind the scenes somehow) and it was a bit of a pain registering this app with Linkedin as the self-service was a bit vague. But I prevailed.
html:
// LINKEDIN
linkedin:{
accounts: ['YOUR_COMPANY_ID'],
limit: 2,
show_media: true,
access_token: 'YOUR_ACCESS _TOKEN',
},
js:
//---------------------------------------------------------------
// LINKEDIN custom
//--------------------------------------------------------------------
linkedin: {
posts: [],
loaded: false,
getData: function(account) {
access_token = options.linkedin.access_token;
var url;
url = 'https://api.linkedin.com/v1/companies/'+account+'/updates?scope=rw_company_admin&oauth2_access_token='+access_token+'&format=jsonp';
Utility.request(url, Feed.linkedin.utility.getPosts);
},
utility: {
getPosts: function(json) {
$.each(json.values, function() {
var post = {},
element = this;
post.id = element.updateContent.companyStatusUpdate.share.id;
post.dt_create = moment((element.updateContent.companyStatusUpdate.share.timestamp));
post.author_name = element.updateContent.company.name;
post.message = element.updateContent.companyStatusUpdate.share.comment + '</br></br>' + Utility.stripHTML(element.updateContent.companyStatusUpdate.share.content.description);
post.description = '';
post.link = "https://www.linkedin.com/feed/update/urn:li:activity:"
+ element.updateKey.split('-')[2] + "/";
if (options.show_media) {
if (element.updateContent.companyStatusUpdate.share.content.submittedImageUrl) {
post.attachment = '<img class="attachment" src="' + element.updateContent.companyStatusUpdate.share.content.thumbnailUrl + '" />';
}
}
var post = new SocialFeedPost('linkedin', post);
post.render();
});
}
}
},
//---------------------------------------------------------------
// END LINKEDIN
//--------------------------------------------------------------------
also I added linkedin to options: (top of file jquery.socialfeed.js)
var options = $.extend(defaults, _options),
container = $(this),
template,
social_networks = ['facebook', 'youtube', 'linkedin', 'instagram', 'vk', 'google', 'blogspot', 'twitter', 'pinterest', 'rss'],
posts_to_load_count = 0,
date_locale = 'fi',
loaded_post_count = 0;
Please add support for Linkedin as well and also, Kindly update the README.md file, It still points to bower_components, and the bower_components didn't work for me. I had to manually add all the libraries in to get the plugin to work.