I see quite a few posts on the topic (and methods that have changed over time) - is there a working 'recipe' to enable users to post to their Facebook Wall?
The handbook page seems to be at least partially out of date and I see Dave has included example code in the latest releases, but I'm not sure how this would be implemented. I'm also aware from Dave's comments that it's a more complex issue than it might appear at first glance.
In my situation, I simply want the owner of the site to be able to selectively post to their user Wall. I do see the checkboxes on the nodes and FB seems to be synced, but saving Drupal nodes with "Share of Facebook" or "Announce this post on Facebook" checked doesn't seem to do anything.
I assume that both Export Posts (export_stream) and Publish to my Wall (publish_stream) need to be enabled in extended permissions (both required and optional) and I've also seen a post that indicated that the Facebook Share module is incompatible with DFF (as well as not being able to post to the user wall).
So it looks like there's a lot of different information floating around, but there's no one place that describes a working solution. If anybody has a clear step-by-step description of how to get posting to Wall to work, I'm sure there are many of us who would be most grateful.
Of course, major thanks to Dave for being the Drupal Facebook-meister - any guidance greatly appreciated!
Comments
Comment #1
Dave Cohen commentedThe example code uses a dialog box. If it's not working, look in both drupal log and firebug console (for javascript errors). That approach does not require stream_publish permission. You should see this behavior working on drupalforfacebook.org forums. If there's a problem with the handbook regarding this, I'm not aware of it
With stream_publish permission granted, you can post to walls without the dialog box appearing. The modern way to do this is a POST to facebook's graph API. Agreed that fb_stream.module should help with this. It doesn't yet, and that might be the first thing in a 3.1 release. And yeah that could use documentation, too.
Comment #2
bcobin commentedThanks, Dave - sorry to be a pain. I must be missing something then.
Here's a step-by-step description of what I'm doing:
Update: I've edited the post with the results from disabling Mobile Tools in italics.
(I have previously successfully - apparently anyway, linked the User and FB accounts, but have disabled FB Connect until everything's right insofar as the site is live.)
1. Disable publish_stream (as per your response, above.)
2. Enable FB Connect. All FB modules are now enabled save for User registration - example apps are enabled.
3. Login via FB Connect - I get Access Denied page. Update: directed to user/login after login which always gives Access Denied.)
4. Go to My Account - Facebook tab and Application tab are both there. Facebook tab has greyed-out check mark (already connected) and [Application] tab shows application - clicking on link goes to FB apps. All this looks good.
5. Go to a post - hit Edit. Share on Facebook checkboxes are enabled - there are two of them. (?) I leave only the first one checked. (Second one is perhaps for an attached image CCK field I have?)
6. Save node.
OMG - this is new - I now get a Post to Your Wall popup. (I didn't earlier today.) Hit Publish. I now get another Post to Your Wall popup. I hit publish. This is encouraging. No errors indicated. Update: After disabling Mobile Tools, there's only one popup.
But... post does not show up on FB Wall, nor on News feed. Update: After disabling Mobile Tools, post shows up on News Feed - not Wall. An improvement!
There are several error messages in the logs - first is:
The Facebook Application labeled [application] has a suspicious connect_url. The value is http://[site]/, while something starting with http://m.[site] was expected. Consider editing [application]. Update: After disabling Mobile Tools, no error on the logs - initially, anyway. After several minutes, I see a suspicious connect_url from another source:
The Facebook Application labeled [application] has a suspicious connect_url. The value is http://[site]/, while something starting with [unknown url] was expected. Consider editing [application]. The [unknown url] is a company from India, which I assume was accessing the site while FB Connect was turned on. Eew.
Note that I am using Mobile Tools and am redirecting based on domain name. The suspicious connect_url now seems to be triggered by every possible way to access the site- via IP (errors I reported on a different thread) www. and now via mobile domain. I have edited .htaccess to define base domain as / and to force to http:// (no www.)
I will try disabling Mobile Tools tomorrow and report back - the popups are at least encouraging. Sorry to be so long-winded - perhaps this will help out others when I figure it all out.
Thanks, Dave!
Disable FB Connect until we can get this sussed out...
Comment #3
Dave Cohen commentedThe suspicious URL is not an error, you don't need to worry about it too much. (I'll change it to look like a warning instead of error)
Or put another way, it can be an error in some cases. But if your site is accessable from multiple URLs, then you will see that message as long as fb_devel.module is enabled. Generally it should be disabled once your site is working properly.
If you ever make a copy of your site, say for developing, and you copy the database from your live site to the local copy, then you'll see the error and it really will be a problem, because your local copy should not be using the same facebook application as the live site.
Comment #4
bcobin commentedExcellent.
I was able to successfully post earlier today - with Mobile Tools off - but it went to the News stream, not the Wall. Is that the expected behavior? It's tough to know what might be interfering with what... thanks!
Comment #5
Dave Cohen commentedNews feed, wall - same thing really. Your wall is posts to your feed and your friends' feeds.
I don't know anything about mobile tools. Not sure why there are problems when it is enabled.
Comment #6
fordprefect76 commentedI read the README.txt from start to finish
I am having a similar issues to bcobin. I am trying to post to my Users facebook wall but nothing ever appears.
Steps to date:
1. Setup Drupal for facebook based on the readme.txt file and the setup support found in the Documentation(http://drupal.org/node/912614)
2. Enable FB Connect. All FB modules are now enabled save for User registration - example apps are enabled.
3. Login Via FB Connect - This works for me. Not sure why bcobin had an issue
3. a) I have enabled the following Extended Permissions: News Feed & Wall - access my News Feed & Wall (read_stream),Status Updates - update my status (status_update), Events - create and modify events (create_event),Offline Access - access my data when I'm not using the application (offline_access), Publish to my Wall - publish content to my Wall (publish_stream)
4.Go to My Account - Facebook tab and Application tab are both there. Facebook tab has greyed-out check mark (already connected) and [Application] tab shows application - clicking on link goes to FB apps. All this looks good.
5.Go to a post - hit Edit. Share on Facebook checkboxes are enabled - there are two of them. (?) I leave only the first one checked. (Second one is perhaps for an attached image CCK field I have?)
6. Save Node
Nothing Appears on my wall.
I have FB Development tools enabled and i can view the block output. In the "Session" section I can see that my fb_strem_dialogs data is there.
What can I test next? How can I tell if the drupal site is interacting with facebook at this point?
Comment #7
Dave Cohen commentedIt's weird that you see two checkboxes.
Start by enabling firebug or whatever for your browser and looking for javascript errors.
Comment #8
fordprefect76 commentedHi Dave. Thanks for the reply
I figured out why i had the duplicate facebook checkboxes. I had the Example module enable as well as my custom module and they both had the code for the checkbox in them. I have disabled my module and I am just testing using the Example Module.
There are no javascript errors. I do not see any javascript action at all. How is Drupal For FB suppose to submit the wallpost to Facebook? I guess I do not understand how the module's stream.publish pushes the data to facebook. I think that is why I can not debug it. Can you give me some insight into this process?
Comment #9
Dave Cohen commentedThe way it works is...
1) node is saved
2) fb_example.module stores the details
3) drupal goes to node/NNN URL.
4) fb_example uses the stored details to call stream.publish, which brings up a dialog allowing the user to publish the message. Nothing is actually sent to the wall until the user submits the popup.
If you have some other javascript redirecting the page, or causing an error, that could prevent it from working.
Comment #10
fordprefect76 commentedI am not getting any javascript errors.
I thought the code in the Example module would actually post to facebook directly without the dialog box. If not what is the point of the form Share on Facebook checkbox.
Comment #11
Dave Cohen commentedIt works that way for historical reasons. It's now possible to post automatically, if user has granted extended perms, but modules have not been updated to support that, at least not yet. The example is the closest you can get to automatically posting when the extended perm has not been granted.
Comment #12
giorgio79 commentedHi Dave,
How can one do this programmatically? What fb function do I need to call to post a message to User Wall?
Comment #13
merzikain commentedI have content from my own custom module that I need to allow users to post to their walls. The content does not hit the node api at all so I'm curious how to do this programmatically as well.
Comment #14
Dave Cohen commentedfb_stream uses code like the following to post to user wall.
The trick is to build the $params array with the right content for your post. Also the users access_token.
Take a look at fb_stream_nodeapi(), for a working example. Please post your useful snippets here (or the doc pages) so others can learn from the example.