Recent phpBB Topics on Wordpress Plugin v0.3
UPDATE: This Plugin has been updated, please download the update from http://wordpress.org/extend/plugins/phpbb-recent-topics/, and please comment on the new post, thanks.
Another day, another plug-in update…..Version 0.2 never saw the light of day, after fixing my compatibility issue I moved straight into setting up the admin interface. So here we have it, a proper implementation
Installation
- Unzip phpbb_recent_topics.tgz in your `/wp-content/plugins/` directory. (You’ll have a new directory, with this plugin in /wp-content/plugins/phpbb_recent_topics)
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Configure the plugin, you need to tell wordpress about phpbb, this is done in the wordpress menu ‘Options’ -> ‘phpBB Recent Topics’
The following Settings are required:- * The name of your phpBB database (e.g phpbb)
- * The name of the table where topics are held (the default is phpbb_topics )
- * The full url of your forum for links (e.g. http://www.mydomain.com/forum)
- * The number of topics to show. (If left blank you get 5)
- Hit ‘Update Options”
- To output the list of topics in a page or post…
- * create a new page/post, type {phpbb_recent_topics} , hit ‘Publish’ or ‘Create new page’
To output the list of topics in your theme sidebar…
- * edit sidebar.php and inside <div id=”sidebar”> type…
<?php if (function_exists('phpbb_topics')) { phpbb_topics(); } ?>
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.
Upgrading from Version 0.1
Upgrading is optional. This version has two major changes: The first basically fixes the compatibility issue I have running two php ob_start processes in wordpress; the second is the introduction of a “proper” admin interface (rather than hacking the php file).
To upgrade, make a note of the following settings:
$PHPBBDB = "phpbb"; //phpBB db name $TOPIC_TABLE = "phpbb_topics"; //phpbb topics table $SITEURL = "http://www.mydomain.com/forum"; //Forum URL
Deactivate version 0.1, and follow the Installation instructions above
Frequently Asked Questions
- Can I output 10 Topics in my Page, and 3 Topics in my Sidebar ?
- Yes ! In the Wordpress menu ‘Options’ -> ‘phpBB Recent Topics’, set ‘The number of topics to show’ to 10, and then in your sidebar include…<?php
if (function_exists(‘phpbb_topics’)) {
phpbb_topics(3);
}
?>
- Yes ! In the Wordpress menu ‘Options’ -> ‘phpBB Recent Topics’, set ‘The number of topics to show’ to 10, and then in your sidebar include…<?php
- Can I exclude a certain forum from the list ?
- In this version, the only way to do that is to hack /wp-content/plugins/phpbb_recent_topics/display/display.php, change
$results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE ORDER BY topic_time DESC LIMIT $LIMIT");to
$results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE forum_id != 1 ORDER BY topic_time DESC LIMIT $LIMIT");to exclude forum 1 from the list. I plan to setup a proper solution to this in the next version.
- In this version, the only way to do that is to hack /wp-content/plugins/phpbb_recent_topics/display/display.php, change
Finally Subversion
You also might be interested to know that I’ve been getting to grips with the wordpress plug-ins svn, so you can get work directly from here; and when wordpress.org re-crawls my readme the latest version will also be available on wordpress.org/extend/plugins/


HI Mlajo,
You’re going to need to read up on logical expressions… mine isn’t that great, you want to achive an expression where by the forum id is not equal to 1 or not equal to 2 (for example)
WHERE ( forum_id != ( 1 OR 2 ) )You’re probably best off referencing an SQL manual tho’ as I doubt that syntax is correct.
I solved it this way
$results = $wpdb->get_results(“SELECT * FROM $TOPIC_TABLE WHERE forum_id !=’45′ AND forum_id !=’14′ AND forum_id !=’15′ AND forum_id !=’16′ AND forum_id !=’17′ AND forum_id !=’18′ AND forum_id !=’48′ AND forum_id !=’47′ AND forum_id !=’51′ AND forum_id !=’46′ORDER BY topic_time DESC LIMIT $LIMIT”);
thanx everyone
[...] odiose tabelle (Joomla 1.5 che lo farà è ancora in beta). Per il phpBB non c’è problema. Esiste un plugin che ti permette di pubblicare gli ultimi interventi e altro sul tuo sito. Non l’ho implementato [...]
Hi,
is it possible to use the permanent links of the SEOphp in your plugin? If so, how can I do this?
Thanks
Sascha
Hi Sascha,
Sorry, I’ve not heard of SEOphp, can you post me a link?
Hi Nick,
Great job with the plugin! Is it possible to use it as a widget in Wordpress?
Cheers,
T.
Hi Thorsten,
I don’t use widgets myself, but I believe the answer is Yes.
I think you need the exec-php plugin then allow php execution in widgets, then paste the sidebar code into a new widget.
Good Luck!
Just a heads up on mine, I had the same error on line 70:
Warning: Missing argument 1 for phpbb_topics() in /home/emenang/public_html/homewordpress/wp-content/plugins/phpbb_recent_topics/phpbb_recent_topics.php on line 70
I did what Noor Nawawe did and it fixed it.
Thanks for a great plugin!
I’ve got this message in half of site if plugin is on (if i turn it off, then everything works fine):
“Warning: Cannot modify header information – headers already sent by (output started at /wp-content/themes/mytheme/home.php:3) in /wp-includes/wp-db.php on line 310
WordPress
Can’t select database
We were able to connect to the database server (which means your username and password is okay) but not able to select the mydb2 database.”
i have wp on “mydb1″ and forum on “mydb2″.
i have wp v. 2.0.5 and phpBB v. 3 final.
i have wp on root and forum on root/forum path.
any solution? please.
Hi Fokus, Your Database permissions have not been set up correctly, check that you have run your
GRANTstatement, and that you ran it as the correct user.rgds,
Nick
After unzipping the plugin unzipped to phpbb-recent-topics directory instead of phpbb_recent_topics. Resulting in a 404 error when you try to access the the options page. Renaming the directory fixed.
Good work on the plugin. I’m just starting up a new blog (migrating off of Drupal) and this plugin is the killer app that made me decide on WordPress over another option such as MT.
I’ve taken the display.php script and tweaked it a bit to better support my own use case and I wanted to post it here in case somebody can use it as well.
This bit grabs the last posts themselves rather than the last posted topics:
$results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE forum_id !='9' AND forum_id !='10' AND forum_id !='12' AND forum_id !='14' ORDER BY topic_last_post_time DESC LIMIT $LIMIT");This bit returns the information in a different format with some metadata about the post in the title of the
<a></a>tags for each link:foreach ($results as $topic){
$title = "Posted by $topic->topic_last_poster_name on " . date("l, F j, Y", $topic->topic_last_post_time) . " at " . date("H:i T", $topic->topic_last_post_time);
$url = $SITEURL . "/viewtopic.php?f=$topic->forum_id&p=$topic->topic_last_post_id#p$topic->topic_last_post_id";
echo "<li><a title='" . $title . "' href='" . $url . "'>$topic->topic_title" . "</a></li>\n";
}
Nick, if you’re interested perhaps I could take a look at properly integrating this with the admin code and making the two different behaviours an option the user can toggle, I’ll probably do it anyway for myself at some point but I’d prefer not to fork your code in any way. I could provide you with a diff when I get around to it if you’re interested.
cheers,
Gabriel
Little mistake in the code I posted, the ampersand in the $url variable should be
&and not&to ensure we render valid XHTML.Hi Gabriel,
That’s great thanks, I’d be happy to include any diff you send.
I’ve not yet had time to plan an update for this plugin, I know it’s been 9 months and I still haven’t fixed the packaging thing that annoys everyone (like Beau’s comment above), oh well C’est la Vie
Hi
I’ve installed your plugin however when i select the options/plugin the admin page for the plugin is not found and i get an error message.
I guess its looking in the wrong place for the admin page for the plugin? Can you advise?
Hi Nick,
You’ve probably got the problem lordbigsack found the WP plugin repo changed the folder structure, I’ve never gotten round to fixing the code, rename phpbb-recent-posts to phpbb_recent_posts.
hth,
Nick
Hi
Working better but now getting following error displayed on screen:
”
Warning: Missing argument 1 for phpbb_topics() in /home/gfuvcttp/public_html/wp-content/plugins/phpbb_recent_topics/phpbb_recent_topics.php on line 70″
Any ideas?
I have phpBB http://bb.mitoaction.org/ and WordPress http://blog.mitoaction.org/ on two separate domains on Dreamhost. They do not share a database.
The problem I am experiencing is that I have to set up a MySQL select-only user on phpBB different from the MySQL WordPress user. Is there a way to set up two different MySQL users in the plugin?
I don’t think the answer will be to install both phpBB and WordPress on the same database, because the user privileges are set in the control panel and the same user name cannot simultaneously have select-only and full privileges.
Thanks!
Hi Kathy,
You’re right you don’t need to have phpBB & WP in the same DB, and the plugin doesn’t support different users, since I wouldn’t work out a way of WP disconnecting from the WP-db to view the phpBB-db and then re-connect again.
What you need to do is
GRANTaccess to your phpBB-db to your existing WP-db-user… this seems to be the trickiest concept for people to grasp, basically log into your phpBB-db (via myphpadmin or something) and run theGRANTstatement above (replacing wp_user with whatever your existing wordpress user is.)Hope that helps
Although I love Dreamhost dearly, they don’t permit you to run
grantstatements through the command line nor through phpMyAdmin. Even if the Dreamhost control panel did let me give full access to the phpBB database for the WP user, I don’t think that is a good solution for security reasons.I know I can simultaneously connect to several databases using Perl::DBI, so I think will work on a custom solution. The real need is to make a static main site home page dynamic, which I can do with an include from a Perl CGI script. The ability to list forum posts through WordPress is a nice feature though.
I intend to update the DreamHost wiki http://wiki.dreamhost.com/ like I did for the information about being unable to use the GRANT features except through the Dreamhost MySQL control panel.
Thank you for you prompt reply!
Hi
Can someone tell me why I am seeing the following warning message before my posts?
Warning: Missing argument 1 for phpbb_topics() in /home/gfuvcttp/public_html/wp-content/plugins/phpbb_recent_topics/phpbb_recent_topics.php on line 70″
@Nick,
Try calling
phpbb_topics(5);in your theme instead ofphpbb_topics();:sHi there, Top plug in!
Only problem I’m having is that is doesn’t seem to read the css from the rest of my site, so it looks like basic html. I’ve tried wraping div tags around the sidebar and also within the display php file, both don’t work. Does anyone have and advice re styling the page?
Many thanks.
I’m have a few problems with the plugin. First, I was getting the line 70 error and I tried the solution above, and it worked. So thats okay now. But, I’m still not getting anything. site – http://www.yafantsy.com
It just shows an odd date and nothing else. Plus now my category drop down won’t work on the sidebar.
When I try to do the user permision thing, I get this error – where that dbo..83 is the phpBB user.
#1044 – Access denied for user: ‘dbo232927083@%’ to database ‘phpbb_database’
I don’t know php very well, or mysql. I mostly just use widgets and know enough to kind of adapt it to my needs. So, I’m really not sure what to do about my problem.
Please help! The plugin sounds awesome and I’d love to make it work -_-
Cassie, Sounds like you’re doing the permissions things backwards, you need to “connect / log in” to the phpBB database and GRANT access to the WordPress user
I’m pretty sure thats what I was trying to do – loging into mysql for the database that is for my forum. Then typing in the “GRANT SELECT ON phpbb_database.phpbb_topics TO wp_user@localhost;” – does the local host need to be something defined?
I’m not sure, maybe I can’t actually modify it…
Hi
Thanks for a super plugin!
I wonder can i do something to not display the time and date of the latest posts? its ok now also but i just think it would look better without in my theme:)
I’m on the edge between
(a) waiting for the next version
(b) doing the corrections manually (I understand around half of the errors reported are due to users’ configuration errors)
(c:) using bbpress instead of phpbb, primarily because i want an integrated blog+forum search, which i presume i can get with wp+bbpress (i may be wrong).
Nick,
can you guess when the next version might be released?
Anybody:
Do you know if it is at least conceptually possible to integrate the phpbb and wp search engines (and search results pages)?
I have a Google-Search which searches my whole site.
Is there a way to customize a Google-Search results page so it’s more like my blog search results page and/or my phpbb search results page?
P.S. Thanks – this is a holy grail
I also considered creating a category within wordpress which I designed to look more like a forum –
once people register, they can create new threads (posts) within topics (categories), and others can respond in comments.
What’s the difference between that modified blog and a forum?
threaded-commenting. inter-user messaging. that’s all i know of.
Am I right?
Sorry to be stressed about it but is it posseble to remove date and time of the latest post? after some thinking i really think it would look much better for me..
Steve, just delete…
echo "<small><i>" . date("d/M/y - g:i a", $topic->topic_time) . "</i></small>\n";from ~/phpbb-recent-topics/display/display.php
Jonathan, I’d recommend you install this version since life is a bit busy at the moment and I’m struggling to stay on top of comments let alone release a new version,
Cheers.
Thanks alot!!! i like it better this way.. if you like documentaries visit my site or if you just want to see this plug in im action!!
http://www.documentarycorner.com
Wow
great plugin – i had to use my hosting control panel to grant the permissions but once done it worked a treat
thanks
andy
Just have to say thanks again and again!!! this plug works great!!! looks so nice in the sidebar.. come and see att my site!
just klick on documentary above!!
THANKS!!!!!!!
join the forum waile you at it;)
Forgot to say that the posts are normally with date and time but i didnt use that. but just so you know if you install the plug and it not look the same..
I’ve tried this but I’m getting the following error message
$row[topic_title]
“; }
Hi Nick!
I’m using your plugin. Very useful! But I have a problem. I write in Portuguese, so, I use a lot of entities (like ã, ê, ú). When one of these entities appear in the list of last forum threads, they’re are changed by “?”. I guess it’s an error beetwen charsets, but both forum and blog are in UTF-8.
Do you know how can I fix it?
[]’s!
Updates for WP 2.5 on the way?
Hi All,
I’ve just done an update for PW2.5, comments here will be closed, please see new post.
http://www.linickx.com/archives/392/recent-phpbb-topics-on-wordpress-plugin-v04
Cheers,
Nick