I am looking over Pregnancy.org relaunched on Drupal - a case study. In there forum the navigation seems to be from the main drupal nav (like the rest of the site) but under the menu is the vbulletin forum content. How'd they do that? I want to keep the familiar drupal navigation but have vbulletin content below. I am going to use Drupal vb not vb Drupal because the theme I am using is only supported in Drupal 6.
Any thoughts?

CommentFileSizeAuthor
#15 file.inc_.patch1.76 KByuriy.babenko

Comments

silurius’s picture

I think it's a safe bet the two systems might not be integrated at all and are just styled to look like it. The designer for that site seems to have put specialized header html and css into the vBulletin header template, and is mimicking his or her Drupal header up to a certain point. They still use vBulletin's standard header below that. (Do a view source on the vBulletin side and take a look at their header.css to get a rough idea of what might have been involved).

Other thoughts:

1 - The "Forum Destinations A - Z" block on the front page is definitely using Views (or was at one time) but I'm not certain it's dynamic. I wonder if they just created Drupal nodes with a bunch of vBulletin URLs and used that behind the View.

2 - At the bottom of the Drupal articles, there is a login/register link for posting comments. These links return you to a standard Drupal comments form associated with the node, and may not be directly tied to vBulletin. I believe the vBulletin threads are all separate from the Drupal content.

I think the site is generally a great case study. I'd love to hear other general opinions!

As a side note, I personally have started work on a similar project but I really need to tie the Drupal articles more closely to the vBulletin discussion threads. I want threads to be created dynamically if possible but I have not yet managed to come up with a good way to do this.

silurius’s picture

Title: Drupal vb & vbulletin menu question » Mimicking a Drupal header in a vBulletin header

Oh and also, notice that the vBulletin menu is totally unchanged on that site, minus some stuff they decided to strip out. It is not doing anything Drupal-related. Perhaps we should rename this issue accordingly to be header-specific instead.

silurius’s picture

Title: Mimicking a Drupal header in a vBulletin header » Adding a Drupal header to vBulletin
JuJu_Kelly’s picture

Title: Adding a Drupal header to vBulletin » Mimicking a Drupal header in a vBulletin header

Thanks for looking into this.
Is there a way to have a drupal navigation menu in the header of a vbulletin page? I just want my forum pages to have the same navigation menu as the other drupal pages. I still want to keep the vbulletin menu on the forums but just have the main drupal nav links at the top.

silurius’s picture

JuJu_Kelly,

Yes, taking the case study site you mentioned as an example, I believe the designer actually pasted parts of their Drupal header -- including the Drupal primary links -- right into the vBulletin header template. He or she probably also copied some of the Drupal CSS related to the header region, into a new CSS file entitled "header.css", and then just referenced that in vBulletin.

I would start things off by viewing the source on your Drupal pages and copy/pasting parts of the header section into the vBulletin header template. To get to that template in vBulletin:

1. Go to /[FORUMPATH]/admincp
2. Go to Styles & Templates -> Style Manager
3. Open the "header" template

As far as what specifically you need to copy and paste, that's where you just have to experiment. You need to develop some level of familiarity and comfort with html and css, but that's not hard to learn and trial and error can be a great teacher.

Especially since vBulletin is so good about letting you roll back your template changes when they don't work!

I plan to go through these motions myself soon, but it might not be for another week or so because right now I'm focusing on figuring out how to create vBulletin threads out of Drupal posts on the fly.

Hope this helps. Feel free to ask more questions and I'll do my best to answer.

JuJu_Kelly’s picture

Thank you so much for your help. Your right Trial and error is a great teacher but I am stumped on something. I posted a coment in the forum but don't usually get a great response. see the following http://drupal.org/node/477388. I am trying to figure out how to expand/customize my users (drupal) profile. Also are you familiar with editing drupal theme templates...see http://drupal.org/node/497582.
Thanks !!!
You seem very knowegable. Maybe you could help :)
Sorry I am posting here-this issue isn't a Drupal vb issue.

yuriy.babenko’s picture

I've successfully added a Drupal-powered header & footer to my vBulletin installation. Warning: solution isn't pretty, but it works.

1. Download and install this custom module: https://github.com/yuriybabenko/dummy_pages
- This module will create two menu callbacks at yoursite.com/drupal-header and yoursite.com/drupal-footer.

2. In your theme's folder, create page-header.tpl.php and paste the "header" code from your main page.tpl.php (you may wish to move the code to an external file, and include it from both page templates). Do the same thing for page-footer.tpl.php.
- These files will be requested by vBulletin and their output displayed in the overall template.

3. Log in to the vBulletin admin panel and go to "Plugins and Products" -> "Add New Plugin"
- For product, select "vBulletin"
- For hook location, select "global_start"
- For title, enter "Drupal data"
- For execution order, enter "1"
- For plugin PHP code, enter this:

   $ch = curl_init();  
   curl_setopt($ch, CURLOPT_URL, 'http://yoursite.com/drupal-header');  
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);  
   $drupal_header = curl_exec($ch);  
   curl_close($ch);

   $ch = curl_init();  
   curl_setopt($ch, CURLOPT_URL, 'http://yoursite.com/drupal-footer');  
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);  
   $drupal_footer = curl_exec($ch);  
   curl_close($ch);

This code will make two separate CURL requests and save their output in $drupal_header and $drupal_footer variables. This will run Drupal's bootstrap process twice, which isn't great for performance, but is currently the only solution I have.

- Set the plugin to be active, and save it.

4. In the vBulletin admin panel, go to "Styles & Templates" -> "Style Manager"
5. Select "common templates" from the drop down next to your active theme, and click "Go"
6. Erase everything in the 'header' field and enter: $drupal_header; do the same for the footer field; save the form.

That's it - you now have a Drupal-powered header & footer showing up around your vBulletin template.

umarshafiq’s picture

nice work yuriy.babeko, but the php plugin code you provide is not working on vbulletin 4, can you post a php plugin code that shows the same results in vbulletin 4. I need it badly, thanx in advance

umarshafiq’s picture

nice work yuriy.babenko, but the
php plugin code you provide is only for vbulletin 3 and is not working on vbulletin 4, can you post a php plugin code that shows the same results in vbulletin 4. I need it badly, thanx in advance

yuriy.babenko’s picture

@umarshafiq - DrupalVB is not compatible with VB 4, and I do not have a copy of VB 4 to test with. The PHP code I posted should not need to change between VB versions...

umarshafiq’s picture

sir! i m very thankful that u have show response to post, first of all i have a lot of experience in vbulletin, but i m new to drupal, i have used is this method on vb 3.8.4, with drupal 6.20, but nothing is showing on the vbulletin header. Can u help me in this.... Secondly the php code you provide is using ob function that does not supported vbulletin 4.x, Can u tell me about any other method to integrate a drupal header in vbulletin 4.x........... i just want to add a drupal header, in vbulletin header template.... thanx for everything you have teach me,,, sorry for my rough english........

yuriy.babenko’s picture

The ob_ functions are native PHP, and should not be affected by any VB version. Furthermore, they are not even necessary in the snippet I posted above - they're just leftover code from my testing. I've edited the post to remove them.

reck’s picture

Hi yuriy.babenko
I have vbulletin 3.8.7 and drupal 6.2
in php extention i have active php_curl
I did all the steps, but I always see the same default style in the forum.
the module yuriybabenko-dummy_pages works but the variable $drupal_header and $drupal_footer are ignored from Vbulletin

I modified your plugin and I have created 2 plugins in vb

Drupal header
- product = "vBulletin"
- hook location = "global_start"
- title = "Drupal header"
- order = "1"
- plugin PHP code, this:

ob_start();
  $drupal_header = file_get_contents('http://yoursite.com/drupal-header');
  ob_end_clean();

and Drupal footer
- product = "vBulletin"
- hook location = "global_start"
- title = "Drupal footer"
- order = "1"
- plugin PHP code, this:

ob_start();
  $drupal_footer = file_get_contents('http://yoursite.com/drupal-footer');
  ob_end_clean();

note, you must not put the tag
now works !!

yuriy.babenko’s picture

@reck: sounds like something wasn't working with your CURL code; glad you got it working with file_get_contents()!

yuriy.babenko’s picture

StatusFileSize
new1.76 KB

Follow up to my post in comment #7:

My integration between Drupal and VB not only wraps the VB part of the site with a Drupal-powered header & footer, but also adds VB's "navigation" (breadcrumbs, main menu, user welcome, etc.) to all Drupal pages. To accomplish this, I've added some VB-native code on the Drupal side (custom module) to pull in, process and display the VB 'navbar' template. This means that Drupal is not only responsible for displaying its header on VB pages, but also initializing the VB session (for the navbar template to work).

A problem arises with the above setup when doing certain forum operations (editing a post, posting a reply, even posting a new thread) - there is a session discrepancy between what's set in the "main" VB setup, and what gets returned via the /drupal-header CURL request; the sessions don't match, and the user gets logged out from the main VB setup.

I've come up with a different way of getting Drupal's header into VB, without using a CURL request. This still invokes Drupal's bootstrap, and should go in the same plugin area as described in comment #7:

  // generate the drupal header by running the bootstrap for
  // a specific path
    chdir('../');
   
    $GLOBALS['_REQUEST']['q'] = 'drupal-header';
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    
    $return = menu_execute_active_handler('drupal-header');
    $GLOBALS['base_path'] = '/';
    $drupal_header = theme('page', $return);
   
    chdir('hubb'); 

Note that my VB forum lives within a 'hubb' folder that's inside the Drupal folder. You'll need to adjust the code to fit your own setup.

The fun doesn't end here... This setup works, but now all of Drupal's files and VB's files get loaded at the same time for all forum pages - this brings up a function naming conflict on some pages (such as when editing a post) with the file_download() function in Drupal's /includes/file.inc. Both VB and Drupal define functions with this name. The only solution I can think of is to hack file.inc and not define Drupal's file_download() on forum (/hubb/ for me) pages. Dirty, and can cause issues if your setup needs that Drupal function, but works in my case. I've attached a quick patch. Remember to change the 'hubb' string to match your own setup.