Active
Project:
Facebook social plugins integration
Version:
6.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2010 at 02:29 UTC
Updated:
2 May 2012 at 09:59 UTC
Jump to comment: Most recent file
Comments
Comment #1
ferdi commentedGreat idea. Here is what I think could work: Make the like button a cck field, integrate it with some existing drupal voting modules (i.e. votingapi) and intercept the click using fb javascript api (http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe). Hope I find some time to try this out in the next couple of days.
Comment #2
jdblank commentedHi, I also have a need to be able to display the like button on individual items in a list from a view. Did you have any luck getting this to work?
Comment #3
egarias commentedMy problem is with comments.
When using the comments, they are not accesible throught views, only the old comments (no Facebook) are shown.
My question is how can i access those comments, maybe some php code?.
Will you plan to integrate comments with views if they are not?
Thanks
Enrique
Comment #4
ferdi commentedThe original ticket is about integrating number of fb likes with views. There is one thing that makes it hard to implement. Currently facebook allows users to undo their "like" (unlike) but there is not a javascript event associated with unlike.
@jdblank you can use views already to show node teasers which contain the like widget.
@egarias Facebook comments are not saved locally in the database. Please open a new ticket if you are asking for integration of fb comments with drupal.
Comment #5
liquidcms commentedalthough yes, you can do your View as a list of teasers and therefore show the like button that way; ideally we could make field views (as they are much more powerful than teaser views) and would then have a "field" that was the like button that we could add.
Comment #6
walden commented@liquidcms I totally agree with you, it would be incredibly useful to be able to access the FB like button as a field in views.
Has anyone come up with an interim solution besides using the teaser style?
Comment #7
eyenology commentedsubscribe
Comment #8
ferdi commentedHere is some code that integrate fb like button with views i.e. fb like will be one of the available fields in your view. http://drupal.org/cvs?commit=410224 .It would be great if someone can test it.
Thanks.
Comment #9
liquidcms commentedi'll test. any chance you can post a zip or something a little more accessible that whatever the link above goes to? :)
Comment #10
liquidcms commentedhmm.. ok, i think you are just saying it is the latest dev release as it looks like that has the views.inc file
i'll test first thing in the morning. thanks a ton.
Comment #11
liquidcms commenteduh nope, doesn't work.. as far as i can tell anyway.
to start with this breaks the attachment i had that was adding the teaser view to my fields view (but if this worked; no big deal)
i see when i am adding a field and trying to filter the list that there is a fb social button listed at the end (this is the actual field though and should be the group "FB Social" or something like that). selecting this does not do any filtering.
but without filtering i can still see the fb social button listed at the bottom... when i add the field i don't get any thing added to my fields list BUT i do see the label "fb social like button: " added to my output.
Comment #12
ferdi commentedIt should provide the functionality described in #5 and #6 . Here is a simple view that i'm using for testing. Import & save the view and then visit yoursite.com/fbviewtest
thanks for testing !
Comment #13
ferdi commentedComment #14
minus commentedThank you very much for the effort you have been putting into this module ferdi!!
I tested your view, it gives me a list of nodes and a like button for each field. I tried to sort this view by the number of times the like button had been clicked, but there are no options for that in my sort options list.
A nice feature would be a statistics option, so that you can create a block with most liked, most shared and most commented (if this is possible it would be really nice.)
Node title (89) where 89 is the number of users who has clicked the liked button (I guess you knew what I ment :p)
Morten
Comment #15
liquidcms commentedyay.. it does seem to work!! it doesn't show in the Views preview but once i saved; it does show on the site.
thank-you.. this sure helps a lot.. :)
Comment #16
liquidcms commentedalthough, for some odd reason the colour selector when adding the button as a views field doesn't do anything. i mean i can select it and see the options.. but picking one doesn't change it from the default of Dark.
Comment #17
lee20 commentedThe like button doesn't "like" the right URL. Here is the diff that fixes this:
Comment #18
chia commentedsubscribe
Comment #19
alexmartin commentedThanks for your work on this Ferdi. I've got this working using the view supplied above. However, I'd also like to display the 'share' button, share count and comment count in the view (comment count being the most important to me). Is there any way you know to achieve this?
Thanks again,
Alex
Comment #20
Roavei commentedWorks like a charm. But there is missing a "exclude from display" checkbox :|
Comment #21
amir simantov commentedHi guys,
It seems that you are dealing here mostly with Like button, right? What I need is to show the fb comments in a view when using the node row style. Is there any solution for this?
Great module, thanks!
Comment #22
rumblewand commentedHey everybody I did some digging and found #870262: Using FS with Views for a diff mod that enabled me to pass the php code into a views field so that the fb:like like button is posted AND the appropriate node address is passed to it.
I'm using Drupal for Facebook and I was making a frontpage view of events and general we posts. Works like a charm!>
Comment #23
rumblewand commentedOh and @Amir you can probably adjust the code in that example to use the xfbml for comments. You might want to open an issue over at the drupal for facebook module.
Comment #24
Oscar Illada commentedI was looking for the functionality too, to put in a view the top liked nodes. Is there a possibility?
Comment #25
Oscar Illada commentedFind my solution thanks http://drupal.org/project/views_fb_like
Comment #26
vin247 commentedI think the code by lee20 should get more notice (if it hasn't already)...I was having trouble with the like button when used in a view (it wasn't outputting the link correctly) and adding the line: 'href' => fb_social_url('node/' . $values->nid), it now works perfectly!
Comment #27
ferdi commented#17 is committed http://drupal.org/cvs?commit=473098. Thanks!
Comment #28
YK85 commentedsubscribing - is there any further development happening here or is this status 'fixed'?
Comment #29
ferdi commentedwe dont have anything better than #25 for now.
Comment #30
Júlio Boaro commentedSubscribe
Comment #31
dafederHere's one solution for 7.x. Add an "nid" field to your view, as well as a Content Type field that is hidden. Copy views-view-field.tpl.php template to your theme directory, and add the following to template.php, correcting for theme, fb_social preset, and view names:
I'm sure something similar could be done for 6.x.
Would of course be nice to have a field available right in views. Wouldn't be too hard but don't have the hours to devote to it at the moment, as this is working well for me for now.
Comment #32
acouch commentedI created a views handler for this which adds a global field that allows you to add an already created preset.
Unfortunately if it is being displayed on a page where it is referring to another page (on a list of teasers for example) it requires the nid for the node in the row. The nid is only available if some field from the node column is added. So this will work on a teaser as long as there is a node title, body, teaser, field etc.
That limitation seems like a blocker however for a module that may have a lot of new users using it. I'm attaching anyway in case someone wants to use this or it doesn't seem as bad a limitation as I fear.
Comment #33
kiranjyoth commentedI tried to do this, but i am getting some errors. May be you could help me. Here are the steps i followed.
1. Copied views-view-field.tpl.php from views module's theme folder to my theme directory
2. Edited and added the code that you provided to the template.php file. I changed the theme name, view name and preset name ( in this case, my preset name is 'like')
3. Added nid field to the fields
4. added a content type field and excluded it from display.
I get the following error message
Notice: Undefined property: stdClass::$node_type in corporateclean_preprocess_views_view_field() (line 75 of /home/devnode/public_html/sites/all/themes/corporateclean/template.php).
Notice: Undefined index: fb_social_like in corporateclean_preprocess_views_view_field() (line 80 of /home/devnode/public_html/sites/all/themes/corporateclean/template.php).
Notice: Undefined property: stdClass::$node_type in corporateclean_preprocess_views_view_field() (line 75 of /home/devnode/public_html/sites/all/themes/corporateclean/template.php).
Notice: Undefined index: fb_social_like in corporateclean_preprocess_views_view_field() (line 80 of /home/devnode/public_html/sites/all/themes/corporateclean/template.php).
Can you help me with what I am doing wrong here?
Comment #34
acouch commentedI have this fixed but haven't updated this yet. Will do so shortly.
Comment #35
kiranjyoth commentedPlease do! Thanks for the quick response!
Comment #36
acouch commentedAttached is a patch that provides views support for users and node tables. I fixed the alias issue I was having and re-rolled versus the recent commits.
The url changes for each node or user for like, facepile, comments, and send plugins (the only plugins that wil accept the href option). If one of those is not chosen it just displays the plugin as normal.
This could be extended to other entities like taxonomy etc if requested.
Comment #37
acouch commentedPlease give it a test.
Comment #38
wiherek commentedtried it, it works with comments (yeah! :)). The patch does it all, theres no need for the solution from #31 (which I couldn't reproduce)
Issues found:
1. MAJOR - there is no views field for the comments preset, or any other fb social preset, which made me have to render the views by 'content' which is annoying if only used on a blog, and a 'blockerer' when used with more specific views
2. when the content was rendered without showing links or comments, and the window width was somewhat narrow (??), this error showed up:
Notice: Undefined variable: nr_comments in _fb_social_comments_comments_count() (line 235 of /(...)/sites/all/modules/fb_social/plugins/fb_plugin/comments.inc).
except for that it works fine. By the way, I added a href field for the like button some time ago (very simple). will add that to git sometime soon.
Comment #39
acouch commentedhi @wiherek5
Thanks for your comments. For:
| 1. MAJOR - there is no views field for the comments preset, or any other fb social preset,
The steps for this to work with comment #36 are to:
1) Create the fb_social preset which you wish to use in a view.
2) Create a view with 'content' or 'user' as the base table.
3) Add the "Facebool Social" preset field which will be in the "Node" or "User" group in the view.
For:
| 2.
That is an issue unrelated to views support. I've created a separate issue #1371416: Undefined comment property in _fb_social_comments_comments_count()
Comment #40
kiranjyoth commented#36 @acouch, This patch worked for me. Thanks!
Comment #41
wiherek commented@acouch: I still can't see the field.
What I did was: just installed the module, without following #31.
I create the view, showing content of type 'article', created as a page. I save and get to the view edit screen. The default way that view is rendered is 'content', which doesn't allow adding new fields (it uses the fields from the content type). That way, the fb_social is shown, I can add comments.
However, if I change the way the view is rendered to 'fields', and try to add a new field, there is no "Facebook Social" preset field neither in the 'node' group, nor 'user' (when creating a view showing users).
This is views3.
Comment #42
ferdi commentedIs plugins/views/fb_social_handler_field.inc missing in #36?
Instead of changing the signature for fb_social_preset_view(), can we use theme_fb_social_plugin ?
Comment #43
acouch commented@ferdi, you are correct, patch in #36 was missing that file. I rerolled.
For using theme_fb_social_plugin() vs. fb_social_preset_view() I would argue that since we adding data to the output that that should happen before the theme function if possible.
@wiherek5 can you re-try? Thanks!
Comment #44
wiherek commentedit works now. thanks!
Comment #45
ferdi commented@acouch
How about something like this? Adding an url argument to fb_social_preset_view() feels a bit strange so I'm trying to avoid that.
Comment #46
acouch commentedThat looks good. I noticed that you missed the fb_social.views.inc in your patch so I re-rolled.
Comment #47
ferdi commentedCommitted http://drupalcode.org/project/fb_social.git/commit/71e500f
thanks everyone !!!
Comment #48
ferdi commentedUse fb_social_url to construct the 'href' attribute http://drupalcode.org/project/fb_social.git/commit/8ecdb9c
And backported for 6--2 branch http://drupalcode.org/project/fb_social.git/commit/5e680af
Comment #50
heyyo commentedIs there a filter to content which has been liked or commented ?
Comment #51
heyyo commentedComment #52
raidcha commentedHi
Like heyyo, i'm interested in a view sort criteria or filter to get the most commented or liked node