How to show latest phpBB3 posts in your WordPress sidebar

As you may notice, at the top of the rightmost column of this blog I am showing the latest posts of the forum.

I did not find any widget fitting my needs so I had to solve the problem by myself. And I am going to tell you how.

At the moment it’s not a widget, just a bunch of lines in a PHP Code Widget to do the trick. Should I receive good feedback, I will develop a fully customizable widget.

Anyway, following this tutorial will make you able to show your phpBB3 posts in your WP sidebar in a matter of minutes.

First, in your WP admin area go to Presentation -> Widgets to go into Sidebar Arrangement section.

You should find a screen like this one

WP admin area

… but it may be a bit different according to your theme. Anyway, what you need is a PHP Code Widget, so have to create one (look at the bottom arrow in the image) and drag/drop it in the sidebar.

Then you’re ready to enter the code in your widget:

$row[topic_title]
"; } ?>

Line 1: Opening php tag. Normally it makes no difference between <? and >?php but my widget told me

PHP Code MUST be enclosed in tags!

Line 2: Connecting with the database where you are hosting your phpBB3. Change localhost with the address of your database, your_login with database login and your_password with your database password. In case something should fail (database is down, login or password are incorrect), I return a “Service temporairly unavaiable” and terminate the script.

Line 3: Selecting the database where you installed your phpBB3. Change your_db_name with the name of the database.

If you do not remember one (or more) data explained at lines 2-3, simply give a look to your config.php file in the folder where you installed phpBB3.

It’s made in this way:

At line 5 you will find the database address (122.122.122.122), at line 7 db name (emanuele), at line 8 db username (triqui) and at line 9 the password (banana).

Also remember line 11 and write down somewhere the content of table_prefix variable (phpbb_)

I did not used any of those names, so don’t even try to hack my forum… but let’s go back to the script…

Line 4: This is the string representing the query that will create the table with the last 10 updated topcis. phpbb_topics is the name of the table than contains the topics. If you have another value in your table_prefix variable, then you will need to change phpp_topics with your_table_prefix_topics. So, as an example, if your table prefix is triqui, then your table name will be triqui_topics, while you won’t have to change topic_last_post_time that represents the timestamp of the last post in the topic. In this way, you will get a table with the latest 10 topic ordered by last post time. If you want more (or less) than 10 topics, change the 10 in limit 0,10

Line 5: Processing the query, or returning in case of error the same fake message “Service temporairly unavaiable”

Line 6: Loop to be executed 10 times

Line 7: Fetching the row of the table in an array called row

Line 8: Displaying the link: notice that the link starts with http://www.yourforumdomain.com/, you will have to change this address with the path of your phpBB3 forum. For instance, if your forum is in the forum folder in the google domain, you will have to write http://www.google.com/forum/. You don’t need to change anything else

That’s all. Hope you will find it useful… maybe some day I will make a widget that will be easier to configure.

Get the most popular Phaser 3 book

Through 202 pages, 32 source code examples and an Android Studio project you will learn how to build cross platform HTML5 games and create a complete game along the way.

Get the book

214 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 1+2=3
// 100 rounds
// 10000000
// 2 Cars
// 2048
// A Blocky Christmas
// A Jumping Block
// A Life of Logic
// Angry Birds
// Angry Birds Space
// Artillery
// Astro-PANIC!
// Avoider
// Back to Square One
// Ball Game
// Ball vs Ball
// Ball: Revamped
// Balloon Invasion
// BallPusher
// Ballz
// Bar Balance
// Bejeweled
// Biggification
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Boom Dots
// Bouncing Ball
// Bouncing Ball 2
// Bouncy Light
// BoxHead
// Breakout
// Bricks
// Bubble Chaos
// Bubbles 2
// Card Game
// Castle Ramble
// Chronotron
// Circle Chain
// Circle Path
// Circle Race
// Circular endless runner
// Cirplosion
// CLOCKS - The Game
// Color Hit
// Color Jump
// ColorFill
// Columns
// Concentration
// Crossy Road
// Crush the Castle
// Cube Jump
// CubesOut
// Dash N Blast
// Dashy Panda
// Deflection
// Diamond Digger Saga
// Don't touch the spikes
// Dots
// Down The Mountain
// Drag and Match
// Draw Game
// Drop Wizard
// DROP'd
// Dudeski
// Dungeon Raid
// Educational Game
// Elasticity
// Endless Runner
// Erase Box
// Eskiv
// Farm Heroes Saga
// Filler
// Flappy Bird
// Fling
// Flipping Legend
// Floaty Light
// Fuse Ballz
// GearTaker
// Gem Sweeper
// Globe
// Goat Rider
// Gold Miner
// Grindstone
// GuessNext
// Helicopter
// Hero Emblems
// Hero Slide
// Hexagonal Tiles
// HookPod
// Hop Hop Hop Underwater
// Horizontal Endless Runner
// Hundreds
// Hungry Hero
// Hurry it's Christmas
// InkTd
// Iromeku
// Jet Set Willy
// Jigsaw Game
// Knife Hit
// Knightfall
// Legends of Runeterra
// Lep's World
// Line Rider
// Lumines
// Magick
// MagOrMin
// Mass Attack
// Math Game
// Maze
// Meeblings
// Memdot
// Metro Siberia Underground
// Mike Dangers
// Mikey Hooks
// Nano War
// Nodes
// o:anquan
// One Button Game
// One Tap RPG
// Ononmin
// Pacco
// Perfect Square!
// Perfectionism
// Phyballs
// Pixel Purge
// PixelField
// Planet Revenge
// Plants Vs Zombies
// Platform
// Platform game
// Plus+Plus
// Pocket Snap
// Poker
// Pool
// Pop the Lock
// Pop to Save
// Poux
// Pudi
// Pumpkin Story
// Puppet Bird
// Pyramids of Ra
// qomp
// Quick Switch
// Racing
// Radical
// Rebuild Chile
// Renju
// Rise Above
// Risky Road
// Roguelike
// Roly Poly
// Run Around
// Rush Hour
// SameGame
// SamePhysics
// Save the Totem
// Security
// Serious Scramblers
// Shrink it
// Sling
// Slingy
// Snowflakes
// Sokoban
// Space Checkers
// Space is Key
// Spellfall
// Spinny Gun
// Splitter
// Spring Ninja
// Sproing
// Stabilize!
// Stack
// Stick Hero
// String Avoider
// Stringy
// Sudoku
// Super Mario Bros
// Surfingers
// Survival Horror
// Talesworth Adventure
// Tetris
// The Impossible Line
// The Moops - Combos of Joy
// The Next Arrow
// Threes
// Tic Tac Toe
// Timberman
// Tiny Wings
// Tipsy Tower
// Toony
// Totem Destroyer
// Tower Defense
// Trick Shot
// Tunnelball
// Turn
// Turnellio
// TwinSpin
// vvvvvv
// Warp Shift
// Way of an Idea
// Whack a Creep
// Wheel of Fortune
// Where's my Water
// Wish Upon a Star
// Word Game
// Wordle
// Worms
// Yanga
// Yeah Bunny
// Zhed
// zNumbers