pavelk2 / social-feed

JavaScript plugin that shows a user feed from the most popular social networks
http://pavelk2.github.io/social-feed-example/
MIT License
962 stars 304 forks source link

Uncaught TypeError: Cannot read property 'id' of undefined #116

Closed ghost closed 8 years ago

ghost commented 9 years ago

HTML <div class="social-feed-container"></div>

Javascript config

$(function(){ //shorthand DOM ready
    $('.social-feed-container').socialfeed({
        facebook:{
            accounts: ['@MyPageName'],
            limit:10,
            access_token: 'MyAPP_ID|MyAPP_SECRET' // APP_ID|APP_SECRET
        },
        instagram:{
            accounts: ['@MyPageName','#MyPageName'],
            limit:10,
            client_id: 'MyClient_ID'
        },
        length:400,
        show_media:true,
        template: '/wp-content/themes/..../js/social-feed-gh-pages/template.html',
    });
}); 

All the MyVar names above are actual real values, masking them on purpose. The wordpress theme URL to template.html is also masked.

etienne-martin commented 9 years ago

I had the same issue.

That's because your faceook app is running a newer version of the graph API. If I get it right, we need to specify which fields we want to retrieve since version 2.4.

Simply replace the line 303 in jquery.socialfeed.js with the following:

request_url = Feed.facebook.graph + 'v2.3/' + page + '/feed?fields=id,from,name,message,created_time,story,description,link,picture,object_id&' + limit + query_extention;
etienne-martin commented 9 years ago

Also, replace the line 296 with the following:

request_url = Feed.facebook.graph + 'v2.3/' + userdata.id + '/posts?fields=id,from,name,message,created_time,story,description,link,picture,object_id&' + limit + query_extention;
pavelk2 commented 8 years ago

@Webarkitekt should we update the code according to what @etienne-martin suggested?

Webarkitekt commented 8 years ago

Which means doing a rollback on an older graph api version ?

Webarkitekt commented 8 years ago

@pavelk2 @etienne-martin At least we could add an option to facebook parameters for the fb graph api version.