Just a few months earlier, Facebook released their new Like Button which is popping up on most popular websites and forums. Implementing this button with phpBB forums isn’t as simple as grabbing the code generated from Facebook’s configurator. That is, if you want it to work properly with the dynamic pages of your forum.![]()
The configurator generates two sets of code for you to choose from, Iframe and XFBML, both of which will link to the static URL you provide. Most people want it to link to dynamic pages, specifically, the phpBB thread that is being Liked. Two things must be done to accomplish this: modifying the code provided by the configurator, and configuring phpBB to allow the Facebook bot access to your forum. (Full credit goes to this phpBB thread for providing guidance.)
Modifying the Iframe code
<iframe src=”http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yourwebsite.com%2Fviewtopic.php%3Ff%3D{S_FORUM_ID}%26t%3D{S_TOPIC_ID}&layout=standard&show_faces=true&width=450&action=like&colorscheme=light” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:450px; height:30px“></iframe>
I highlighted two important parts of the above code:
- www.yourwebsite.com – replace this with your own URL. This also assumes you installed phpBB in the root directory. If you happened to have installed phpBB in a folder, you will need to replace the URL with: www.yourwebsite.com%2Ffolder
- height:30px – By default, the configurator sets it to 80 which is much too large. I found 30px to be the perfect height but you may play around with this number. You may also set the width, which appears twice in the above code, to whatever you feel works best for you (450 is the default)
Inserting Facebook Like Button into phpBB
The above code should be pasted into viewtopic_body.html. Where in that template should the code belong?
Personally, I wanted the Like Button to appear right next to the Post Reply button as this would give it the biggest exposure. Here’s how:
Find:
<div class=”topic actions”>
<div class=”buttons”>
Paste below:
The Iframe code modified above.
Adding the Facebook bot in phpBB and configuring bot permissions
This final step will ensure that Facebook has the required permissions to pull your thread titles correctly.
In phpBB, login to the Administration Control Panel. Under Quick Access, select Spiders/Robots and then Add bot.
Use the following settings:
- Bot name: FaceBook [Linkcheck]
- Agent match: facebookexternalhit/1.1
All other settings not mentioned can be left default or blank.
Now, you need to ensure that the Facebook bot has access to your forums. Still in the Administration Control Panel, click on the User and Groups tab. Under Groups, click on Groups’ forum permissions. Select Bots from the drop-down menu and hit submit. At this point you should select the appropriate forum sections (All forums would work) and hit submit. Here, ensure that you assign the Bot access role for each forum section and click Apply all permissions.
At this point, the Facebook Like Button should be configured correctly for the dynamic pages of your phpBB forums.

