Complete Wordpress/vBulletin Bridge
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 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 echo get_option('vbb_VBURL') ?>/showthread.php?t=<?php echo $vbridge[id] ?>>(<?php echo intval($vbridge[count]) ?>) comments</a> | <a href=<?php 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.






March 8th, 2008 at 11:49 pm
Didn’t work for me, no luck with the bridge yet.
March 8th, 2008 at 11:57 pm
nevermind got it to work, thanks for the help!
March 9th, 2008 at 12:04 pm
@tom: No problem, glad you got it working…
after I changed hosts the vBulletin bridge worked out-of-box without actually hard coding in the directory path..
let me know if you have any questions, I’ve gotten pretty familiar with the plugin
March 23rd, 2008 at 10:03 pm
Hi Mike,
I’d really appreciate some help, and don’t mind paying for it. I thought I had integrated, but then I realized the user doesn’t get logged into WP - so I gave up and decided again to finally give it a try - and haven’t had any luck again.
My email is above, if you few like makin a couple bucks drop me a line, I’ve spent way too much tiime goofing around on this….
Thanks,
Tom
April 1st, 2008 at 4:24 pm
@Tom I tried to reach you by email. Let me know if you still need help in this matter. mikecicc@gmail.com
September 16th, 2008 at 4:19 pm
I am getting a fatal error when trying to install this in Wordpress.
Plugin could not be activated because it triggered a fatal error.
Using version 2.6.1 wordpress. I have made all of the changes you have said to on this webpage and uploaded the file. I try to click activate and I get that error.
Any ideas?
You can contact me at msauk@mac.com
Thanks
September 29th, 2008 at 1:49 am
i get this error
Parse error: syntax error, unexpected ‘=’ in /home/pinoyglobalbpo/public_html/wp-content/themes/WP_Premium/index.php on line 52
can you help me fixed this?
September 29th, 2008 at 1:53 am
the above error is pointing to this part of the code
<a href=/showthread.php?t=>() comments | <a href=/newreply.php?do=newreply&noquote=1&t=>Add your comments
October 11th, 2008 at 3:05 am
I have played with this so much lol I thought I finally found the fix with your article but I’m having the following problem:
is this because of the plugin or did I completely messed up :D, this happens when I make a new post.
Warning: require_once(DIR/includes/functions_newpost.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/vhosts/iv-designs.org/httpdocs/test/forums/includes/class_dm_threadpost.php on line 18
Fatal error: require_once() [function.require]: Failed opening required ‘DIR/includes/functions_newpost.php’ (include_path=’.:/usr/share/pear;’) in /var/www/vhosts/iv-designs.org/httpdocs/test/forums/includes/class_dm_threadpost.php on line 18
October 12th, 2008 at 8:56 pm
Hey mike , good stuff, i got some errors however, if you can help me out on this , it would be Super cool, i have 2 Domains Running under one account , im sure thats the problem i tested this plug in some other account it worked just fine.
However , fallowing your instructions i got the following message when attempting to create a post:
Warning: vb_post_form([path]) [function.vb-post-form]: failed to open stream: Success in /home/xdcore/public_html/xtrato.com/wp/wp-content/plugins/vbbridge.php on line 546
Fatal error: vb_post_form() [function.require]: Failed opening required ‘/home/xdcore/public_html/xtrato.com/wp/forum’ (include_path=’.:/usr/lib/php’) in /home/xdcore/public_html/xtrato.com/wp/wp-content/plugins/vbbridge.php on line 546
Any help would be appreciated , thanks a bunch
October 12th, 2008 at 10:53 pm
ok never mind , actually was a mistake of mine , works just right!
October 23rd, 2008 at 6:01 pm
Does Wordpress & vBulletin have to be in the same database for this to work? I would really appreciate some help with this and would be willing to pay for some advice…
November 11th, 2008 at 9:10 pm
@ronen…it does not need to share databases…I just recently jumped back into this script and got it successfully working for someone running the latest version of WordPress and vBulletin 3.7…email me if you still need help.
November 13th, 2008 at 12:52 am
I’m working on getting it installed (vb 3.7.3 + Wordpress 2.6.3). I have the blog homepage taken care of in terms of noting the # of comments and directing them properly to the comment page. However, I am having problems with the single post page, where I want to be able to have it display the comments from the thread directly on the post, then offer to have the user post theirs by directing them to the forum.
Here’s an example of what I want (from the add-on example installs)…
http://www.jeffsrecipes.com/forum/showthread.php?t=2670
Our Wordpress staging area (it’s not live yet… trying to work out the kinks)…
http://www.thrillnetwork.com/wordpress/
Example post:
http://www.thrillnetwork.com/wordpress/13-blah-blah-blah#respond