I read the README.txt from start to finish.
Hello, I'm trying to make it so when users post blogs, or other types of nodes, they have the option to post it to their wall on facebook to let their friends view.
I've read the documentation at:
http://drupal.org/node/685320
But I'm still kind of a Drupal and PHP novice. I can kind of understand the code posted if I read it, but I'm not sure where to put the code?
As of right now out of the box, the module doesn't add the option to publish to facebook walls on nodes, I understand this all has to be manually coded in? If anyone knows a little more specific and easier to follow instructions, it would be very helpful!
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | fb_node_pub.zip | 2.38 KB | Jean Rodas |
| #26 | fb_node_pub.zip | 1.11 KB | rgs |
| #17 | facebook.zip | 3.1 KB | nancydru |
| #10 | dff_customs.zip | 2.25 KB | srinikasturi |
Comments
Comment #1
Dave Cohen commentedSearch drupal.org and the web in general for good instructions on how to build a module. You really should have some knowledge of Drupal before diving into this stuff. There's good documentation out there, I don't have a link handy but it should be easy to find.
Comment #2
pribeh commentedIs there nothing like this that comes with Drupal for Facebook?
Hey SewFresh, you might want to check out fbconnect's code since I believe they just added the ability to post nodes to a user's wall in their dev. I would very much so be interested in this however am not a programmer.
Comment #3
summit commentedSubscribing, can I publish nodes on FB userpage with this module? like I can with the twitter module?
greetings, Martijn
Comment #4
WildBill commentedWhy is the code at http://drupal.org/node/685320 not included as a part of the standard fb_stream.module? Why is it separated out like that? Must be a good reason.
Comment #5
Dave Cohen commentedThat code is separated out because it's not a one-size-fits-all solution. Note for example, that Miquel Carol added to the comments a version that uses the Image Field module.
Some site admins might want this function for some content types but not others. Some might want other custom links different from "read more". Some might want different user_message text. There are so many variables here that it's difficult to write a module to configure them all, but pretty easy to edit some PHP.
So the idea is in fb_stream.module to support the most basic helper functions, but not try to be all things to all people. How to make this easier for non-programmers? I'm not sure. Maybe there should be a module in modules/fb/contrib/. Maybe someone can submit another drupal module that adds some commonly requested features like this. I'm not sure, I just don't want to check in a bunch of code that I may not be able to support long-term.
Comment #6
summit commentedHi,
+1 for modules/fb/contrib solution!
I think to post it as contributed module in modules/fb/contrib/ would be great! Then it is still maintained within fb scope (doesn't mean you have to work more on it), and patches can be send in by the community.
greetings, Martijn
Comment #7
nancydruSee also #812202: DFF Publish to Wall.
Comment #8
rgsHi folks. I have read the read me from start to finish, as well as all the other posts on this subject. Thanks so much for all the hard work from Dave and the community. I have built the basic module for publishing to walls and it is not working. I'm not sure if I have done something wrong or if it is simply not meant for the 3.0 branch? I've logged in through fb connect, etc., enabled the module, but still no sign of the option in node create or comment. Is it me or is it that this is not yet supported in 3.0 branch? Help please. Thanks.
Comment #9
srinikasturi commentedThis seems to me a common enough request but the fact that no one has posted a zipped module up makes me think there's an elephant in the room :)
i would gladly post mine if it worked.
I followed the instructions on creating a module, copied Dave Cohen's code, FTPed, enabled, and...nothing. I didn't see the tickbox to post to stream on any content type. The other thing I failed at with similar results is the like button.
Grateful if anyone can post zips of these 2 modules for general use.
Thanks.
Comment #10
srinikasturi commentedI've attached a zip with 2 modules that have the code for adding the like button and the publish to stream checkbox, and *do not work*. Any help please on what is missing here?
Thanks
Srini
Comment #11
srinikasturi commentedOK, the like module in the attachment in #10 works, but the publish to fb stream doesn't.
Comment #12
rgsSame experience. My own stream module did not work either.has anyone gotten it working in 3.0 branch?
This is an enormously important feature. Would be much appreciated to have a little more feedback from others as to whether this works for them. Maybe a few other folks could try these modules? Thank you srinikasturi for posting.
Comment #13
rgsJust tried Miquel Carol's module 'field_imagefb' from http://drupal.org/node/685320 and it did not work.
Can't help feeling like we are barking up a dead tree here -- that this worked in the 2.0 branch but something different needs to be done for 3.0? Grasping at straws...
Comment #14
rgsI just took the Drupal for Facebook tour again and i see that when i go to create a forum topic there is indeed a check box tor 'share on facebook' so clearly this feature does work on the 3.0 branch and i have done something wrong somewhere. Everything else seems to work like a charm. Little help please, any help, please? Have provided install details above - won't clutter the thread by restating. Any help will be much appreciated.
Comment #15
nancydruI got the checkbox to show up; I've never been concerned about that. The problem is that the post is not going to FB.
Comment #16
rgsO boy. Something to look forward to. Would you mind posting your info and module files for srinikasturi and I? If it does not work with your module then it may be theme related. I'm guessing. If we do get it working you will have two more folks trying to actually get it to post:-)
Comment #17
nancydruHere it is, although I honestly don't see it being of much help.
Comment #18
fehin commentedI found this module http://drupal.org/project/facebookshare, has anyone tried it?
Comment #19
fehin commentedI have been researching the best solution for this but i'm a little confused, don't those ShareThis, AddtoAny type of modules publish the node to facebook? Would one of those kind of modules be enough to get users to publish nodes to their facebook walls?
Comment #20
Dave Cohen commentedYou can use those share modules to post a URL to a user's wall.
The technique described at http://drupal.org/node/685320 allows you to post to user's wall or other facebook pages. You have more control over the post - for example, which media or action links appear. And more control over when the post dialog appears - for example, in response to a node post, rather than hitting a button on the node page.
Comment #21
fehin commentedThanks Dave for the info. The ability to post a node into facebook during node creation sounds like a good idea. I found this module http://drupal.org/project/postiteverywhere but I'm not sure if it's conflicts with DFF.
Comment #22
masipila commentedHi,
I had problems to get the checkboxes to show up in the technique described at http://drupal.org/node/685320. I modified the hook_alter_form -function a little bit because the $GLOBALS['fb'] was not set and thus the checkboxes were not added. The modification can be found from this comment: http://drupal.org/node/685320#comment-3160164
Comment #23
nancydru@masipila: it can also be found in comment #17 above.
Comment #24
Dave Cohen commentedI changed the two globals, originally
$fband$fb_app, to be$_fband$_fb_appbecause the coder module told me to. Sorry for the confusion, just use $GLOBALS['_fb'] instead.Comment #25
summit commentedHi
Could anyone post here a working method please? like the twitter 2.6 module?
Thanks a lot in advance!
greetings, Martijn
Comment #26
rgsWorking like a charm now. Thank you masipila and everyone else.
See attached module file 'fb_node_pub'
Comment #27
summit commentedHi, will this module gets its own drupal.org page?
Would be great so people also can file issues, if any, right?
greetings,
Martijn
Comment #28
rgsWill work on it.
Comment #29
rgsAs much as folks seem to need this module - i sure could have used it - i am concerned about just adding to the list of facebook modules - especially in the context of Dave's comment (post 5). How would one go about including it in 'modules/fb/contrib/' Or should the documentation just be updated to include the correct module code and a little more detailed instructions?
Comment #30
masipila commentedI totally agree with Dave that it would be very hard to write a one-size-fits-all module. I guess that an example module with good documentation (and pointers to general module development tutorials) would be the best solution for at least now when the whole dff module is still under development.
There are so many different use cases that could be imagined - the Graph API gives us so much flexibility that people like me are just realizing when they get their hands dirty with their first fb connect site. An example module that shows how you implement different API stuff would be great - but it would be just an example for your own custom module that does just what it is needed in your case.
Comment #31
nancydruI can do development, but I couldn't even get my version to post. Perhaps I can now drop back and start with this code. So, yes, a working example is a good start.
Comment #32
rgsI will gladly begin working on detailed instructions to go along with the basic sample code to update the documentation. Have other folks had success with the code posted in comment 26?
Comment #33
masipila commentedI'll be glad to contribute some examples to this example module as well.
I'm currently developing some graph API stuff (which turned out to be very simple) but it took me a good while to figure out how one is supposed to call the APIs. The FB Graph API page talks about curl stuff (see section "Publishing to Facebook") but the actual HTTP requests made with curl are abstracted like two or three layers below...
By the way - should we start a new issue for this example module? The current name of this issue refers to publishing to Facebook but I could easily imagine that the example module could end up having examples of other things as well (how to read from Graph API, how to write to Graph API, etc).
Markus
Comment #34
srinikasturi commentedrgs, the code works beautifully. Thank you!
Comment #35
rgsGlad it's working. I think eventually the best place for the various module code and instructions would be in the 'FB Recipes' - http://drupal.org/node/205481
In the meantime we could start an 'example modules' issue?
Comment #36
artwork commentedI have problem with user_message. Its always blank, does user_message work for you guys ?
Thanks,
Comment #37
rgsNo. Not blank for me. Working fine. Does it post to your wall and your friends' news feed?
Comment #38
summit commentedHi, I added module #26 to modules/fb/contrib but couldn't see the module with admin/build/modules under drupal for facebook. Is this normal behaviour?
Would love to be able to add nodes to facebook, like with twitter. Optiimal scenario is to be able to post the node teasers to facebook.
greetings, Martijn
Comment #39
nancydruMartijn, that zip file does not include an info file, which is needed to make it work.
Comment #40
rgsExactly. I didn't even think to include it with the zip. Let me know if you need it and i will be happy to upload another zip to avoid same problem for others. Some folks may have different preferences as to what field group it goes into. I just put it in 'other'.
Comment #41
summit commentedHi, yes please for new zip. And wouldn't it be right to put it into the FB group?
Do we need drupal for Facebook installed to have it working, or is it independent?
Please also put the dependencies into the .info file.
Thanks a lot in advance for the effort!
greetings, Martijn
Comment #42
Jean Rodas commentedFor me just when a user login to the site, asks for permission to add content but when he/she comment or post new content nothing happen and facebook wall dont have nothing neither. Please help!
Comment #43
Jean Rodas commentedFinally did it. For newbies like me. Just unziped, placed in your modules folder, and enable it in admin.
Comment #44
escore commentedDoes this code still work? I had problems with similar code (http://drupal.org/node/870544) and it seems FB has made changes to the argument names ('user_message' -> 'message') for the streamPublish methods (http://wiki.developers.facebook.com/index.php/Stream.publish).
Comment #45
Jean Rodas commentedStill work for me!
Edit: Now it's not working.
Just change 'user_message' for 'message'
Thanks escore
Comment #46
Jean Rodas commentedI have a new promblem with publish to users wall.
When users sent their comment to Facebook Wall, if the comment is too long its not send it right or Facebook don't recibe it right(Nothing related with the comment is send it or recibe it) because Facebook only accept 420 characters in the Wall.
So if someone could help me with that or point me how can i trim the comment in a simple way because i don't have much experience with php i'll be bery thankfull.
Comment #47
masipila commentedJean, you need to run the PHP variable containing your message text through a truncate function.
Drupal has a function called truncate_utf8(), see http://api.drupal.org/api/function/truncate_utf8/6
Let's assume your message is in variable $message. You truncate it like this
Comment #48
Jean Rodas commentedThanks masapila for taking the time i'll try to do that now!!
Comment #49
kiwad commentedFor those of you who just want to post content of a site to its facebook wall, you might want to use rules+mimemail to send an email to your secret email address given by Facebook in its mobile tools (for pages or accounts).
Best trick would be to create a CCK limited to 420 caracters and use the content of this CCK as the title of your email.
In my nodes (such as blog) I'm using a conditional CCK field "Post on Facebook" yes|no -> if yes, there is a text zone that I limit to 400 car.
Then, in rules, I set a condition IF "post on facebook" = yes THEN Send a mail to an arbitrary mail address and I set the title of my email as to be my [node:field_facebook_texte-formatted] [site:url]/node/[node:nid] (still need to install a link shorten to use aliases)
Adding an image is still tricky, but there is a patch to mimemail that I haven't tried yet which should allow you to add files to emails
Comment #50
butler360 commentedSubscribing.
Comment #51
Dave Cohen commentedI checked in an example module into 6.x-3.x-dev. The code used by drupalforfacebook.org to publish to walls is in there. I plan to put other examples of common customizations in there as well.
Comment #53
Marko B commentedThis is such confusion!
Is Stream module API or normal module?
Where to put #43, what are dependencies?
Can i post to my facebook wall without making an APP? apperently you cannot as you have to make app to use connect, at least this facebook connect.
Readme says " Enable fb_app.module and fb_user.module if you plan to create facebook applications." Can you use facebook for drupal in any way if you don't create app? This would seem you can, but i cannot see any use?
Comment #54
Dave Cohen commentedHey, it's not perfect. But commenting on closed threads only makes it more confusing.
You need an app to publish to a wall. Without an app, you can use social plugins (i.e. Like Button).
the 3.x branch now includes fb_example.module, which has some code examples including a way to publish to user's wall.
Comment #55
Marko B commentedSorry for confusion Dave, you can delete my posts if you want to make it more clear.
Comment #56
marcus178 commentedDo you have any examples of how your using the Graph API, been tried to figure out how to implement it in a module all day with no success.
Comment #57
wonka68 commentedAny chance anyone can answer a question related to this issue?
I've applied the new module, and installed Drupal for facebook, and enabled ALL the modules, but the "share in facebook" checkbox won't appear in a node when creating/updating.
After a bit of debugging, I can see the failure occurs in the call to fb_facebook_user - it returns nothing.
I guessed that this might be because I hadn't got an facebook apps registered, although nobody mentioned that above...
So I registered an app in facebook, following instructions in drupal for facebook docs, readme. But now I get SSL error & fb_call_method failure, so I've come to a dead end.
So, could somebody confirm if there is any need to register a FB app, and if not, what could I be doing wrong?
Comment #58
wonka68 commentedWell, after many many hours of trying, I eventually got this to work. I have to say, the documentation, or lack of documentation, stinks. I salute and applaud whoever took the time and trouble to develop the API, but crucial prerequisites are simply not mentioned. What's worse, there is a list of instructions that lull you into a false sense of security - you would expect that by following them to the letter that this publishing module would work. Not true though.
This is a failing of lots of software developers - not bothering to write up the "unglamorous" documentation. Please please please don't shoot yourself in the foot by neglecting this.
What I had trouble with was the "share in Facebook" checkbox failing to appear. I traced it to the line:
If (fb_facebook_user()) and further down the stack, found there was no Facebook session.
I even installed a Debugger to go through line by line.
The answer was that I didn't have the Facebook Connect block enabled in the Block configuration.
I'd also neglected to create a Facebook application within my Facebook profile, and you also need to register this in the Facebook settings within Drupal. To be fair, these 2 issues had been mentioned by other Users, so I had picked up on this.
Comment #59
WildBill commented@wonka68 - This is open source software, provided free to you by a developer who most likely doesn't make any money off of it. If you think the documentation is insufficient, why don't you edit it? Every Drupal user has the ability to edit the documentation, so instead of complaining, contribute something back to the community!
For the record, I found the documentation pretty straightforward and easy to follow.
I don't have the Facebook Connect block enabled on my site, and I see my "Share on Facebook" checkbox just fine. These two things are unrelated.
These are the first things mentioned in the documentation! Did you even read it?
Comment #60
pribeh commentedBump what WildBill said.
Comment #61
Marko B commentedThe problem is that most users (me inc.) think ok i will install this module and as usuall on some config screen just select on which node types i want comments, add connect block to login, add stream as block etc and its just not happening that way. This module needs much more effort and should probably be more of an API as in most ways it is, isnt it?
Comment #62
WildBill commented@deepM - So essentially, you wish this module was something else?
What does comments have to do with this module? If you want Facebook Comments, just add the
<fb:comments>tag in a block.For the record, if you follow the very clear documentation, you can set up this module in under an hour. If you don't follow the documentation, you will spend hours trying to fix the problems you've created.
Comment #63
Marko B commentedMy wishes have nothing to to with this :-) I can setup this module in minutes now when i got all the info from docs and maybe even more form different issues.
Just saying maybe this should then be called API so people expect they have to code. As this maybe isnt "the drupal way" whatever that is :-) as majority of modules you setup without coding.
Comment #64
maxchock commentedcan this custom module work on Drupal 7?
Thanks.
Comment #65
Net Mystic commentedThanks KIWAD!!
After trying just about every other method mentioned in Drupal forums, I used this method for my Facebook site (http://www.facebook.com/nirvananetsolutions). And posting to my app fanpage's wall works great! I followed KIWAD's advice (comment #49) and tweaked it for a few FB process changes since. Here's how I did it:
ON event Content is going to be saved
IF
AND group
NOT
condition-Node not published indent
AND
condition-Node is now published indent
AND
condition-Controlled field is triggered indent
DO
action-Show message that node is now published
action-Send an HTML mail to an arbitrary mail address
In rules-send email to arbitrary action settings, make the email address an existing gmail account. The wall post CCK field token is used as the subject of the email. This is b/c the email's subject actually appears as the body of the wall post, by FB default.
In this manner, site users can choose to post to the fanpage wall when writing blogs. If they choose "yes", they can type a synopsis of the blog as a wall post, and it's automatically posted upon save. If they schedule the node to be published later, the wall post will be published at that time. Voila!
Note: The gmail account is used b/c Facebook will not accept email wall posts unless from a supported mail server type (currently only gmail, yahoo, or msn). My mimemail failed to post by email when I sent to the secret email directly. By forwarding through a gmail account, I was able to make this work. Good luck!
Comment #66
schackattack commentedIs there any way to make the module in #43 work on facebook pages as well?
Comment #67
Dave Cohen commentedThe way I see it there are two commonly requested features for this.
One is that connected users can easily echo their drupal posts onto their facebook wall/timeline.
The other is that an administrator can configure Drupal so that some content is echoed to a particular facebook fan page. I.e. if I add a story to a site it will appear on facebook even if I am not currently connected to facebook.
For those of you interested in the latter (the site-wide setting), see #1454736: Post Content to Facebook Page using fb_stream.module.
Comment #68
Dave Cohen commentedChanging status so more people will see that last comment.
Comment #70
Marko B commentedYes Dave, you are right, I could have told you this 2 years ago as it is obvious :-)
I make this always by myself as you suggested long time ago, with custom module, but you should consider bringing this into relase or even make a separate module. This feat. and this
http://drupal.org/project/fb_social will satisfy 90% percent or more of users needs so this module will be probably less used but then again issue que will be much smaller.
Comment #71
kevinquillen commentedAll I want to do is implement a checkbox with FAPI that publishes to a users stream. This used to work, but now it doesn't work anymore. The code has not changed since it launched. Where can I start looking?
Edit: Firebug reports this warning when clicking 'Share with Facebook!' button (invoked with fb canvas):
FB.login() called when user is already connected.Comment #72
kevinquillen commentedHeres how I just fixed my code...:
then in a nodeapi insert hook, I check for the flag above, and:
?>
Comment #73
Dave Cohen commentedI'm not sure what was broken about your code. There's code in modules/fb/contrib/fb_example.module that does something similar.
You're better off using
theme('fb_login_button', 'Connect');rather than the fb:login-button markup. The former will include extended permissions (if any are configured, and you would want to prompt for stream_publish).Comment #74
kevinquillen commentedYeah, I don't know. It was working fine up until a month ago, who knows.
Also, one of the FB login methods tries to hijack the entire session without logging in as a valid Drupal user (or registering it, if new). So I ditched using FB Connect.