This mod adds a facebook like button to each topic.
Tested with phpBB 3 (But there is no version dependent code, so it will work on all versions, if someone tests in other versions, please post the errors/success messages here)
Screenshot:
Steps:
1. OPEN FORUM_ROOT/includes/functions.php
2. FIND THE BLOCK:
--------------------
// 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:
--------------------
//Facebook like hack by Sriram.A.S. (sriramdasty7@gmail.com)
$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. In the same file, FIND
--------------------
'SITE_LOGO_IMG' => $user->img('site_logo'),
--------------------
5. ADD BELOW
--------------------
'CURRENT_URL' => $curr_url,
--------------------
6. SAVE file with changes
7. OPEN FORUM_ROOT/styles/{YOUR_TEMPLATE}/template/viewtopic_body.html
8. FIND FIRST OCCURANCE OF THE BLOCK
--------------------
<div class="buttons">
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
--------------------
8. ADD BEFORE
--------------------
<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>
--------------------
9. If you want the like button also in bottom, fine the second occurance of the block and also add accordingly
10. SAVE file with changes
11. Now, Login to Administration Control Panel from frontend and in the main page,
Resynchronise or reset statistics-->Purge the cache-->Run now
If you face any problems, post here.
Tested with phpBB 3 (But there is no version dependent code, so it will work on all versions, if someone tests in other versions, please post the errors/success messages here)
Screenshot:
Steps:
1. OPEN FORUM_ROOT/includes/functions.php
2. FIND THE BLOCK:
--------------------
// 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:
--------------------
//Facebook like hack by Sriram.A.S. (sriramdasty7@gmail.com)
$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. In the same file, FIND
--------------------
'SITE_LOGO_IMG' => $user->img('site_logo'),
--------------------
5. ADD BELOW
--------------------
'CURRENT_URL' => $curr_url,
--------------------
6. SAVE file with changes
7. OPEN FORUM_ROOT/styles/{YOUR_TEMPLATE}/template/viewtopic_body.html
8. FIND FIRST OCCURANCE OF THE BLOCK
--------------------
<div class="buttons">
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
--------------------
8. ADD BEFORE
--------------------
<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>
--------------------
9. If you want the like button also in bottom, fine the second occurance of the block and also add accordingly
10. SAVE file with changes
11. Now, Login to Administration Control Panel from frontend and in the main page,
Resynchronise or reset statistics-->Purge the cache-->Run now
If you face any problems, post here.