Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback function #32

Closed
pavelk2 opened this issue May 4, 2014 · 28 comments
Closed

Callback function #32

pavelk2 opened this issue May 4, 2014 · 28 comments

Comments

@pavelk2
Copy link
Owner

pavelk2 commented May 4, 2014

If there are no any messages for some account - callback function will not be triggered

@graphical-iain
Copy link

I've fixed the callback functionality for this in a fork.
https://github.com/graphical-iain/social-feed

I did however remove support for Google+, Vk and Blogspot, since I didn't need them.

@seegermattijs
Copy link

Hi

I get error: FB is not defined.

Any solution?

@graphical-iain
Copy link

@seegermattijs, Can you post your init code?

@seegermattijs
Copy link

Just tested your code and got this:

jquery.socialfeed.js:245 Uncaught ReferenceError: FB is not defined

@graphical-iain
Copy link

Oh, sorry about that. I forgot to mention in my description that since I updated the code to use Open Graph v2, you'll need to include the Fb SDK init script before you call the plugin:

<script src="//connect.facebook.net/en_US/sdk.js"></script>

@seegermattijs
Copy link

Thanks, errors are gone now but it seems like the facebook posts aren't loaded?

@graphical-iain
Copy link

That might be because of a fb bug that's currently happening. What kind of posts are you trying to get?

@seegermattijs
Copy link

I tried with 'dolomiti' and '@primaverasoundfestivals'. Would like to get posts from a Facebook page.

@graphical-iain
Copy link

I think that's the same bug that I was encountering. I just uploaded an updated version that accounts for the bug, I thought it was just temporary, so I didn't bother uploading the fix. Try that.

@seegermattijs
Copy link

Too bad, Facebook posts still not appearing.

@graphical-iain
Copy link

The script is currently working on my projects, so it might be something in your init.
I just tried 'primaverasoundfestivals' in my script and it worked fine. However 'dolomiti' is a user, so you'd have to have a different set of permissions to access that user's posts. Verify that your access_token is correct and has correct permissions to access that user's posts.

@seegermattijs
Copy link

Thanks a lot!

@seegermattijs
Copy link

It works now! Facebooks posts also show posts of users who tagged the facebook account. Is there a way to only show posts of the page?

@pavelk2
Copy link
Owner Author

pavelk2 commented Mar 6, 2015

this is a different topic:
please check here #55

@seegermattijs
Copy link

I changed my moderation function to following function:

 moderation: function(content){
     return (content.social_network == "facebook") ? content.author_name == "primaverasoundfestivals" : true;
     return  (content.text) ? content.text.indexOf('fuck') == -1 : true;
 },

Unfortunately facebook posts aren't showing at all, maybe because the version of @graphical-iain is a bit different?

@pavelk2
Copy link
Owner Author

pavelk2 commented Mar 6, 2015

Try this function:
https://gist.github.com/pavelk2/46d9d744c30d9aa81b3d

@seegermattijs
Copy link

Facebook posts of users still showing with that function

@pavelk2
Copy link
Owner Author

pavelk2 commented Mar 6, 2015

Cool, so no you only need to fillter the author.
before that you were doing:

return (content.social_network == "facebook") ? content.author_name ==
"primaverasoundfestivals" : true;
while in fact i guess that in your case you should do:
return (content.social_network == "facebook") ? content.author_name ==
"Primavera Sound Festival" : true;

Let me know if it does work for you.

On Fri, Mar 6, 2015 at 10:26 AM seegermattijs notifications@github.com
wrote:

Facebook posts of users still showing with that function


Reply to this email directly or view it on GitHub
#32 (comment).

@seegermattijs
Copy link

Awesome! That works great. Thanks a lot!

@seegermattijs
Copy link

Hi @pavelk2 and @graphical-iain
One more question,
My script gets 3 FB posts at the moment. With your script it leaves out every post which is not posted by the page itself, which is ok.

But if the most recent posts by coincidence are three posts by random people about the page,
it shows nothing because your if statement leaves them out.

The counter stops at 3 but I still don't have posts from the page itself. How can I fix this?

@pavelk2
Copy link
Owner Author

pavelk2 commented Apr 1, 2015

The way social-feed currently works: the limits you define are injected into the requests to social-networks - so social-feed request from the facebook only the latest 3 posts. Then social-feed filters them - in your case all of the posts do not pass the moderation function, which means that social-feed has nothing to show.

@bettyorganero
Copy link

Hi @seegermattijs @pavelk2,
I have the same problem to showing my facebook feed. Can you say me where I need to add this function:

<script src="https://gist.github.com/pavelk2/46d9d744c30d9aa81b3d.js"></script>

and them where I need to add this change:
return (content.social_network == "facebook") ? content.author_name ==
"primaverasoundfestivals" : true;
while in fact i guess that in your case you should do:
return (content.social_network == "facebook") ? content.author_name ==
"Primavera Sound Festival" : true;

thank you

@HartLarsson
Copy link
Contributor

hi @bettyorganero i don't understand how you installed the socialfeed script.
Why you need to tweak https://gist.github.com/pavelk2/46d9d744c30d9aa81b3d.js that is not part of the plugin??

@bettyorganero
Copy link

Hi @HartLarsson thanks for your answer.
I installed social-feed.js and I try to visualize my facebook feed but it not work. I read this chat and @pavelk2 done a solution for this problem but I don't understand where I need to made this change:

@pavelk2: Try this function:
https://gist.github.com/pavelk2/46d9d744c30d9aa81b3d

I tried this but also it does not work :

return (content.social_network == "facebook") ? content.author_name ==
"primaverasoundfestivals" : true;
while in fact i guess that in your case you should do:
return (content.social_network == "facebook") ? content.author_name ==
"Primavera Sound Festival" : true;

Do you have any information about How social-feed.js works with Facebook?
Thank you!

@HartLarsson
Copy link
Contributor

$('.social-feed-container').socialfeed({
    // FACEBOOK
    facebook:{
        accounts: ['@teslamotors','!teslamotors'],  //Array: Specify a list of accounts from which to pull wall posts
        limit: 2,                                   //Integer: max number of posts to load
        access_token: 'YOUR_FACEBOOK_ACCESS_TOKEN'  //String: "APP_ID|APP_SECRET"
    },

    // GENERAL SETTINGS
    length:400,                                     //Integer: For posts with text longer than this length, show an ellipsis.
    show_media:true,                                //Boolean: if false, doesn't display any post images
    media_min_width: 300,                           //Integer: Only get posts with images larger than this value
    update_period: 5000,                            //Integer: Number of seconds before social-feed will attempt to load new posts.
    template: "bower_components/social-feed/template.html",
    date_format: "ll",                              //String: Display format of the date attribute (see http://momentjs.com/docs/#/displaying/format/)
    date_locale: "en",                              //String: The locale of the date (see: http://momentjs.com/docs/#/i18n/changing-locale/)
    moderation: function(content) {                 //Function: if returns false, template will have class hidden
        return  (content.text) ? content.text.indexOf('fuck') == -1 : true;
    },
    callback: function() {                          //Function: This is a callback function which is evoked when all the posts are collected and displayed
        console.log("All posts collected!");
    }
});

i post the general example you find in the read.me with only facebook just to show you where is the callback function and the Moderation function Pavel have post before.
Please use your code in the right way (inside callback or moderation functions)

@HartLarsson
Copy link
Contributor

why you need a callback or moderation? for visualization only you dont' need any of these function so you can remove them from the configuration

@bettyorganero
Copy link

@HartLarsson thanks for your time but the original code like the general example from read.me, don't work with Facebook. With twitter is ok but I need to work with Facebook.
My APP_ID|APP_SECRET are right and I don't have a feed visualisegtion.

@HartLarsson
Copy link
Contributor

for me works, if you have created your app_id and secret key.
works aout of the box. please if you use crome press f12 and check if you have some javascript error in console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants