The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Gallery 2.1 and vBulletin 3.5.X integration
This tutorial will outline the steps needed to integrate your vBulletin 3.5.X and Menalto Gallery 2.1 installations. The original thread located here has become a little too scattered, and since it's original focus was on the Gallery 2.0 and vBulletin 3.0 series, I think it'd be beneficial to start this new thread so that the information is more easily found for the 3.5.X and 2.1 series. Before we begin, you should be aware that this tutorial assumes that you'll be placing your gallery in the root directory for your forums. My directory structure looks a little like this: public_html/Vbulletin Files and public_html/gallery2/Gallery Files As long as your gallery folder is located within your root vBulletin directory, this should work just fine. Step 1: Install Menalto Gallery 2.1. Remember to upload the "gallery2" folder INSIDE your root vBulletin directory! Step 2: Create a new file containing the following, and save it as gallery2.php: PHP Code:
Step 3: Find and edit the following code to suit your site setup: PHP Code:
PHP Code:
Step 4: Create a new template in your style manager called gallery2 containing the following: HTML Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head>$headinclude $data[headHtml] </head> <body> $header $navbar <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="tcat">Gallery</td> </tr> <tr> <td class="alt1">$data[bodyHtml]</td> </tr> </table> $footer </body> </html> You can achieve further integration by using johnmont's plugins which will:
PHP Code:
Hopefully this tutorial sparks a little more interest in this area and we can get some additional people contributing solutions to achieve tighter integration :banana: As the integration progresses, I'll update this thread to keep everything together and accessable. Enjoy! |
#262
|
|||
|
|||
Does this allow the VB users username and passwords to be transfered over too, so users don't need to create a new account to upload pictures?
|
#263
|
||||
|
||||
Yep. The script Carbon-copies the user's account to the gallery when the navigate to the integrated gallery page.
Also, I'm trying to use this in vB3.7, but http://www.alteranlabs.co.uk/forums/gallery2.php is screwed up; None of the images are there and the formatting is out-of-whack. I've looked at the image path for the placeholders, and it's done "/forums" twice! Any way to rectify this? |
#264
|
|||
|
|||
I tried this integration with Gallery 2.2 i got this error message:
Quote:
|
#265
|
||||
|
||||
Alright, new to vbulletin and this is the first site that I've used it with. I decided to go the way of using gallery2 with my vB install and got this entire integration to work properly.
My setup is as follows in case you need to know: hswaves2008/forum/(forum files) hswaves2008/forum/gallery2.php hswaves2008/forum/index.php (the default file with vbulletin) hswaves2008/gallery/(gallery files) hswaves2008/index.php (the vbadvanced CMPS file) My gallery2.php code: PHP Code:
Now, the problem that I am having is this. 1) Click on the image that I uploaded t the gallery. (its the only one there) 2) If you scroll down to where it says "Photo Properties", just under that is an option to click on DETAILS. If you click this link to see more details on the image, the link is broken. Is there something that I need to do to get these links working properly. I have read this thread through several times and finally got the gallery2.php file working and searched through a couple more times for this issue and to no avail, I have found nothing that addresses this issue. Or maybe I don't know what solution I should be looking for. Any help here would be greatly appreciated. BTW... I have to say that vBulletin far surpasses any other forum/CMS that I have ever used in the past. I love it and it has been user friendly since day one. Now, tojust get this integration to work properly. Thank You. |
#266
|
|||
|
|||
Quick question - does the G2 database need to be in the same database as vB?
I will be starting from scratch on this. I have an existing vB 3.6.8 installation. No Gallery2 at all currently. I am not currently convinced I need to embed. In fact I am leaning away from it for the simple fact that my forums are a fixed width right now. Letting the galleries break out will up the available width by about 250px. I do however need to unify logins for users. I'd also like to have links to user's galleries in their profiles. As for Gallery2 version, it sounds like 2.1 will be a bit less painful to get up and running with vB 3.6.8. Is this assumption correct? |
#267
|
||||
|
||||
It has been a few days since I have seen a response. I have tried emailing and PMing a few of the users that responded and seemed proficient in correcting issues with this integration. I have it working and just need one little tweak to get some links working but it doesnt seem like this is supported anymore. No one checks this thread and the last few posts have seen no responses. The last support response was a month or two ago. Anyone out there that can help? Please?
BTW, I have Gallery 2.2 and IB 3.6.8 and it works just fine. The only issue that I am having is the one listed above. I am sure it can be corrected because I have seen a site in action with these two versions. Just waiting for a response from one of the users here. Hope they can help. |
#268
|
|||
|
|||
I sort of gathered that.
Maybe you can answer my question about the db since yours is up and running. Did you install G2 to your vB database or are they separate? Does it matter either way? I looked at your site earlier and the details link wasn't pointing to your forum folder - it was formed as if the folder was in the doc root. I just looked again now and the details link worked for me. |
#269
|
||||
|
||||
I figured it out last night and it is working for me now. I had one thing set wrong in my gallery2.php file. Looking through this thread over and overhelped me a lot even after I had already looked and looked through it man times a day until I had it right. Here is how you set it up.
install vbulletin to: domain.com/forum/ install gallery to: domain.com/gallery/ open up a text editor and insert this code: PHP Code:
Save this file and upload to: domain.com/forum/gallery2.php Create the new template like Step 4 of the initial post instructs you to do. That is all. Now you can use the gallery2.php file as the link to your gallery. You will need to edit the css file in gallery to match the colors of your vbulletin or vice-versa. What this code does is integrate the gallery and the forums when anyone visits that file. When they register for your vbulletin forum, it WILL NOT create a gallery user yet. The user must first visit the gallery2.php file in order for a user account to be created in gallery. As I understand, there are two different db's. One for vbulletin and one for gallery. The password for the gallery will not be the same as the vbulletin forum for the user due to the fact that vbulletin wants to add SALT(password) to the password. When a user visits the gallery2.php file for the second time it will look to see if the user is registered in vbulletin and if so, will look in the gallery db for a user account that matches,and if so then all will be gravy. If you have any further questions, let me know. Im not good at this stuff but if you follow my instructions, it will work now that I have it all figured out. It just sucks that someone like me has to be support for this for the fact that Im not really good at this stuff and am new to all this coding. Im a first timer to vbulletin, even if I have installed quite a few things in the past. I really would like to know what I am talking about when I help someone. What kind of code do I need to know to tweak this stuff. PHP? If I got a book on PHP, would that help me? |
#270
|
|||
|
|||
Thanks man! That is all easy stuff.
I am still unsure about my original DB question though and haven't seen an answer. I ASSume it doesn't matter where the vB database is in relation to the Gallery2 database because it is looking at that globals.php file which best I can tell pulls the user info from the vB database regardless of where it is - it knows where to look. My question stems from Joomla and the fact that all of the vB integration features for it require the vB database to be installed within the Joomla database and I like to keep things separate. Chances are, if you did not specifically create a new database for your Gallery2 install, then it dumped it into the vB database. I think what I will do is just try it with Gallery2 in it's own database. If it doesn't work I am out about 20 minutes of time and it is easy to clean up. I'd rather start there and integrate them later if I need to than integrate them and then have to go back later and correct it. --------------- Added 17 Feb 2008 at 14:48 --------------- Ok all I am getting is the white screen. Install paths are as follows: /chroot/home/mazdaoca/mazdaoca.org/html/community/global.php /chroot/home/mazdaoca/mazdaoca.org/html/community/gallery/embed.php Installed in the following: vB: webroot/community/ G2: webroot/community/gallery/ URL I am using is: http://www.mazdaoca.org/community/gallery.php The direct G2 link works fine: http://www.mazdaoca.org/community/gallery/main.php VB template "gallery2" has been created and the "head" section contains the code posted in Step 4 of the instructions. gallery.php is as follows: Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'gallery'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'gallery2', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('/chroot/home/mazdaoca/mazdaoca.org/html/community/global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'Gallery'; error_reporting(E_ALL ); $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); // ####################################################################### // ###################### Begin G2 INTEGRATION CODE ###################### // ####################################################################### $data = runGallery(); $data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery'; function runGallery() { global $vbulletin, $userinfo; require_once('/chroot/home/mazdaoca/mazdaoca.org/html/community/gallery/embed.php'); $data = array(); // If it's an anonymous user, set the g2 activeUser to null $uid = $vbulletin->userinfo['userid'] = 0 ? '' : $vbulletin->userinfo['userid']; // initiate G2 // You need to edit the following 4 lines to suit your VB3 & G2 installations // This is set up for an install that looks like: // public_html/VB/<vb files> // public_html/gallery2/<gallery2 files> // and also setup for a VB3 template name of 'gallery2'. If you have any // differences, make those changes here! // You might need to change 'loginRedirect' if you have your VB3 setup to // where index.php is not the root page of VB3... Like if you've changed it // to forums.php or something of the like. $ret = GalleryEmbed::init(array('embedUri' => 'gallery.php', 'g2Uri' => 'http://www.mazdaoca.org/community/gallery/', 'loginRedirect' => 'index.php', 'activeUserId' => $uid)); if ($ret) { if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) { // Check if there's no G2 user mapped to the activeUserId $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser'); if ($ret && ($ret->getErrorCode() & ERROR_MISSING_OBJECT)) { // User not mapped, create G2 user now // Get Arguments for the new user: $args['fullname'] = $vbulletin->userinfo['username']; $args['username'] = $vbulletin->userinfo['username']; $args['hashedpassword'] = $vbulletin->userinfo['password']; $args['hashmethod'] = 'md5'; $args['email'] = $vbulletin->userinfo['email']; $args['language'] = $vbulletin->userinfo['lang_code']; $args['creationtimestamp'] = $vbulletin->userinfo['joindate']; $retcreate = GalleryEmbed :: createUser($uid, $args); if ($retcreate) { echo '<HR>line: '.__LINE__.', Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml(); return false; } $ret = GalleryEmbed::checkActiveUser($uid); if ($ret) { print $ret->getAsHtml(); return false; } } else { echo '<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml(); return false; } } else { echo '<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml(); return false; } } // user interface: disable sidebar in G2 and get it as separate HTML to put it into a block // GalleryCapabilities::set('showSidebar', false); // handle the G2 request $g2moddata = GalleryEmbed::handleRequest(); // show error message if isDone is not defined if (!isset($g2moddata['isDone'])) { $data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.'; return $data; } // die if it was a binary data (image) request if ($g2moddata['isDone']) { exit; /* uploads module does this too */ } // put the body html from G2 into the xaraya template $data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : ''; // get the page title, javascript and css links from the <head> html from G2 $title = ''; $javascript = array(); $css = array(); if (isset($g2moddata['headHtml'])) { list($data['title'], $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']); $data['headHtml'] = $g2moddata['headHtml']; } /* Add G2 javascript */ if (!empty($javascript)) { foreach ($javascript as $script) { $data['javascript'] .= "\n".$script; } } /* Add G2 css */ if (!empty($css)) { foreach ($css as $style) { $data['css'] .= "\n".$style; } } // sidebar block if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) { $data['sidebarHtml'] = $g2moddata['sidebarHtml']; } return $data; } // ####################################################################### // ####################### End G2 integration code ####################### // ####################################################################### eval('print_output("' . fetch_template('gallery2') . '");'); ?> Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD> <BODY></BODY></HTML> |
#271
|
||||
|
||||
The infamous white page is due to the fact that your php file is not configured properly. You installed your gallery within the forum directory. It has been specified that you need to install the gallery in the root directory of your domain. The first post f this thread is confusing. They state that you need to put the gallery in the root of your vbulletin and then go to say later that the root of your vbulletin is up a directory from the forum folder. If you wish to keep the setup you have now then I believe you need to add something here.
PHP Code:
As for your other question, sorry I didn't understand what you were asking the first time, but yeah, I have two db's one for the vbulletin and one for gallery. They are linked through the gallery2.php file. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|