fb

The steps below will add a Facebook like button to each topic on your forum.

1. Open root/includes/functions.php

2. Find :

// Send a proper content-language to the output
     $user_lang = $user->lang['USER_LANG'];
     if (strpos($user_lang, '-x-') !== false)
     {
         $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
     }

3. Add below it :

//Facebook like 
 $pieces=explode("?",$user->page['page']);
 if($pieces[0]=="viewtopic.php")
 {
 $curr_url=generate_board_url() .'/'. $pieces[0]."?";
 $pieces=explode("&",$pieces[1]);
 $flag_tmp=0;
 foreach($pieces as $temp_x)
 {
 if(substr($temp_x,0,2)=="f=" && $flag_tmp==0)
 {
 $curr_url=$curr_url.$temp_x;
 $flag_tmp=1;
 break;
 }
 }
 foreach($pieces as $temp_x)
 {
 if(substr($temp_x,0,2)=="t=" && $flag_tmp==1)
 {
 $curr_url=$curr_url."&".$temp_x;
 break;
 }
 }
 }

4. Also look for :

'SITE_LOGO_IMG'            => $user->img('site_logo'),

5. Add below it :

'CURRENT_URL'      => $curr_url,

6. Save file.

7. Open root/styles/your_template/template/viewtopic_body.html

8. Look for :

<div class="buttons">
     <!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->

9. Add before it :

<div align="right">
 <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="{CURRENT_URL}" show_faces="true" width="450"></fb:like></div>

Or you can add it in places where you want the “like” button to appear.

10. Save file.

11. Go to Admin Control Panel  > General > Purge the Cache.

 

Advertisements

One thought on “How to Add Facebook Like Button in PhpBB

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s