[Plugin: WPBook Lite] Getting error "No post id returned from Facebook" (23 posts)

  1. AardvarkGirl
    Posted 4 years ago #

    I accidently inserted my facebook page's ID number where it says "YOUR" (as in your personal Facebook profile ID). Now I can't change it... I can edit the number but there is no 'save' button, and of course I'm getting the error below.

    I have tried uninstalling the pluging but when I reinstall it it pre-enters all the data.

    How do I change the ID?

    No post id returned from Facebook, $fb_response was /n and $fb_page_type was and $wpbook_description was test test and $my_title was Test Post 3

  2. John Eckman
    Posted 4 years ago #

    Are you sure there is no "save" button? Look all the way at the bottom of the form, above where it says "Need help?"

  3. AardvarkGirl
    Posted 4 years ago #

    This is what I get...


    I have deactivated / uninstalled / reinstalled and still this is what I get.

    When I completely uninstall (remove) the plugin, why does it remember the settings?

  4. John Eckman
    Posted 4 years ago #

    Ah, I see - something is throwing an exception in trying to show the permissions on the page, so the admin page doesn't get completely drawn, which means no Save button.

    (The uninstall routine must be failing to appropriately delete the old settings, which is why they aren't going away when you uninstall)

    I'll need to update WPBook lite to handle better what happens in the "page" section when there is incorrect data so you can fix your FB profile ID.

    (If you have direct db access, you can remove the "wpbookLiteAdminOptions" from your wp_options table - but I realize that can be a bit tricky)

  5. John Eckman
    Posted 4 years ago #

    I've just updated to 1.2.1, which won't fix the display of the admin page but should delete the options from the db.

    You'll have to install it again, then uninstall and it should clear it's db settings.

    I'll also look at what error was occurring the admin page - thanks for the screenshot.

  6. manu657
    Posted 4 years ago #

    I still get this error. I've used correct profile and page IDs.. using wpbooklite 1.2.4 with WordPress 3.1.3. It still throws

  7. John Eckman
    Posted 4 years ago #

    @manu657 - are you are trying to publish to a page, or a group? What's the ID of the thing you are trying to push to?

    Is your domain set correctly in your Facebook application?

    Is the personal profile you're using (logged in to facebook as when you generate the access token) an admin of the page to which you are trying to publish?

  8. markandrewkato
    Posted 4 years ago #

    Hi John,

    I have the same problem with manu657. In Facebook application, it says that it is required to have a secure page and secure canvas URL's.

    Secure Canvas URL will be required on October 1, 2011.
    Secure Page Tab URL will be required on October 1, 2011.

    Does this affect the plugin?

    Domains are set correctly. I'm logged in when I generated an access token. Here's the group ID where I want to connect my WP with. "286963812356" (from http://www.facebook.com/groups/286963812356/)

    Any help?


    EDIT: BTW, when I'm generating an access code, it sends me to a blank page and it stops loading.

  9. John Eckman
    Posted 4 years ago #

    The secure canvas URL and secure page tab url only apply if you are trying to have a canvas page or tab.

    That's why WPBook Lite exists - in WPBook you would need SSL.

    In generating the access code, it should not be a fully blank page.

    You should get a permissions dialogue in facebook, telling you what permissions the app is requesting, then if you accept you should be sent back to your WordPress blog url with some additional stuff in the query string.

    At that point WordPress is fetching the access token in the background, and it should say at the top of the otherwise blank page something like "Success: access token saved" or "Failure: no access token."

    In either case, you should see a link to return to your regular blog page.

    If you're not seeing that behavior, something else is wrong. (I'm assuming you've already upgraded to 1.2.5, which behaves as I've described - 1.2.4 had a bug in the capture access token bit).

    What is the link destination of the "Generate Access" link, including all the query string bits?

    Are you getting anything in your PHP error log, when you try to generate tokens?

  10. markandrewkato
    Posted 4 years ago #

  11. markandrewkato
    Posted 4 years ago #

    I've already updated the plugin to 1.2.5. Here's the previous error in the error log.

    [21-Feb-2012 03:54:29] PHP Fatal error: Cannot use object of type WP_Error as array in /home/raquelka/public_html/mmll2/wp-content/plugins/wpbook-lite/wpbook-lite.php on line 634

    I generated the token successfully. But still getting this error message.

    No post id returned from Facebook, $fb_response was /n and $fb_page_type was and $wpbook_description was test and $my_title was Facebook Test

  12. manu657
    Posted 4 years ago #

    @johneckman I'm trying to post to a page which I'm an admin. I used my profile id for this. Do I need to change?

  13. John Eckman
    Posted 4 years ago #

    @markandrewkato - that error referring to line 634 means you are not successfully generating (or retrieving) a token.

    The bit that comes back on the return url from Facebook (code=) is a code which WPBook Lite then uses to turn around and request, in the background, using wp_remote_request, an actual token.

    When you visit your WPBook Lite settings page, does it say it has a token stored? What does it say that token is?

    Unfortunately, the error isn't giving us much useful info but it clearly shows that the wp_remote_request failed - basically the code is trying to get the access token out of the response but the response is a WordPress Error object instead.

    In short, the wp_remote_request is failing.

    Do you know if your web server is able to make requests to external sites via cURL or fopen?

    Did WPBook Lite *ever* work on your setup?

    I will need to create a new debug version which includes error checking on the wp_remote_request to find out what the WP_Error object contains.

  14. John Eckman
    Posted 4 years ago #

    @manu657 What do you mean when you say you used your profile id for this?

    Where WPBook Lite asks for your profile id, put your profile id.

    Where WPBook Lite asks for a page ID, put the page ID.

    Have you updated to 1.2.5, and have you generated an access token since updating to 1.2.5?

    If so, what do you see when you load the WPBook Lite Settings page - does it say it has the proper access tokens it needs?

  15. John Eckman
    Posted 4 years ago #

    @markandrewkato Just checked in a version of WPBook Lite which looks for that WP_error object in the response from wp_remote_request and outputs it.

    Can you install the development version from:

    And try generating an access token again? This should generate a more useful error than the blank page you're getting now.

  16. markandrewkato
    Posted 4 years ago #

    @johneckman I've tried the development version of the plugin. Installed it and filled all the required fields. Then when I clicked the grant access permission link, this error showed.

    Failed in creating access tokenResponse was Array ( [headers] => Array ( [access-control-allow-origin] => * [cache-control] => private, no-cache, no-store, must-revalidate [content-type] => text/plain; charset=UTF-8 [expires] => Sat, 01 Jan 2000 00:00:00 GMT [pragma] => no-cache [x-fb-rev] => 511645 [x-fb-debug] => kEv0aIqlTscPAZwuu4/8rsOAPL06I9Qh5QXAuI6fvBw= [connection] => close [content-length] => 143 ) [body] => access_token=AAAEkbV4LZAHIBAJ9ynZCw1YkBP64c5SyMzNFeJtk5qSL1qZAPysRx5Vh3kuUWbKtaE5wTKa57p01DAw9BJZC7Tnn1ZBcoyWXgZCLB8ZAY1BsQZDZD&expires=5136958 [response] => Array ( [code] => 200 [message] => OK ) [cookies] => Array ( ) [filename] => )

    Maybe that's the thing you want to see.

  17. John Eckman
    Posted 4 years ago #

    Hmm. That's certainly unexpected and interesting. Note that your access_token still has an expires on the end of it.

    What's odd though is that WPBook Lite should accept that token anyway - it's examining the response and looking for access_token= in the body of the response.

    No idea why this piece is failing:

    if((is_array($response)) && (strpos($response['body'],'access_token=') !== false))

    Basically this looks to see if what we got back from wp_remote_request is an array, which it is, and whether the 'body' key of that array includes the string 'access_token=', which it clearly does.

    Checking in a less restrictive test now.

    I am still worried also about the "expires" in your access token - if you are granting offline_access permissions you should not get an expires with your access token.

  18. John Eckman
    Posted 4 years ago #

    Ah - looks like yet another Facebook API change. See http://developers.facebook.com/docs/offline-access-deprecation/

    Make sure your Facebook app has "deprecate offline access" set to disabled - that will eliminate the expires= from the access tokens you generate.

  19. manu657
    Posted 4 years ago #

    yes... works now after this offline access deprecation thing you updated.

  20. John Eckman
    Posted 4 years ago #

    @manu657 To be clear, I didn't update anything about offline access - Facebook did.

    They periodically change their API, the look of the app settings pages, and so on - I can't always keep up.

  21. markandrewkato
    Posted 4 years ago #

    Same here. At first it didn't work but then i thought its because im using the development plugin. So i changed to the latest version and viola! It worked!

    Thanks John! Great plugin!

  22. markandrewkato
    Posted 4 years ago #

    Hi John,

    I tried updating an older post and publish it in our groups. But unfortunately, it doesn't work. Only new posts are sent to Facebook and comments are also not working.

    I've checked both Import comments from Facebook Walls and Automatically approve imported Wall comments. 1 day for how many days will it look and input my email address.

    Then I've tried putting a comment on the post in the WordPress Site. Nothing happened. Next is I've tried commenting on the Facebook post (the one that is sent by WPBook Lite). Nothing happened.

    Sorry but am I missing something?

  23. John Eckman
    Posted 4 years ago #


    Couple different issues mixed in your last post - I'll try to take them one at a time.

    1. Updating older posts.

    When WPBook Lite posts to your Facebook Wall (or the wall of a page/group/etc) it is a one-time event.

    Updating that post in WordPress will not update the excerpt already posted to Facebook. I don't believe the Facebook API offers any way to "edit" things already posted.

    If you want to re-publish to your Facebook Wall, you can edit the post, change its status back to draft, save that, and then publish it again - this will re-trigger publishing to Facebook.

    2. Pushing comments from WordPress to Facebook

    You mention commenting on the WordPress side and not seeing anything in Facebook. If you're using WPBook Lite, that is the expected behavior. WPBook would show that comment (which was made in WordPress) on the canvas page of that post, but neither WPBook nor WPBook Lite will actually push comments to Facebook against a wall excerpt.

    3. Importing comments from Facebook to WordPress

    The "number of days to check" is based on how many days old the Post is in WordPress - it looks for comments against Facebook wall posts for all the posts in WordPress published within as many days. Setting this to one will only look for comments made against posts published in the same day. (And this is publish date - so if you update a post and re-publish it but don't change the date, comments will not be sought).

    As to why comment importing is failing, there are again multiple possible reasons for that:

    • Your WordPress install does not have a functioning wp-cron - WPBook Lite and WPBook both rely on a wp-cron task triggered hourly to check for comments
    • Your access_token is not an offline_access token because your Facebook app has the "deprecate offline_access" property set to enabled, which means your stored access_token is expiring, so when the import comments task runs it has no access to Facebook
    • Facebook's API stops responding. This happens less frequently now, but does still happen from time to time. Sometimes this is network issues between your server and Facebook, sometimes it just drops a response.
    • Your WordPress install runs out of memory or the process is shut down by your host. If you're checking for comments on a large number of posts, the WordPress wp-cron process can time out, run out of memory, or be shut down by your hosting provider.

    To see which of these it is, enable debugging (setting in WPBook Lite settings page) and look at the debug.txt (separate file from the one for publishing) to see what it says.

Topic Closed

This topic has been closed to new replies.

About this Topic