Blog |Follow Nick on Twitter| About
 

UPDATE: This Plugin has been updated, the latest version is available on wordpress.org please comment on the new post, thanks.

Written primarily for my wife to use in the future, but I've developed a pluging that allows you to post a list of recent phpBB threads/topics within wordpress.

If found this plugin by Brandon Alexander but it wasn't right for my needs, firstly he looks up usernames from phpBB, now my phpBB & wordpress installs don't share databases and I thought it was a bit of a security risk giving wordpress access to my users password hashes... and secondly that plugin gives a list of recent posts, not what I wanted, and wanted threads (topics).

This is the 1st version, the massive fault with it is that you have to edit the file (to tell it where to find phpBB), I'm not yet smart enough to include an admin interface.

Installation: Download phpbb_recent_topics.txt and save as phpbb_recent_topics.php in your wordpress plugins directory. Edit the file, and change these bits to your appropriate settings...

$PHPBBDB = "phpbb_database"; // phpBB db name
$TOPIC_TABLE = "phpbb_topics"; // phpbb topics table
$SITEURL = "http://www.domain.com/phpbb"; //Forum (phpbb) URL

A bit about Database configuration.
If wordpress & phpBB share a DB already then set \$PHPBBDB to DB_NAME and everything will be fine, else you're going to need to GRANT the wordpress user read access to phpBB.

How to GRANT wordpress read only access to phpBB ?
If you don't know it already you need to find your wordpress mysql user id, it'll be in wp-config.php

define('DB_USER', 'wp_user');     // Your MySQL username

and you should have already found your phpbb database & table for the above.
You need to type the following syntax into your mysql database

GRANT SELECT ON phpbb_database.phpbb_topics TO wp_user@localhost;

this can be achieved by logging into phpmyadmin as your phpbb user, selecting SQL and pasting the correct GRANT into the text box.

Plugin Usage.
The plugin can be used in two ways, for those who don't like editing templates you can call (type)

{phpbb_recent_topics}

from any post or page, and it will be replaced with an list of the last 5 topics.

For those who want to include the list in a sidebar template or similar, call the following function: phpbb_topics(), something like

 if ( function_exists('phpbb_topics') ) { phpbb_topics(5); }

where by the number 5 can be replaced with anything less that 10, and that'll be the number of topics returned.

Hopefully that all makes sense, feel free to contact me with problems.

UPDATE: Comments about combatability issues here please.

 

 
Nick Bettison ©