Complete Wordpress/vBulletin Bridge
This post was published Tuesday December 11, 2007 filled under code.
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&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.
28 Responses to “Complete Wordpress/vBulletin Bridge”
Leave a response
tom says:
Mar 08, 2008, 11:49 pm:
Didn’t work for me, no luck with the bridge yet.
tom says:
Mar 08, 2008, 11:57 pm:
nevermind got it to work, thanks for the help!
mike says:
Mar 09, 2008, 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
Tom @ HTTAG says:
Mar 23, 2008, 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
mc says:
Apr 01, 2008, 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
Matthew says:
Sep 16, 2008, 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
GamA says:
Sep 29, 2008, 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?
GamA says:
Sep 29, 2008, 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
krike says:
Oct 11, 2008, 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
, 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
Xtrato says:
Oct 12, 2008, 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
Xtrato says:
Oct 12, 2008, 10:53 pm:
ok never mind , actually was a mistake of mine , works just right!
Ronen says:
Oct 23, 2008, 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…
Michael says:
Nov 11, 2008, 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.
Steven says:
Nov 13, 2008, 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
RepesogsCeT says:
Nov 20, 2008, 10:48 pm:
to: Admin – If You want to delete your site from my spam list, please visit this site for instructions: stopspam.idoo.com
Swiftblade says:
Nov 28, 2008, 4:56 pm:
I get this error when trying to post new content in WP:
Warning: require_once(/home/*****/public_html/includes/functions_newpost.php) [function.require-once]: failed to open stream: No such file or directory in /home/david/public_html/forums/includes/class_dm_threadpost.php on line 18
Fatal error: require_once() [function.require]: Failed opening required ‘/home/*****/public_html/includes/functions_newpost.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/david/public_html/forums/includes/class_dm_threadpost.php on line 18
Luc says:
Nov 30, 2008, 11:08 pm:
thanks very much for this tuto
problem solved now
best regards
Luc (France)
fatguysports says:
Dec 11, 2008, 1:43 pm:
This is the best support page I’ve seen so far for vbull + wordpress plugin.
We have vbull 3.7.3 , and wordpress 2.6.5
The forum has been up for a few months and now I’m pretty much finished designing the blog page.
We would like the users to be able to login once either at the blog page or in the forum, without having to login again when switching back and forth.
I can install the plugin that you mentioned above, post on wordpress and then check my vbull forum and the post is there.
then when I try to do the part for sharing the users, it doesnt work.
please help, if you need more info, you can e-mail me at tdawg@fatguysports.com
DDIG says:
Jan 19, 2009, 7:29 am:
Logging in redirects me to forum, all fine. I log in, and I’m logged in to wordpress as well, great!
But when I log out of vBulletin, close my browser, and later come back to see the wordpress page, I am still logged in in Wordpress! But I am logged out of vBulletin.
So logging out of vBulletin does not log me out of Wordpress, unless I directly visit wordpress page after logging out of vBulletin.
sfgf says:
May 20, 2009, 2:44 am:
Great informations
seoblog says:
May 20, 2009, 3:29 am:
Friends,
Thanks,go that fixed,still need a coder to do the integration.I’ll use them.A bridge between Vbulletin, and Wordpress MU to share login’s and run with vbulletin as the master.Its came up with a small hack for a bridge.
Thanks
http://www.seoblogcentral.com
seoblogcentral – vbulletin,jelsoft,forum,bbs,discussion,bulletin board,message board,blog,discussion forum
Complete Wordpress vBulletin Bridge MikeChick net | Paid Surveys says:
Jun 02, 2009, 3:22 am:
[...] Complete Wordpress vBulletin Bridge MikeChick net Posted by root 2 hours 33 minutes ago (http://michaelciccarelli.com) Vb user id this is the userid comment threads will be started with if the author is not function vb post form failed to open stream success in mikechick net is proudly powered by wordpress amp las vegas web design Discuss | Bury | News | Complete Wordpress vBulletin Bridge MikeChick net [...]
John says:
Jun 10, 2009, 8:04 pm:
Hi!
I get everything to work, but I do have one problem.
When I delete a post from WP the thread is not deleted from VB and when i edit/update a post in WP, it’s republished as a new thread in the forum.
Any ideas?
Complete Wordpress vBulletin Bridge MikeChick net | Patio Chairs says:
Jun 12, 2009, 10:48 am:
[...] Complete Wordpress vBulletin Bridge MikeChick net Posted by root 9 days ago (http://michaelciccarelli.com) Vb user id this is the userid comment threads will be started with if the author all user information contained in the vbulletin database table user is now in fatal error require once function require failed opening required mikechick net is proudly power Discuss | Bury | News | Complete Wordpress vBulletin Bridge MikeChick net [...]
Complete Wordpress vBulletin Bridge MikeChick net | fix my credit says:
Jun 16, 2009, 10:22 pm:
[...] Complete Wordpress vBulletin Bridge MikeChick net Posted by root 1 hour 8 minutes ago (http://michaelciccarelli.com) Vb user id this is the userid comment threads will be started with if the does wordpress amp vbulletin have to be in the same database for this to work form failed to open stream success in mikechick net is proudly powered by Discuss | Bury | News | Complete Wordpress vBulletin Bridge MikeChick net [...]
Complete Wordpress vBulletin Bridge MikeChick net | patio set says:
Jun 17, 2009, 10:12 pm:
[...] Complete Wordpress vBulletin Bridge MikeChick net Posted by root 14 minutes ago (http://michaelciccarelli.com) Vb user id this is the userid comment threads will be started with if the to open stream success in mikechick net is proudly powered by wordpress amp las complete wordpress vbulletin bridge mikechick net patio chairs says Discuss | Bury | News | Complete Wordpress vBulletin Bridge MikeChick net [...]
sinan says:
Nov 16, 2009, 8:33 am:
Do not make me help me
Hip Hop says:
Dec 10, 2009, 2:24 pm:
Thanks for the tutorial and helping people! I’m reading about this bridge a lot but I can’t figure out how to only share users. I tried this plugin and I think it’s having a problem with the Featured Content Gallery Plugin too! I have 3k users in Wordpress and I want to have’em in VB too, bridging WP and VB.
Anyone who wants to earn some extra bucks, holla back! ale_ulk(at)hotmail.com