Active
Project:
Drupal for Facebook
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 May 2010 at 08:03 UTC
Updated:
16 Sep 2012 at 14:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
Dave Cohen commentedTo add a like button right now, start by enabling the core Drupal for Facebook module.
That's enough to embed facebook social tags in your site. Whether they are
<fb:like>or any of the others.Drupal provides tons of ways to get markup onto a page. You could for example add a block with
<fb:like></fb:like>in it. Or do what drupalforfacebook.org does, put a like button in a node's links...In the above code, change "dff_custom" to the name of your module.
The thing is, there are so many ways in Drupal to add markup to a page (blocks, links, node content) I don't know what the best ways are. But I could see a module that makes it easy to add these tags to a page. Such a module would have fb.module as a dependency. And should support
<fb:like>as well as the other facebook social tags.Comment #2
chazz commentedHow I can enable in 6.x.2.0rc2 please?
Comment #3
Dave Cohen commentedThis page will give you markup for a like button: http://developers.facebook.com/docs/reference/plugins/like
In the 2.x version, you can use the iframe markup, but not the XFBML. In 3.x you could use either, the XFBML is recommended.
Comment #4
chazz commentedThanks, I used iframe as I find hard to update from 6.x-2 to 6.x-3
Comment #5
BenK commentedSubscribing...
Comment #6
carlitus commentedThanks David :)
Comment #7
cientista commentedHi, Firstly, this suite of modules really is awesome, thanks. Will there be any support for fetching facebook user details i.e. email and birthday details? As FB conect terms it - authentication and extended permissions
http://developers.facebook.com/docs/authentication/
http://developers.facebook.com/docs/authentication/permissions
Thanks,
Andy
Comment #8
Carlos Miranda Levy commentedTrying to do iframe (using v2.0)...
It works if I do like this (url hardcoded):
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.tedxsantodomingo.com&layout=standard&show_faces=true&width=200&action=like&font=tahoma&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:80px;" allowTransparency="true"></iframe>But if I do (url generated with alias), I get an error:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo fb_scrub_urls(url($_GET['q'], array('absolute' => TRUE))); ?>&layout=standard&show_faces=true&width=200&action=like&font=tahoma&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:80px;" allowTransparency="true"></iframe>Facebook returns an error: "The page at http://www.tedxsantodomingo.com/novedades/i-like could not be reached.", for example.
Any clues? url is properly generated as you can see from the error page, and it works by navigating to it.
Comment #9
Dave Cohen commentedI don't know. Have you tried hard-coding that exact URL?
Comment #10
Carlos Miranda Levy commentedHere's how I got to work... but only as one fixed I like for the whole site and keep in mind I use Drupal for Facebook 2.x:
(http://drupal.org/project/fb_social)
<iframe src="http://www.facebook.com/plugins/like.php?href=http%253A%252F%252Fwww.tedxsantodomingo.com&layout=standard&show_faces=true&width=250&action=like&font=tahoma&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>You can see this block on the top center block of http://www.tedxsantodomingo.com
If I try anyother variation or combination or change the code to have a dynamic url for I like, it fails.
Comment #11
georgedamonkey commentedThis is exactly what I'd like to do. I'd like to have the like button in the link area for nodes (also in the teaser if that's possible). I'm stuck where you say this: 'In the above code, change "dff_custom" to the name of your module.' Which module do you mean? Do I need to create a custom module for this to work? Also, does the code above go into template.php?
Comment #12
stevesmename commentedAttached is a custom built Facebook Like button module I built. Just install, enable and you have settings on each Content Type to enable and disable the like button. The module supports iframe and fbml (if your theme supports it). This module is not necessary dependent on Drupal for Facebook module.
An Open Graph module is still needed.
http://dl.dropbox.com/u/590466/Drupal/modules/fb_like.zip
Comment #13
jaypark commentedis there a way to get a callback for the like button, or some way to see if a user has clicked it?
Comment #14
Dave Cohen commentedMy understanding is you can't.
Comment #15
ticici commented(#3)
Hello Dave,
thanks for shared this information. Is it only here written that "...In the 2.x version, you can use the iframe markup, but not the XFBML." , cause I think I read almost everything these days, trying to make that work, and finally came to this comment. And does it still standing?
I tried to make 6.x-3.x-dev version to work, but I just didn't, and I really need to use XFBML like button, cause I had to catch Like event.
Any sugestions, clue, idea would be appreciated. Thanks in advance.
Comment #16
Dave Cohen commentedMy understanding is the like button (and all "social" buttons) do not create events. You don't learn when users click these buttons. Facebook offers some statistics for you to analyze, but not events for you to react to in real time. This is certainly true when you present the buttons without an associated application, or when a user has not authorized the app. If the user has authorized the app, maybe there's a way, but I don't know what it is.
Comment #17
boris mann commentedShipping an fb_like.module -- either as part of the Drupal for FB bundle or as a separate module with a dependency -- would be a good idea. To Dave's point -- yes, there are a ton of different ways to do the markup. I would start with a block that can be enabled by default (at either a "content top" or "content bottom" region in some theme), as well as a simple one line function that people can embed in themes for advanced uses.
Comment #18
jaypark commentedyou can run an fql to see if the page id is liked by a given user... but this is really sloppy if you need to catch the like event as it occurs. what it does is forces queries, either to your server or fb's (you'd need to query fb to see what the current state is, liked or unliked, even if you saved the results to your server), every time you need to find if a given page or other object id is liked.
Comment #19
ticici commentedThanks for your replies.
Yesterday, I was in a hurry, so I'm not satisfied how I wrote my question. I just wanted to say that I didn't find anywhere else the thing Dave said here (#3) that with 2.x version of module you can't use XFBML buttons. (and that was just what I was trying to do)
But now just to add this: It seems to me there is an option to catche Like with FB.Event.subscribe (http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe). I think I can do what is needed with it. But for that I need XFBML button, (with Facebook Connect working)
(and now I'm just trying to set 3.x-dev version to work:)
Comment #20
Dave Cohen commentedJust to be clear...
The 3.x branch uses the newest libraries, which allow the newest XFBML tags for like buttons, activity stream, and so on.
The 2.x branch supports XFBML in general, but not the very latest "social" tags (like buttons, activity stream). And it's not because the 2.x branch is broken, it is because facebook's older javascript libraries does not support the newest tags.
The primary difference between 2.x and 3.x branches is which version of facebook's libraries they use.
Comment #21
ticici commentedOk. Thank you.
Comment #22
jaypark commentedticici thanks for that #19 link... that was quite a relief to see.
Comment #23
rgssubscribing
Comment #24
adraskoy commentedsubscribing
Comment #25
millions commentedDave, can you post the module you created for your facebook "Like" buttons on each node for all of us less technically gifted drupalers please?
Thanks!
Comment #26
millions commentedI made it work by posting
<fb:like width="275"></fb:like>in node.tpl.php in the links section of the full node.Comment #27
georgedamonkey commentedAbsolutely perfect!
Thank you!!
Comment #28
millions commentedSure thing. I actually ended up changing to post at the top of page.tpl.php so that it shows up on my pages above the teasers. I tried getting it to post on each teaser, and was able to. Unfortunately, it was for the url in the address bar, not the url of each teaser, so moving the code to the top of each page (via page.tpl.php) instead of the bottom of each node worked best for me.
Comment #29
sp_key commentedI didn't like using a block as the facebook like button would display below all comments making it very hard to notice.
Not sure about putting it in the nodes links - would that add it on all content?
I personally added an extra CCK field on all content types that allow commenting, defaulted the value to fb:like /fb:like and prevented editing of the field.
It works fine this way :)
Comment #30
RasputinJones commented>> An Open Graph module is still needed.
http://drupal.org/node/803512
Sharing what I wrote earlier...
Comment #31
westis commentedLike others I'd need a way to select what data is shared to Facebook when a visitor clicks the Like button, such as the image. How can we add Open Graph meta tags to the , as described at http://developers.facebook.com/docs/reference/plugins/like ?
Comment #32
westis commentedI solved this temporarily by manually adding the tags to the in the page template for that particular node type. With help of the Devel module I was able to see what node fields I was able to use to set the correct image etc.
Comment #33
toomanypets commentedPosted a custom module for adding Open Graph protocol meta tags here:
http://drupal.org/node/784904#comment-3582838
Comment #34
jaypark commenteddave, fb's Vernal indicated during the spring release of the latest social graph api that applications could subscribe to their users graph object updates, so fb would "ping" the application site that the users data changed... how does or can dffb handle these callback pings? that way if we could collect these real time social graph updates for, say, page likes, in a voting api module for fb like or real time analytics.
Comment #35
jaypark commenteddave, fb's Vernal indicated during the spring release of the latest social graph api that applications could subscribe to their users graph object updates, so fb would "ping" the application site that the users data changed... how does or can dffb handle these callback pings? that way if we could collect these real time social graph updates for, say, page likes, in a voting api module for fb like or real time analytics.
Comment #36
Dave Cohen commentedThose details are here: http://developers.facebook.com/docs/api/realtime
I haven't dabbled with this yet, but would like to have support for it, of course.
There's a similar mechanism where fb_app.module subscribes to the authorize events. I imagine this implemented in a very similar way. I.e. fb_opengraph.module (or whatever it might be called) receives the callbacks, then calls a drupal hook to notify other modules of any information.
Comment #37
nancydruHere's how I get it to be a part of the node content area.
@Dave: My customer wants it to read "username likes node-title" rather than "username likes node-url". Is there any way to do that? And is there anyway to know, when someone follows it back to us, where they found the link?
Comment #38
Dave Cohen commentedI think the correct open graph tags on your page will fix the title: http://developers.facebook.com/docs/opengraph
There may be something on that page about tracking to click throughs. I recall there is a way to do that but I don't remember exactly where I saw that.
Comment #39
nancydruThanks, Dave. That page says only four params are required, but I think your doc page says 6 are required. I will proceed as though FB's docs are more correct.
Comment #40
nancydruHere's what I'm producing now:
But it still says "You like node-url".
I'm thinking now that there is some confusion about how it will look on my site vs. how it will look on FB. Guess we'll have to go live to see.
Comment #41
Spiroc commentedHello
@NancyDru
I have done this easy by installing http://drupal.org/project/opengraph_meta and use the Example Customizations module from DFF plus u need to add extra tag to page.tpl.php
<meta property="fb:app_id" content="YOUR APP ID" />so the head of page.tpl.php looks like this
But i have one extra question how to make wen i press the like button to get "username like my canvas app url on my canvas app" i know alot of application who have done this but i can't figure how to be done if some one have idea?
Comment #42
nancydruI don't have an app id. This is a simple Like button.
I suspect, we have little control over what shows on our site. The Like button customization only affects what shows on FB itself.
Comment #43
Spiroc commented@NancyDru
You must have facebook app id if u use DFF if no u can use some of this meta tags and again u will get that what u like to see
Comment #44
nancydruI simply do not know the user's FB user id, nor do I want to set up an application just for a simple stinking Like button.
Comment #45
Dave Cohen commentedYou shouldn't need the application. Having it there will give you additional access to the statistics kept by facebook. So you may want to do that in the future. It doesn't require any additional effort on the part of your users. I don't think the lack of application is the problem with the name/url issue (but I don't know what is the problem)
Nancy, can you post the og: tags on your page when it works? I wonder why #40 did not work. Maybe because the og:url is not absolute?
Regarding the canvas urls... when your module generates the url, it can force it to be a canvas url or not, by calling url this way...
or
Comment #46
nancydruWhen I used the OG tags without an fb:admins, it said I had to have it. I removed the OG stuff entirely and it works. I have no idea why the text changed but it did.
Here's my module. If you wish to include it, feel free.
Comment #47
thriftyngreen commentedWhy would you need a module ... all due respect. Just curious. Can't you just add a block with the code?
Comment #48
Dave Cohen commentedYou can just add a block with the markup. That's generally what I would do. But many admins appreciate the ease of a module like this (they never even need to know what a like tag looks like).
They way I see it, the code in modules/fb needs to be very flexible and provide the basics. Other modules such as this can add a layer of user-friendliness for those who want/need it. But I'm not sure where modules like this belong (i.e. inside modules/fb/contrib? Or in there own project on drupal.org?)
Comment #49
thriftyngreen commentedI hear you dave thanks for the comment. In general I had no problem making OG work. Just added the OG Meta tag module and the html tag code and I was in there. Very simple, as it should be.
Comment #50
nancydru@Dave: Yes, I put the module in modules/fb/contrib. If you are interested in this, I have a newer version.
@thiftyngreen: there are settings available in the module for people who like to customize their button without learning how. It's true that one could code a block, but that limits its placement; my module puts it in the node content area. One could even totally avoid the use of the fb module if one cares to learn how to do that.
Comment #51
thriftyngreen commentedI think one might care to do that cause wow is it slowing my pages down. All around fb makes my pages hang with everything I add from it. Google and FB. but I am not sure the module is the problem as I am only using that for log in at the moment the invite friends feature just took forever to load I disabled it.
Comment #52
nancydruI have no performance issues with the base FB module and this Like button. But, I don't actually use any Facebook functions, it does little more than load the toolkit. But a performance issue is off topic here, please open it as a new issue.
Comment #53
Sms2luv commentedSo what is the best resort to know if a user liked a page in favebook