Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

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
  #122  
Old 05-05-2010, 08:14 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gyaronn View Post
ok and another question i am traying to make a Like Box from facebook as a widget at my web site (www.fmsas.org) by using this code :

but for some reason it does not work can any one help me?
I just took a look and can't see why that's happening either, I even tested your code here http://developers.facebook.com/docs/...ugins/like-box I wonder if there is a problem with that right now on their end.
Reply With Quote
  #123  
Old 05-05-2010, 08:27 PM
gyaronn's Avatar
gyaronn gyaronn is offline
 
Join Date: Dec 2009
Location: Poland
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

should it be an static HTML or something deferent ?
Reply With Quote
  #124  
Old 05-05-2010, 08:32 PM
gyaronn's Avatar
gyaronn gyaronn is offline
 
Join Date: Dec 2009
Location: Poland
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok got it working the idiots on FB wrote the wrong code dont know how i did not see it before :-(
they wrote: profile_id=XXXX but its not a profile so if you delete the "profile" and stay with id=XXXX than it works perfect :-)

this is the corect code to use (you need to change the XXXXXXXX to the page id):

Code:
<iframe src="http://www.facebook.com/plugins/likebox.php?id=XXXXXXXXXXXX&amp;width=223&amp;height=295&amp;connections=6&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:223px; height:295px;" allowTransparency="true"></iframe>
you can see an example at my site :-)
Reply With Quote
  #125  
Old 05-06-2010, 02:04 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome!
I hate facebook but soo many use it. Its free SEO!! Thanks<33

edit does not work on Albums

even with the changed code

PHP Code:
<!-- Facebook Like -->
<
iframe src="http://www.facebook.com/plugins/like.php?href={vb:raw page_url}&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 --> 
As soon as i click it it shows my image than bang a second later its gone
Reply With Quote
  #126  
Old 05-07-2010, 04:50 PM
salvador21 salvador21 is offline
 
Join Date: Mar 2009
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr View Post
I've updated the first post to give the locations frequently asked here, these include photo albums, blogs and vbcms.
Thanks but it still isn't working in CMS or blog.

It's fine and dandy in the forum
Reply With Quote
  #127  
Old 05-07-2010, 05:07 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by salvador21 View Post
Thanks but it still isn't working in CMS or blog.

It's fine and dandy in the forum
The code linked above works fine on CMS
Reply With Quote
  #128  
Old 05-07-2010, 05:26 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When we see the on and off (sporadic) behavior it could have to do with FB being overloaded and not loading. That's one of the benefits of iframe, it lets the rest of the page load around it.
Reply With Quote
  #129  
Old 05-07-2010, 05:34 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr View Post
When we see the on and off (sporadic) behavior it could have to do with FB being overloaded and not loading. That's one of the benefits of iframe, it lets the rest of the page load around it.
I see but it works fine everytime on say forums
not albums /blog
Reply With Quote
  #130  
Old 05-07-2010, 05:58 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Animemike View Post
I see but it works fine everytime on say forums
not albums /blog
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.
Reply With Quote
  #131  
Old 05-07-2010, 06:06 PM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 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.
Album code

PHP Code:
{vb:stylevar htmldoctype}
<
html xmlns="http://www.w3.org/1999/xhtml"<vb:if condition="$vboptions['enablefacebookconnect']"xmlns:fb="http://www.facebook.com/2008/fbml"</vb:if> dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}">
<
head>
    {
vb:raw headinclude}
    <
script type="text/javascript" src="clientscript/vbulletin_quick_edit_generic.js?v={vb:raw vboptions.simpleversion}"></script>
    <
script type="text/javascript" src="clientscript/vbulletin_quick_edit_picturecomment.js?v={vb:raw vboptions.simpleversion}"></script>

    <
vb:if condition="$vboptions['storecssasfile']">
        <
link rel="stylesheet" type="text/css" href="{vb:raw vbcsspath}album-rollup.css" />
    <
vb:else />
        <
link rel="stylesheet" type="text/css" href="{vb:raw vbcsspath}album.css,postbit-lite.css" />
    </
vb:if>

    {
vb:raw usercss}
    <
title>{vb:rawphrase picture_x_of_y_from_album_z, {vb:raw pic_location.pic_position},{vb:raw albuminfo.picturecount}, {vb:raw albuminfo.title}}</title>
    {
vb:raw headinclude_bottom}
</
head>
<
body>
{
vb:raw header}
{
vb:raw navbar}
<
div id="albumtop" class="floatcontainer"
    <
vb:if condition="$show['picture_nav']">
        <
ul class="picturenav">
        <
li><a href="album.php?{vb:raw session.sessionurl}albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pic_location.prev_attachmentid}" class="textcontrol arrowprev">&larr; {vb:raw pic_location.prev_text_short}</a></li>
            <
li><a href="album.php?{vb:raw session.sessionurl}albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pic_location.next_attachmentid}" class="textcontrol arrownext">{vb:raw pic_location.next_text_short} &rarr;</a></li>
            <
vb:if condition="$show['usercss_switch']"><li><a href="profile.php?{vb:raw session.sessionurl}do=switchusercss&amp;hash={vb:raw bbuserinfo.logouthash}&amp;u={vb:raw userinfo.userid}">{vb:raw usercss_switch_phrase}</a></li></vb:if>
        </
ul>
    </
vb:if>
        <
vb:if condition="$show['edit_picture_option'] OR $show['reportlink'] OR $show['add_group_link']">
            <
ul id="picturecontrols"
                <
vb:if condition="$show['add_group_link']"><li><a href="album.php?{vb:raw session.sessionurl}do=addgroup&amp;albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pictureinfo.attachmentid}" class="add">{vb:rawphrase add_to_group}</a></li></vb:if>
                <
vb:if condition="$show['edit_picture_option']"><li><a href="album.php?{vb:raw session.sessionurl}do=editpictures&amp;albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pictureinfo.attachmentid}&amp;frompicture=1" class="editinfo">{vb:rawphrase edit_picture}</a></li></vb:if>
                <
vb:if condition="$show['reportlink']"><li><a href="album.php?{vb:raw session.sessionurl}do=report&amp;albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pictureinfo.attachmentid}" class="report">{vb:rawphrase report_picture}</a></li></vb:if>
            </
ul>
        </
vb:if>
    <
h1>{vb:rawphrase picture_x_of_y_from_album_z, {vb:raw pic_location.pic_position},{vb:raw albuminfo.picturecount}, {vb:raw albuminfo.title}}</h1>
</
div>
<
div id="picturecontainer">
<!-- 
Facebook Like -->
<
iframe src="http://www.facebook.com/plugins/like.php?href={vb:raw page_url}&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 condition="$show['picture_nav']">
            <
div id="picturelink"><a href="album.php?{vb:raw session.sessionurl}albumid={vb:raw albuminfo.albumid}&amp;attachmentid={vb:raw pic_location.next_attachmentid}" title="{vb:rawphrase show_next_picture}"><img src="attachment.php?attachmentid={vb:raw pictureinfo.attachmentid}&amp;d={vb:raw pictureinfo.dateline}" alt="{vb:raw pictureinfo.caption_censored}" /></a></div>
        <
vb:else />
            <
div id="picturelink"><img src="attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw pictureinfo.attachmentid}&amp;d={vb:raw pictureinfo.dateline}" alt="{vb:raw pictureinfo.caption_censored}" /></div>
        </
vb:if>

    <
vb:if condition="$show['moderation']"><p><strong>{vb:rawphrase picture_waiting_moderator_approval}</strong></p></vb:if>
    <
vb:if condition="$show['picture_owner']">
            <
ul id="pictureurls">
                <
li><label for="picture_url">{vb:rawphrase picture_url} <input type="text" class="textbox" id="picture_url" value="{vb:raw pictureinfo.pictureurl}" readonly="readonly" onfocus="this.select()" dir="ltr" tabindex="1" /></label></li>
                <
li><label for="bb_code_snippet">{vb:rawphrase bb_code} <input type="text" class="textbox" id="bb_code_snippet" value="[img]https://vborg.vbsupport.ru/[/img]" readonly="readonly" onfocus="this.select()" dir="ltr" tabindex="1" /></label></li>
            </
ul>
        </
vb:if>
        <
vb:if condition="$pictureinfo['caption_html']"><p id="picturecaption">{vb:raw pictureinfo.caption_html}</p></vb:if>
    <
dl class="stats" id="picturestats">
            <
dt>{vb:rawphrase picture_added}</dt>
        <
dd>{vb:raw pictureinfo.adddate} <vb:if condition="!$show['detailedtime']"><span class="time">{vb:raw pictureinfo.addtime}</span></vb:if></dd>
        <
dt>{vb:rawphrase album}</dt>
            <
dd><a href="album.php?{vb:raw session.sessionurl}albumid={vb:raw albuminfo.albumid}">{vb:raw albuminfo.title}</a></dd>
        <
dt>{vb:rawphrase added_by}</dt>
        <
dd><a href="{vb:link member, {vb:raw userinfo}}" class="username">{vb:raw userinfo.username}</a></dd>
        </
dl>

</
div>


{
vb:raw picturecomment_commentarea}


{
vb:raw footer}
</
body>
</
html
I added it here because is shows alot better

Attachment 116806

And it is now working on my blogs
Reply With Quote
Reply


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 01:07 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.09009 seconds
  • Memory Usage 2,435KB
  • 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
  • (5)bbcode_code
  • (1)bbcode_html
  • (2)bbcode_php
  • (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