Setting Up Facebook Connect for WordPress

by adam on February 23, 2009

These steps are needed to prepare your wordpress blog for facebook connect integration using the WP-FBConnect Plugin. The plugin is documented here and you can download it here. The implementation is pretty simple, but there are some caveats as follows.

Step 1:

Add the language attributes wp function to your header(s). The plugin will add the following lanuage attribute for you “xmlns:fb=”http://www.facebook.com/2008/fbml”.

 

<html xmlns="http://www.w3.org/1999/xhtml" 
<?php language_attributes(); ?>> 

Step 2:

Call wp_head in your header(s)


<?php wp_head(); ?>

Step 3:

Call wp_footer in your footer.php


<?php wp_footer(); ?>

Step 4:

Call the login function from your comments.php. Use the ‘do_action’ hook so that if you disable the plugin, it is not called.


<?php do_action('fbc_display_login_button')  ?>

Step 5 (optional):

Call the following code in your comments.php if it doesn’t already exist. It will display the facebook commenter’s profile pic or an empty gravatar/avatar if left by a regular user, ’32′ is the size of the avatar you would like to display.


<?php echo get_avatar( $comment, 32 ); ?>

Step 6 (optional):

Call this function if you are using WP-Supercache or another caching plugin. You need to make sure that the “YOURAPIKEY_user” cookie isn’t cached. Replace YOURAPIKEY with your unique developer api key.


<?php
function fbc_supercache($cachestr){

if(isset($_COOKIE["YOURAPIKEY_user"]) )
$cachestr .= $_COOKIE["YOURAPIKEY_user"];

return $cachestr;
}

add_cacheaction('wp_cache_get_cookies_values', 'fbc_supercache');
?>

Step 7 (optional):

Some versions of wordpress will need a bit of a hack to fbconnect.js. Change the following on line 93.

if (comment_text.trim().length === 0) { 

to:

if (comment_text.length === 0) { 

Note:I am not the developer of this plugin. Full credit goes to Adam Hupp for creating it.

349 comments

trial.still tryn

by paul on January 18, 2011 at 3:24 am. #

A person constantly produce essentially the most helpful articles. Also , you always often consider bad/boring items as well as turn these individuals in to exciting/interesting points. I’m any viewer for all his life!

by Violet Furnia on January 18, 2011 at 11:09 am. #

Great blog man, I’ll definitely come by again :)

by Twana Wernex on January 27, 2011 at 8:31 pm. #

[...] plugin  ini pengunjung bisa meninggalkan komentarnya pada situs Anda dengan Login Facebook. Baca tutorialnya untuk mengetahui lebih jauh tentang plugin ini.Sociable Facebook Connect — Sociable.es juga [...]

by How To: Mengintegrasikan Facebook Dengan Blog Anda | Realodix on February 17, 2011 at 6:30 pm. #

You.. don’t need an API key for this?

Electrolux Washer Island

by Alec Johnson on May 3, 2011 at 2:52 pm. #

Thanks that is helpful!


D

by RoyalD on May 19, 2011 at 4:20 am. #

but your links dot work anymore :(

by RoyalD on May 19, 2011 at 4:22 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Clockstone wordpress on June 12, 2011 at 7:30 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress Automatically | Wordpress Training on August 9, 2011 at 10:49 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Sandbox on August 25, 2011 at 5:46 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Conti Primary Care on August 30, 2011 at 8:49 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Mojo Bones on September 8, 2011 at 4:48 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « 1izen.org on September 12, 2011 at 9:43 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « booyakkamarketing.com on September 26, 2011 at 4:06 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPressAnother giggi blog on October 5, 2011 at 4:27 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « DEMO2 on October 9, 2011 at 4:32 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | stepintogroup.com on October 19, 2011 at 12:37 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Home Improvement Blogs on October 21, 2011 at 11:11 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Osun Arts Foundation on November 2, 2011 at 4:02 am. #

[...] avatar show up (with a Facebook designation) on your site. Check out Adam Breckler’s excellent tutorial for more help with this [...]

by How to integrate Facebook With Your blog on November 4, 2011 at 12:56 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Restaurant Marketing Solutions on November 23, 2011 at 3:47 pm. #

Thanks for the plugin! I´ve finally found it.
Thats what i was looking for.

Kind regards!!

by Eric Uned on November 24, 2011 at 3:47 pm. #

Hermes Purses is recognized for its pure luxury and beautiful craftsmanship. It is frequently claimed that if you want to impress your woman enjoy make her feel specific with deluxe Hermes Handbags. hermes handbags outlet Women and elegance are two sides of the same coin. It is tough to discover a girl who does not want to be lovely and stylish. Make a trend assertion with branded equipment like purses, clutches and jewelry. hermes sample sale hermes scarves sale
Yahoo.com

by Hanway1Josey on November 26, 2011 at 12:07 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Net Glow on December 3, 2011 at 4:27 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by Some post 3 « Chammyz on December 4, 2011 at 8:18 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « austin siding and remodeling on December 5, 2011 at 4:37 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « MotionGrafix on December 9, 2011 at 5:33 am. #

Cool this tutorial!

by arhimania on December 9, 2011 at 2:49 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by Whiskey is nice « Highland Paddy on December 10, 2011 at 7:50 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by Photography dan Video Shooting on December 19, 2011 at 8:41 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Rabitat Litanmiya on December 25, 2011 at 9:13 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress : YellowireCreative on December 26, 2011 at 11:51 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Webquick on December 31, 2011 at 4:31 pm. #

[...] avatar show up (with a Facebook designation) on your site. Check out Adam Breckler’s excellent tutorial for more help with this [...]

by how to integrate your site with facebook « provider on January 7, 2012 at 8:41 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « irma-hutabarat.com on January 30, 2012 at 4:22 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Mr Fox Photography on February 13, 2012 at 7:09 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | GarciaMolina.es on February 23, 2012 at 4:16 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Blog on April 29, 2012 at 11:43 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Shortcut Software on May 2, 2012 at 9:26 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Golden Butterfly Hypnosis on May 3, 2012 at 3:07 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Case La Maddalena on June 17, 2012 at 4:14 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by Via Brigata Sassari « Case La Maddalena on June 17, 2012 at 4:56 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Los Viajes de Primo on June 20, 2012 at 9:16 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Mark Granger Music School on July 13, 2012 at 12:28 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress | Aerily on July 29, 2012 at 8:30 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « « Down To Earth Landscaping, Inc. Down To Earth Landscaping, Inc. on August 20, 2012 at 1:48 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « alkawthar on October 5, 2012 at 4:58 am. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « SAKSOFT on October 12, 2012 at 9:07 pm. #

[...] pictures. However, it has not been updated since the beginning of the year. Still, there is a nice tutorial by the developer Adam [...]

by How To Integrate Facebook With WordPress « Oggano on November 1, 2012 at 6:50 am. #

Leave your comment

Required.

Required. Not published.

If you have one.