vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - Add New Facebook "Like" Button to Threads and OpenGraph to Headinclude Automatically (https://vborg.vbsupport.ru/showthread.php?t=242536)

kall 05-14-2010 10:00 PM

Add New Facebook "Like" Button to Threads and OpenGraph to Headinclude Automatically
 
1 Attachment(s)
From The Open Graph Protocol :
Quote:

The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to enable any web page to have the same functionality as a Facebook Page.
Quote:

Basic metadata
To turn your web pages into graph objects, you need to add basic metadata to your page. We've based the initial version of the protocol on RDFa which means that you'll place additional <meta> tags in the <head> of your web page. The four required properties for every page are:

og:title - The title of your object as it should appear within the graph, e.g., "The Rock".
og:type - The type of your object, e.g., "movie". Depending on the type you specify, other properties may also be required.
og:image - An image URL which should represent your object within the graph.
og:url - The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/".
This modification will add these tags to all pages, and the <og:title> attribute to your SHOWTHREAD pages (for the moment.. additional Pages to be added soon), along with the Facebook 'Like Button' under the Thread Title (as we are supposed to put the Like button next to the thing the person is Liking).

Install Instructions:
AdminCP - Plugins & Products - Manage Products - [Add/Import Product] , browse to the location of the .xml file you downloaded from this thread, Import it.
Template Modifications
In SHOWTHREAD, find:
PHP Code:

<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]

Replace with:
PHP Code:

<html xmlns="http://www.w3.org/1999/xhtml" <if condition="$vboptions['ogfb_onoff']">xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" </if>dir="$stylevar[textdirection]

Find:
PHP Code:

$headinclude 

Add under:
PHP Code:

$ogfb_metadata 

Wherever you want to add the Like Button, add
PHP Code:

$ogfb_like_showthread 

Configuration Instructions
AdminCP - Settings - Options - Opengraph/Facebook Integration
Global On/Off - Set to Yes to turn the system on.
FB - Page Admins - A comma-separated list of the Facebook IDs of the Admins of your pages on Facebook.
FB - App ID - The application ID of your Facebook Application.
OG - Site Name - A short, human-readable name for your site that will appear in the Like on the User's Facebook Activity Stream.

It is important to fill in these, as they are used by FB to fill in some of the information, and allows your pages (Showthread at the moment) to be referenced in the Open Graph.

What's Next?
This is an early beta release to gauge the interest in Open Graph/Facebook type stuff.
I intend to add the tags to other pages, and implement some of the other Facebook Social Plugins. These will all be On/Off configurable. Some can be seen in action at:

View Profile: kall - New Zealand Boards - Like for Member Profiles
http://www.nzboards.com/the-lounge/r...on-sale-90544/ - Activity and Recommendation Streams in first and last post.

(4.0.3 Version here: https://vborg.vbsupport.ru/showthread.php?t=242525)

kall 05-15-2010 06:43 AM

Ahh.

Issues. I need to re-upload the .xml, please hang 5.

*edit* Done.

Taurus1 05-15-2010 08:39 AM

Thanks mate....gonna give it a whirl!!

Brandon Sheley 05-15-2010 10:32 PM

Thank you man!
I'll ditch what I currently have and set this one up

/me clicks install

I do not see

Configuration Instructions
AdminCP - Settings - Options - Opengraph/Facebook Integration

kall 05-16-2010 12:29 AM

Dammit. That's what I was supposed to get in the edit of the xml. Do you see them in the xml?

kall 05-16-2010 12:32 AM

Bah. Must have uploaded the wrong one. Try now. :)

Brandon Sheley 05-16-2010 12:34 AM

Quote:

Originally Posted by kall (Post 2037655)
Bah. Must have uploaded the wrong one. Try now. :)

yup, I see the options now :)
Just putting the little one to bed, will finish the install in 20 mins, thanks again for releasing a 3.8 version :up:

one question.. I'm trying to place this in the postbit, can I enter this into the postbit template?

Code:

$ogfb_like_showthread

zfrank1 05-16-2010 07:30 AM

the templates are not cached. can you change your code?

kall 05-16-2010 09:04 AM

Quote:

Originally Posted by zfrank1 (Post 2037774)
the templates are not cached. can you change your code?

Well, I was going to upgrade it so it worked on all pages, but ok.

kall 05-16-2010 09:10 AM

Quote:

Originally Posted by Loco.M (Post 2037656)
one question.. I'm trying to place this in the postbit, can I enter this into the postbit template?

Code:

$ogfb_like_showthread

You should be able to, but that's not Best Practice.. you want people to Like the Thread, not the post.


All times are GMT. The time now is 06:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01235 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete