This plugin grabs your recent phpBB forum topics for you to display in wordpress.
Do you have a phpBB forum, do you want to drag your blog readers into your forum ? Then this plugin might just help, you can include somewhere in wordpress a list of recent phpbb threads (topics) in a page, a post, and even in your theme – so your sidebar for example !
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. (If you really need to, you can store the phpbb databse credential in the plugin using the “Insecure” connectivity method.)
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;
AND
GRANT SELECT ON phpbb_database.phpbb_forums TO wp_user@localhost;
AND
GRANT SELECT ON phpbb_database.phpbb_posts 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.
From the phpbb_recent_topics admin / settings page, tick the .Enable Insecure Database Connection. box, and submit, when the page re-freshes you.ll have some more boxes to populate, from your phpbb config.php fill in
$dbuser = phpbb MySQL Database UserName $dbpasswd = phpbb MySQL Database Password $dbhost = phpbb MySQL Server
Click update, and you should be connected!
To allow users to customize what is / can be displayed a callback function phpbb_topics_callback
has been implemented.
In ticket 1216 (https://plugins.trac.wordpress.org/ticket/1216) phil suggested that the forum name should be displayed within the topic list; the following code is an example use of the new callback function and should be added to your themes functions.php
function phpbb_topics_callback($phpbbdb, $wpdb, $lnx_PRT_options, $topic) { // GET FORUM WHICH POST IS IN - Phil Ewels, 26/09/2010 $sql_query = "SELECT * FROM $lnx_PRT_options[prt_phpbb_ft] WHERE forum_id=" . $topic->forum_id. " LIMIT 1"; # Run Query if ($lnx_PRT_options['prt_phpbb_dbinsecureon'] == "1") { $forum = $phpbbdb->get_row($sql_query); } else { $forum = $wpdb->get_row($sql_query); } echo "<br /><small>" . $forum->forum_name . " </small>"; }
The following variables can be used within your callback function:
* $wpdb
** If using Secure Connectivity this is a connection to your PHPBB Database
** If using Insecure Connectivity this is the standard WordPress Database
* $phpbbdb
** If using Secure Connectivity this will be NULL
** If using Insecure Connectivity this is a connection to your PHPBB Database
* $lnx_PRT_options
** An array of the phpbb-recent-topics settings
* $topic
** The current topic, with associated attributes.
Setup your Database Connection, see Other Notes
unzip phpbb_recent_topics.zip 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 ‘Settings’ -> ‘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) * The Date Formatting, i.e. "d/M/y - g:i a" similar to the WordPress "General Settings"
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 using the widget…
* click “design” in the dashboard
* click “widgets”
* next to phpBB Recent Topics click “add”
* click “save changes”
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(); } ?>
Yes.
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, use the new 0.5.x feature in the admin settings
You’re not an Administrator
The date settings effect both the template tag and the widget
Some people cannot GRANT priveliges from one DB to another; insecure connectivity allows you to store the phpbb database credentials within the WordPress database.
The phpbb database credentials are stored in the WordPress database in CLEAR TEXT, this is bad, as anyone with access to the WP DB can get full access to phpbb. Another reason is that usually the credentials given to the phpbb application are FULL access, we only need to read the database, so it’s much better to restrict access.
Yes, use the Insecure Connectivity method, and change the host to the IP address of the server