Recently I was hired to install a vBulletin Message board on an established WordPress blog. While I was in the vBulletin support forums for an issue I was having, I came across a very useful WP plugin that I would highly recommend for those who wish to run these two systems together.
The WordPress/vBulletin Bridge can be found here. Please note that a valid vBulletin license is required to download this pluggin. This means you must register an account with vBulletin.org in order to verify your license status.
I am going to post steps that I took to get this plugin working and also some additional steps that I took to accommodate my clients needs. Keep in mind that all servers are configured different and this plugin may work on your own server flawlessly, out-of-box with out any adjustments. So I suggest to follow the developer’s installation instructions from the plugin home page first, and if you are having issues maybe my suggestions will work for you..
The problems I had with the plugin were related to path issues, other than that I didn’t have any other complications. So if you are having problems with this plugin after you’ve activated it. First thing you are going to want to do is find out the actual directory path to your forums on your server and hardcode these paths into the plugin. If you do not know this then put the following script in a .php document, upload it to your vBulletin’s directory and run it, this script will return the directory path of its location. You can then copy that to your clipboard before you begin modifying the WordPress vBulletin Bridge Plugin.
<?
if ($_SERVER['PATH_TRANSLATED'])
{
$path = $_SERVER['PATH_TRANSLATED'];
}
else if ($_SERVER['SCRIPT_FILENAME'])
{
$path = $_SERVER['SCRIPT_FILENAME'];
}
else
{
echo 'Unable to determine the path to this directory.';
exit;
}
echo substr($path, 0, (strlen($path) - 12));
?>
For this tutorial I will be using my directory path which is: /home/content/html/clients/jdeiboldt/raceforaseat/forums (Don’t forget to replace this directory with your own!)
1. Open vbbridge.php and replace all instances of:
chdir($_SERVER['DOCUMENT_ROOT'] . get_option('vbb_VBRPATH'));
with:
chdir('/home/content/html/clients/jdeiboldt/raceforaseat/forums');
$vwd='/home/content/html/clients/jdeiboldt/raceforaseat/forums';
2. Completely remove/delete this line:
require_once(ABSPATH . 'wp-admin/admin-db.php');
3.Replace:
require_once($vwd . '/includes/functions_misc.php');
With:
require_once('/home/content/html/clients/jdeiboldt/raceforaseat/forums/includes/functions_misc.php');
Once these changes have been made, upload the vbridge.php and functions_wysiwyg2.php file to your wp-content/plugins directory. DO NOT create a subdirectory.
Activate the plugin in your WordPress Dashboard.
YOU MUST go to the options page before you do anything else. Click Options, then “Vbridge Options”.
Define the following:
VB User ID: This is the userid comment threads will be started with IF the author is NOT REGISTERED with VB.
VB Username: This is the username comment threads will be started with IF the author is NOT REGISTERED with VB.
VB Forum ID: This is the default FORUM id where all comment threads will be posted unless another is selected. This also will indicate what forum will automatically be selected in the drop down menu on the write page.
Forum URL: This is the URL to your forum. NO index.php, NO trailing slash. Example: http://www.yoursite.com/forum
Forum Relative Path: This is the RELATIVE file path to your forum. So if your forum is located at http://www.yoursite.com/forum then the RELATIVE path would be /forum.
Database Prefix: This is your vbulletin database prefix. If you do not have one, then leave this blank.
Turn Plugin On: Select yes, this turns the plugin on.
DO NOT click “yes” for the “Turn Auto-Integrate” option yet!
Go to the “Post Articles To Forum” option and select “Yes”.
CLICK SUBMIT!
You MUST write a test post in WordPress and make sure it is posting to the forum you select. If the post does post fine to VBULLETIN, then you have done everything right (so far).
Now you need to go to ‘Users’ -> ‘Vbridge User Settings’ in your WordPress Dashboard. Here is where you map your Vbulletin users to WordPress. You will see an option to select a WordPress User Group for each Vbulletin user group. If you do not want a particular usergroup to be bridged to WordPress select “Do Not Map” for that group. For example, Map your VB Administrators group to the WordPress Administrator group. There will be a selection for each user group you have created for Vbulletin.
Once you have finished this click submit then click Options, then “Vbridge Options”. Select “Yes” for the option: “Turn Auto-Integrate On”.
You should be all set. If for some reason you can no longer login to WordPress, or you get errors, just delete or rename the vbbridge.php file and that will deactivate the plugin.
Users are bridged to WP when they view any wordpress page, and are logged into Vbulletin. They MUST be logged into Vbulletin at the time. All user information contained in the VBulletin database table “user” is now in the global object $vbuser. Example: $vbuser->username will display the users VBulletin username.
If you would like to use your vBulletin forums for WordPress comments:
Locate the following script in your WP Theme’s files:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
In most cases can be found in the following files: index.php, single.php, page.php [located in wp-content/themes/YOURTHEME]
Once you locate all the instances of that script your going to want to add the following script underneath in order for VBulletin to take over the commenting.
<?php
### Vbridge Call
$vbridge = Comment_Handler($post->ID);
###
?>
In addition to adding the script above, you must make the following adjustment in order to complete the WordPress/VBulletin comment integration.
Find this code (or similar code indicating the comment section of your template):
<?php comments_popup_link(__('0 Comments'), __('1 Comments'), __('% Comments')); ?>
And replace with this:
<?php
#### Vbridge Replacement code for comments
if ($vbridge[id] > 0) {
?>
<div class="comments">
<?php
if(is_single()) {
if (is_array($vbridge[replies])) {
?>
<br /><br />
<h3 id="comments">Comments:</h3>
<ol class="commentlist">
<?php
foreach ($vbridge[replies] as $reply) {
?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<?php echo $vbridge[vb_parser]->do_parse($reply[pagetext], false, true); ?>
<small class="commentmetadata">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/comment_arr.gif" alt="" />
by <cite> <a href=<?php&phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option('vbb_VBURL') ?>/member.php?u=<?php echo $reply[userid] ?>><?php echo $reply[username]; ?></a></cite>
</small><br />
</li>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
}
}
?>
</ol>
<?php
}
?>
<a href=<?php&phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option('vbb_VBURL') ?>/showthread.php?t=<?php echo $vbridge[id] ?>>(<?php echo intval($vbridge[count]) ?>) comments</a> | <a href=<?php&phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option('vbb_VBURL') ?>/newreply.php?do=newreply&noquote=1&t=<?php echo $vbridge[id] ?>>Add your comments</a>
</div>
<?php
}
##End Vbridge Replacement
?>
That’s that. Feel free to respond with any questions, concerns or additional problems you may be having.