Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
Add New Facebook "Like" button to your threads Details »»
Add New Facebook "Like" button to your threads
Version: 1.2, by ericgtr ericgtr is offline
Developer Last Online: Feb 2022 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 4.0.2 Rating:
Released: 04-21-2010 Last Update: 04-21-2010 Installs: 326
Re-useable Code  
No support by the author.

Please remember to click Mark as Installed if you use this modification.

Facebook has just launched their latest "Like" button to developers to use on any site. What this does is utilizes the Advertising module to add the "Like" button to the first post of each thread. Please see screenshots to get an idea.

In your Admin CP go to Advertising > New Ad > Choose "Thread" from the dropdown and then select the first thread box. Give it a title (I called mine FB Like) leave "First Post Content" at default and paste in this code:
HTML Code:
<!-- Facebook Like -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOURSITE.com/{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_post}}#post{vb:raw post.postid}&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:px"></iframe>
<!-- / Facebook Like -->
Be sure to change YOURSITE.com to your URL including your forum.

The VBSEO team has instructions on how to make this work for their product here http://www.vbseo.com/f2/facebook-lik...95/#post265997

===========================================
Option 2 (different from above, do not use together) will show at top, see screenshot #3

In Postbit (or legacy) find:
Code:
{vb:raw ad_location.thread_first_post_content}
Add this after:
Code:
<vb:if condition="(THIS_SCRIPT == showthread) AND ($post[postcount] == '1')"
<!-- Facebook Like -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOURSITE.com/{vb:link thread, {vb:raw thread}}&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:75px"></iframe>
<!-- / Facebook Like -->
</vb:if>
For additional information on this button and different parameters please visit http://developers.facebook.com/docs/...e/plugins/like

=================================================

For those who have asked, here is the modification adds both the "Like" button and comments to a users profile https://vborg.vbsupport.ru/showthread.php?t=239424

=================================================
Additional locations to place this code:

For CMS, in vbcms_content_article_page add the code below this:
Code:
{vb:raw comment_block}
For pictures, in template album_pictureview add the code below this:
Code:
{vb:raw picturecomment_commentarea}
For Blog, in template blog_show_entry add at the very top.

Download Now

File Type: txt fb_like.txt (946 Bytes, 1066 views)

Screenshots

File Type: jpg fb_like.JPG (89.7 KB, 0 views)
File Type: jpg fb_like2.JPG (11.7 KB, 0 views)
File Type: jpg fb_like3.JPG (41.0 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #132  
Old 05-08-2010, 09:24 PM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Firstly this is a great mod - my members love it already and I'm expecting to pick a lot of traffic up from it so thank you

Secondly I can't get it working on albums. Using the {vb:raw page_URL} in the href attribute results in the following error from Facebook

Quote:
You must specify an URL as part of this widget or API.
What should I be using as the href for albums?
Reply With Quote
  #133  
Old 05-09-2010, 08:25 AM
salvador21 salvador21 is offline
 
Join Date: Mar 2009
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr View Post
Okay, just a couple of basics just to double check things. First we want to make sure you are sure the template is for the style you are using (even I overlook this sometimes) what I like to do is just type in "test" or something that will stick out where you would normally put that code and see if it displays.
OK I tried it with "test" and it showed up fine. Then I tried the code and nothing.

Then I tried the code with the vb:if and it works.

Code:
<!-- Facebook Like -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http://MYSITEURLHERE.com/{vb:link thread, {vb:raw thread}}&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:75px"></iframe>
<!-- / Facebook Like -->
Maybe I missed it before in the CMS because it is positioned at the bottom of the article. I now have the code at the top of the article, after

Code:
<div class="article cms_clear restore postcontainer">
Reply With Quote
  #134  
Old 05-09-2010, 08:33 AM
salvador21 salvador21 is offline
 
Join Date: Mar 2009
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can now get it to show in a blog by using the code without the "vb:if etc", but when you click on it the link in Facebook is going to a thread in the forum instead.
Reply With Quote
  #135  
Old 05-09-2010, 06:14 PM
BiZiMDiYaR BiZiMDiYaR is offline
 
Join Date: Aug 2006
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I tried option 2, but it doesn;t show up... I have VB .3 and also edited the postbit with the code and added it, but still doesn't show up.. What am I doing wrong ?

Thanks.
Reply With Quote
  #136  
Old 05-09-2010, 06:24 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BiZiMDiYaR View Post
Hi,

I tried option 2, but it doesn;t show up... I have VB .3 and also edited the postbit with the code and added it, but still doesn't show up.. What am I doing wrong ?


Thanks.
In Postbit (or legacy)
Which ever you are using you edit
Reply With Quote
  #137  
Old 05-09-2010, 08:48 PM
BiZiMDiYaR BiZiMDiYaR is offline
 
Join Date: Aug 2006
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Animemike View Post
In Postbit (or legacy)
Which ever you are using you edit
Hi,

I edited the postbit... I only need to edit 1, right ?

Thanks.
Reply With Quote
  #138  
Old 05-09-2010, 09:54 PM
wIrEs wIrEs is offline
 
Join Date: Dec 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

many unknown location in online.php, IP addresses are from facebook.
using vb4.0.3
Reply With Quote
  #139  
Old 05-09-2010, 10:14 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BiZiMDiYaR View Post
Hi,

I edited the postbit... I only need to edit 1, right ?

Thanks.
you will need to edit which ever one you are using on your forums mate

my forums uses legacy

postbit legacy


postbit
Reply With Quote
  #140  
Old 05-09-2010, 11:44 PM
BiZiMDiYaR BiZiMDiYaR is offline
 
Join Date: Aug 2006
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Animemike View Post
you will need to edit which ever one you are using on your forums mate

my forums uses legacy

postbit legacy


postbit


Owwwww... so that was the case )))

Thanks very much animemike )) That did it..
Reply With Quote
  #141  
Old 05-11-2010, 06:54 AM
murekhalir murekhalir is offline
 
Join Date: Oct 2006
Posts: 254
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

option one... squishes my text content into a small box. Anyway to make the like button right aligned? and keep the true width of content text.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:52 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.12681 seconds
  • Memory Usage 2,347KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)bbcode_html
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (4)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete