I needed this module to work with the newest Facebook PHP SDK (v5) so it can update posts and just wanted to share the results.
The module supports updating the posts now, although the message field is the only field which actually updates.
The documentation is a little unclear on this: Graph API Reference says "all fields in the publishing Section" -> https://developers.facebook.com/docs/graph-api/reference/v2.5/post but through the UI it is not possible to update the link and name fields -> https://www.facebook.com/help/201770183198968.
So here are the quick specs:
- PHP 5.4 or higher (because of Facebook SDK)
- Facebook SDK v5 (in libraries/facebook-php-sdk-v4)
- Graph API 2.5 (is hardcoded in FBAutopost.php)
Oh and I dropped support for the SDK v3.
You will need to update your "update in fb" and "delete in fb" rules, because "delete in fb" needs a page id argument now and "update in fb" now has the correct page ids (array_merge lost the ids before in fb_autopost_entity_rules.inc)
It seems to be working for me now but no guarantee that it will work for you.
Please feel free to test, comment and contribute
Comment | File | Size | Author |
---|---|---|---|
#10 | fb_autopost-v4_SDK_compat-2602478-10-7.x.patch | 33.23 KB | GuyPaddock |
#8 | fb_autopost-v4_SDK_compat-2602478-8-7.x.patch | 26.18 KB | GuyPaddock |
update_SDKv5.patch | 25.78 KB | heng |
Comments
Comment #2
mskill99 CreditAttribution: mskill99 commentedHeng, thanks for doing this. The patch did not work for me. (Failed on Git apply) I tried it on 7.x-1.4. Did you use 7.x-1.x-dev by chance? I'd really like to get this working if you have any guidance...
Comment #3
KevinVb CreditAttribution: KevinVb at Dropsolid commentedI have tried the patch and this is the output
There are some issues with changes done to the .info file.
I'm currently trying to set things up, SDK is working:
Facebook PHP SDK 5.0.0 - Support for this version is experimental
I'm using:
- FB autopost dev version
- FB api v 2.5
- SDK v 4.5.0
Comment #4
topdillon CreditAttribution: topdillon commentedDid you ever get this working?
Which SDK?
Comment #5
xadag CreditAttribution: xadag commentedI applied this patch well (except reject on .info but not important) on the latest dev version of the module (4 april), with the latest sdk from facebook
https://github.com/facebook/facebook-php-sdk-v4
Comment #6
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedThis patch applies cleanly if you checkout the latest code from dev using GIT rather than downloading the dev release from Drupal.org. The reason for this is because the Drupal.org packaging system adds extra version information and timestamps to the
.info
file.The other comments in this issue seem to imply that the patch is improper because of the conflicts on the info files. Quite the opposite -- the patch was created from the copy of the code in GIT, per Drupal's standard documentation.
Having said that, the patch is not named correctly. See the docs on this.
Comment #7
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedThe original patch had three issues:
hook_requirements
(looks like this came from the same bug as #2301719: hook_requirements warnings.).Attached is a re-roll with these issues addressed.
NOTE FOR MAINTAINERS: If/when this patch is commited, it should probably be the start of a new branch of Facebook Autopost. The OP's original patch seemed to have two sets of logic implemented -- one for detecting and using the legacy v3 version of the SDK, and one for v4/v5 -- but the v3 code was then just commented out. Initially, I thought I could just uncomment that and polish it up, but a lot of the changes to the way the API is used are breaking changes that won't work in v3 so instead it looks like we just need a new major version of the module to work with v4 of the Facebook SDK.
There's also some question as to whether calendar events should be included anymore (i.e.
FBAutopostEntityEvent
), since the API no longer allows us to create, update, or delete them. There's also no longer support foractions
onPosts
, so the special class forFBAutopostPost
seems kind of pointless now.Comment #8
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedFound some remaining issue with
hook_requirements
.Comment #9
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedCorrecting issue title.
Comment #10
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedAdded to the patch the removal of the "actions" field from "Post" publication types, as it no longer exists.
I'm not removing my old version of the patch, in case I'm mistaken here. Feedback welcome.
Comment #11
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedIf you are running on a version of PHP earlier than 5.6, after applying the patch from this thread, also apply the patch from #2763517: hash_equals() (required by Facebook SDK) is not available in PHP 5.4.
Comment #12
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedSetting back to NW since the exception types have also changed...
Comment #13
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedComment #14
tommaso.asciolla CreditAttribution: tommaso.asciolla commentedHi,
the patch did not work for me.
Can you attach fb_autopost module with patch?
Thanks,
Tommaso
Comment #15
scsmith CreditAttribution: scsmith commentedI too would love to find a "fully patched" version. I have a WORKING version now, but I really wish this module would get a new maintainer (hint hint Guy Paddock, or new interest from its original developer. This module does exactly what I want - I'm just afraid it will stop working any day!
Comment #16
scsmith CreditAttribution: scsmith commentedPlease see this issue (https://www.drupal.org/node/2909088) if you are interested in having this module updated! I'm helping to look for some "sponsors". I'm willing to pitch in...are you?
Comment #17
dnd CreditAttribution: dnd commentedHi!
Anyone knows how to upgrade graph api from version 2.5 to higher 2.8, 2.9, ... on fb_autopost module?
I 've Facebook sdk 5.5.
Thanks in advise!