vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Menalto's G2 integration into VB3 (https://vborg.vbsupport.ru/showthread.php?t=80478)

whodah 06-13-2005 11:12 PM

an update!

i'm running a nightly build (from June 2nd) w/ core: 0.9.22

this includes the new url rewrite module - which works!

i had to hardcode some links though as the gallery url rewrite takes over the vB relative links.

so i had to make the relative links 'static' in 1 template and hard code a phrase too...

the phrase i had to edit was:
private_messages_nav

from:
Code:

<a href="private.php?{3}">Private Messages</a>: {1}, {2}.
to:
Code:

<a href="http://www.domain.com/private.php?{3}">Private Messages</a>: {1}, {2}.
the template i had to edit was: navbar

and i changed all links that looked like:
Code:

<a href="profile.php?$session[sessionurl]do=editprofile">
to:
Code:

<a href="$vboptions[bburl]/profile.php?$session[sessionurl]do=editprofile">
basically added:
Code:

$vboptions[bburl]/
in front of all of the links in that page that actually go somewhere. (not the # links) there's like 20 of 'em.

you can also do random blocks and such. i'm not sure the cleanest way to do it... i've done it on our site, but it uses vbadvanced. basically, look in the gallery site admin under:
Blocks -> Random/Popular

and note the 'External Image Block' section.

at some point in yer code, you need to call a php variable to get yer random block. since we cannot do this directly from templates, we have to do it in one of the .php files and then reference the variable which introduces a level of difficulty. for instance, as that page indicates, the code:
Code:

<?php @readfile('http://www.cvreefers.org/gallery2.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=owner'); ?>
will generate a random image. as you cannot call php from our templates, i kinda kludged this together w/ vbadvanced's help.

you can then get real jiggy w/ it by calling those links in yer postbit (or postbit_legacy in our case) to produce things like each users latest album or each users random pic.

an example is here, note beneath the posters' avatar:
http://www.cvreefers.org/showthread.php?t=2614

however, each time u look up a random pic, i get a delay on a p4 3.06 w/ 1 gig of ram. so if u have 10 users browsing 17 posts w/ 10 random pic genreators at once... well... u get the idea. actually read that thread if you want to see the outcome...

so - i'm using a cron job and a hidden field to do the tricks on that page.

i hesitate to mention those above tricks because i know the first thing that's going to be asked is 'how did you do this?' and it's pretty entailed. to get the user's gallery links beneath each user involves naming an album identicle to that user, creating two hidden user profile fields, and setting up a cron job. for the daily random block, another hidden user profile field, and another cron job. i really doubt that i'm doing it 'the right way' nor the most eloquant nor the most effecient way. heck, i'm establishing my own mysql connection on those cron jobs and i'm sure i could mooch off of vB's connection if i researched how, heh! so i just wanted to show that it can be done if that makes sence! i'm sure someone more advanced then i could make it generically fit any vB install.

zylstra 07-23-2005 07:09 PM

Quote:

Originally Posted by whodah
b) the menu to the left to add/edit/delete items is not appearing for all users... again - i've yet to dig too deep into this.

whodah,

I just signed up for your forum at cvreefers.org and can't see the add/edit/delete menu. I thought you fixed it with post #12. Did you perhaps overwrite your last mods?

Thanks.

whodah 07-24-2005 02:30 AM

that all works fine now. i'd imagine it's cause you don't have permissions on any album to add things

;)

i setup a test album w/ permissions for your account:
http://www.cvreefers.org/v/CVR_membe...c/whodah_test/

ZED28 07-30-2005 01:41 PM

Whodah,

Thanks for the update! I DO watch this thread to keep abreast of your progress and try to implement your changes/suggestions as soon as I get the chance.

I've implemented the re-write module and have modified the links in VB so that the re-write doesn't screw them up, this all works as expected. I still have a nagging problem (and this is the only real reason I want re-write) where extra crap is tagged onto the end of the shorter URL's - after the jpg extension:-

http://www.gmlsxs.org/d/4376-2/DSCN2...4cfff638c4e698


Now if I view the Gallery in stand-a-lone mode, the link looks like this:-

http://www.gmlsxs.org//gallery2/d/4376-2/DSCN2202.JPG


Both of these links will work if you click on them, the downside for me is that when used inside VB, I can't get the URL's to appear without the crap at the end. Of course, if you simply copy up to the JPG extension, this works - I just don't wanna explain how to do that to all our members over and over and over... LOL

I looked at your Gallery implementation and noticed you have the same problem too.

I also installed the module for displaying the URL's for BB Code and HTML from Gallery's site. I noticed you were involved in that and I've had a few issued with that also (didn't generate the shorter URL's, still added the crap at the end anyways) so I may or may not use that.

Any help you could provide would be greatly appreciated. BTW, thanks for sticking with this, it's an excellent integration!

You can view my Gallery2 install using the following links (same Gallery install)

http://www.gmlsxs.org/gallery2.php? <-- Integrated
http://www.gmlsxs.org/gallery2/main.php <-- Stand-a-lone


An Update:

Whodah, stop the press! LOL The nice folk at Menalto's Gallery have clued me in on this problem, see the following (a simple fix!)

http://gallery.menalto.com/index.php...wtopic&t=33488

Thanks bud!

whodah 07-30-2005 07:16 PM

heya Zed28!

cool beans!

can you show me on my site an example of the issue you were talking about resolved by the cookie settings? i cannot find an example and would like to straighten it out on my site! :)

also - the URLs/BBCODE: VERY VERY VERY nifty module!! :D i'll be revisiting it again here shortly to add some other fixes. time has been short for me lately, heh!

cya, and thx! :D

ZED28 07-30-2005 07:33 PM

Here ya go, this is the Clown fish from your Gallery within VB...
http://www.cvreefers.org/d/13045-3/a...36b0b4feb7e28e

The same picture from your Gallery in stand-a-lone mode...
http://www.cvreefers.org/./gallery2/d/13045-3/aeg.jpg

It was a simple fix, in the Site Admin section under General, theres a Cookie section towards the bottom. You'll obviously enter "cvreefers.org" for the domain and try a "/" for the path, that worked for me.

That should do it!

whodah 07-30-2005 07:38 PM

interesting...

i couldn't replicate that - until i logged off... it appears this is an issue for anonymous users (at least on my site)

thx for pointing it out! :D

Karri 08-12-2005 03:20 PM

is this available for 3.5 yet?

whodah 08-12-2005 03:45 PM

heya!

i'd imagine that we won't be moving to 3.5.x for quite a while. our site is extensively customized and it'll take a lot of work for me to upgrade it.

it can't be much different - but i have not done it myself.

Karri 08-12-2005 04:01 PM

Ah. Well thanks for the info. I have tried playing with it with no luck. Just get a gallery wrapped with vbulletin headers and footers and no user integration. I will keep on eye on this thread in case you decide to upgrade. :)

Pete Cahill 08-15-2005 05:09 PM

Same experience here w/ 3.5 RC2 and a fresh-install of G2 - a nicely vB-wrapped G2 interface, but no user-integration. :ermm:

Thought it was cookie-related at first, but I've verified that the users aren't being created automatically in G2 by the script yet I'm not getting any errors being generated by the code, either.

Anyone have any ideas?

Regards,
Pete

whodah 08-19-2005 05:17 PM

3.5 users: as mentioned above, i've not updated to 3.5. however, Pete's clue led me to think about this:

maybe 3.5 changed their user variable?

in particular, the line:
Code:

$uid = $bbuserinfo['userid'] = 0 ? '' : $bbuserinfo['userid'];
that one line might be the issue. if 3.5 isn't calling it bbuserinfo [userid] anymore, then it wouldn't know what to enter into the G2 user tables.

food for thought! :)

i'll probably upgrade to 3.5 once they go gold w/ it. in reading on how it'll be much easier to upgrade on a customized/hacked vB, it sounds nifty!

Zed28: on another note - i upgraded to G2RC1+5 yesterday and had the cookie issue (images ended in ?G2_SID=alkjsdfo0987sdf87s987df) both logged in or not logged in. so i did the fix you linked to, thx!

in particular, went to G2 Site Admin -> General Settings -> Cookies and set:
Path = /
Domain i left blank

worded right away, didn't have to clear my cookies on the FF browser i was using! :)

JimBeam 08-30-2005 03:38 PM

Quote:

Originally Posted by whodah
JimBean: thought of you today when i read that they are implementing subdomain support. it's not there yet, but they are working on it...

more info here:
http://gallery.menalto.com/index.php...wtopic&t=30959

Okie thanks a lot for the update. I've now been more active as my site is about to be up. thanks again

chanzero 08-30-2005 04:12 PM

thanks whodah, this is very cool!

i got it working in 3.5 even :)

can anyone help me figure out how to make it so that only logged in users can leave comments? i'm thinking i can set the g2 permissions so that Everybody can post comments, but then restrict the link from actually showing up with some vbcode?

Oloh 09-02-2005 09:04 PM

I am getting this error:

Code:

line: 96, Failed to create G2 user with extId [1]. Here is the error message from G2:
Error (ERROR_COLLISION)
in modules/core/classes/GalleryUser.class at line 166 (gallerystatus::error)
in modules/core/classes/GalleryEmbed.class at line 300 (galleryuser::create)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 93 (galleryembed::createuser)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 47

My vgfaces.php is:

Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vgfaces'); // 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(
    'cmpspages_vgfaces',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'vgFaces';

$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 $bbuserinfo;
                require_once('../vgfaces/embed.php');
   
                $data = array();
       
    // if anonymous user, set g2 activeUser to null
                $uid = $bbuserinfo['userid'] = 0 ? '' : $bbuserinfo['userid'];
 
                // initiate G2
                // you need to edit the following 4 lines to suite your VB3/G2 install!!!
                // this is setup for a install that looks like:
                //    public_html/VB/<vb files>
                //    public_html/gallery2/<gallery2 files>
                // and also setup for a VB3 tempalte 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... i.e. if you've changed it
                // to forums.php or something of the like.
                $ret = GalleryEmbed::init(array('embedUri' => 'vgfaces.php',
                                    'embedPath' => '/forums',
                                                'relativeG2Path' => '../vgfaces',
                                    'loginRedirect' => 'index.php',
                                    'activeUserId' => $uid));
                                               
    if ($ret->isError())
        {
          if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
          {
            // check if there's no G2 user mapped to the activeUserId
            $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
            if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
            {
                // user not mapped, map create G2 user now
                // Get Arguments for the new user:
                $args['fullname']    =  $bbuserinfo['username'];
                $args['username']    = $bbuserinfo['username'];
                $args['hashedpassword'] =  $bbuserinfo['password'];
                $args['hashmethod'] =    'md5';
                $args['email']      =  $bbuserinfo['email'];
                $args['language']  =  $bbuserinfo['lang_code'];
                $args['creationtimestamp']  =  $bbuserinfo['joindate'];
                 
                $retcreate = GalleryEmbed :: createUser($uid, $args);
                if (!$retcreate->isSuccess())
                {
                    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->isError()) {
                    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('cmpspages_vgfaces') . '");');

?>


Anyone able to help? Note, I have Gallery 2 running under a different MySQL database than vbulletin...is that a problem?

JimBeam 09-04-2005 10:12 PM

Quote:

Originally Posted by Oloh
I am getting this error:

Code:

line: 96, Failed to create G2 user with extId [1]. Here is the error message from G2:
Error (ERROR_COLLISION)
in modules/core/classes/GalleryUser.class at line 166 (gallerystatus::error)
in modules/core/classes/GalleryEmbed.class at line 300 (galleryuser::create)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 93 (galleryembed::createuser)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 47

My vgfaces.php is:

Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vgfaces'); // 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(
    'cmpspages_vgfaces',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'vgFaces';

$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 $bbuserinfo;
                require_once('../vgfaces/embed.php');
   
                $data = array();
       
    // if anonymous user, set g2 activeUser to null
                $uid = $bbuserinfo['userid'] = 0 ? '' : $bbuserinfo['userid'];
 
                // initiate G2
                // you need to edit the following 4 lines to suite your VB3/G2 install!!!
                // this is setup for a install that looks like:
                //    public_html/VB/<vb files>
                //    public_html/gallery2/<gallery2 files>
                // and also setup for a VB3 tempalte 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... i.e. if you've changed it
                // to forums.php or something of the like.
                $ret = GalleryEmbed::init(array('embedUri' => 'vgfaces.php',
                                    'embedPath' => '/forums',
                                                'relativeG2Path' => '../vgfaces',
                                    'loginRedirect' => 'index.php',
                                    'activeUserId' => $uid));
                                               
    if ($ret->isError())
        {
          if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
          {
            // check if there's no G2 user mapped to the activeUserId
            $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
            if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
            {
                // user not mapped, map create G2 user now
                // Get Arguments for the new user:
                $args['fullname']    =  $bbuserinfo['username'];
                $args['username']    = $bbuserinfo['username'];
                $args['hashedpassword'] =  $bbuserinfo['password'];
                $args['hashmethod'] =    'md5';
                $args['email']      =  $bbuserinfo['email'];
                $args['language']  =  $bbuserinfo['lang_code'];
                $args['creationtimestamp']  =  $bbuserinfo['joindate'];
                 
                $retcreate = GalleryEmbed :: createUser($uid, $args);
                if (!$retcreate->isSuccess())
                {
                    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->isError()) {
                    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('cmpspages_vgfaces') . '");');

?>


Anyone able to help? Note, I have Gallery 2 running under a different MySQL database than vbulletin...is that a problem?


How come you can go beyond the global.php?

I got this error in the 1st place.

Code:

Warning: main(./global.php): failed to open stream: No such file or directory in /home/abc/public_html/gallery/gallery2.php on line 32
OHHHHHHHHHHHHHH!! I finally got it!! thanks!

one thing i finally learnt is that the gallery2.php must be placed in the vb3 folder or else it can't work right?

zquestz 09-08-2005 06:48 AM

Just wanted to say thanks. Been wanting to do this for quite some time. If you want to check out my integrated vb3 -> gallery2 install you can check out:

http://blendchicago.com

Gallery2 Embeded: http://blendchicago.com/forums/gallery2.php
Gallery2 Standalone: http://blendchicago.com/gallery

Anyhow, if people care I can post the changes I made to the code in this thread. I did get mod_rewrite working in both standalone and embeded mode. I also stripped down the template since I didn't want the vb window borders around my install, and I noticed a ton of css conflicts I didn't want to work out.

whodah 09-08-2005 02:12 PM

yw zquestz! :D

and i'd be very greatful if you'd post your fixes. i'd love to see 'em! :D

they address some issues that i've just kinda lived with, ha ha! (i.e. the css issues)

Wordplay 09-09-2005 06:13 PM

anybody gotten this to work on 3.5 yet?

nitro 09-11-2005 07:50 AM

Am currently looking at this on a test area @ home

in vb 3.5x you need to change
Code:

$bbuserinfo to $vbulletin->userinfo
in all instances except by global

here change it to
Code:

global $vbulletin, $userinfo;
after doing this it seems to import vb users if they dont exist ok.

Wordplay 09-11-2005 09:46 AM

is there a way to import images and comments from 4images gallery into menalto's g2 gallery?

whodah 09-12-2005 03:34 PM

JimBean: just now getting your PM, dind't know i had one!

at any rate,yes! you are correct! galler2.php needs to be in the VB3 folder.

replying to your PM now! :)

tkieffer 09-22-2005 03:14 PM

I actually wanted to turn the menu bars off... in the newest version the setting has changed to:

Code:

GalleryCapabilities::set('showSidebarBlocks', false);

zquestz 10-06-2005 07:50 AM

Anyone figure out how to link to the "Your Album" part of Gallery from within VB? Been trying to figure out how to do this to no avail.

Basically I just want people to be able to jump to their member gallery easily without first going onto a Gallery page. Seems like it would be easy, but its trickier than it looks! Hahah.

whodah 10-06-2005 02:43 PM

this is on vB 3.0.x

havn't moved to 3.5 yet.

this will add a link beneath the post count of the user.

however it might not work for your situation. all of my members' galleries are their vB username.

like my username is: whodah
my gallery name is: whodah

i have a user named: nifty_guy
his gallery name is: nifty_guy

u get the idea ;)

i have a cron job that runs nightly (u can run it as often as u want of course) that checks usernames against g2 entities of the same name that are albums. if it exists, it populates a custom field in vB. if that field exists, a link to their album shows up in their posts.

so - u might have to tweak this accordingly, i'm not posting this as a cookie-cutter solution. but should getcha goin!

:D

there are no file modifications with this. there is one file [i]addition[/b]. the rest can be done from the admin control panel. :D

this involves:
  1. adding a user custom field
  2. adding a Scheduled Task (adding a file and adding the task in vB's admin page)
  3. modifying one postbit template


1: adding a user custom field
in your admin pages, go to: User Profile Fields -> Add New User Profile Field

call it wahtever you want. i titled mine:
Title: Gallery
Description: Does this user have a gallery in CVR_Members? If so, what's the name of the gallery?

you need ot make:
Field Editable by User: No

the rest you can fill out however you want. note the field number it assigns it. if you need to review it, click:
User Profile Fields -> User Profile Field Manager

and the 'Name' column is what you need to make a note of. in my case, it's: field10


2: adding a Scheduled Task
create the file:
includes/cron/gallery_field10.php

(yes, u can name the file whatever you want, just make a note of it)

**note: in the file right below this, replace 'field10' with your field number!

and in it add:
Code:

<?php 
    $whodiag = 0;
               
                $whomysqlstring = "SELECT * FROM user;";
                if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
                $results = mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
          while ($row = mysql_fetch_array($results)) {
                                  $whomysqlstring = "SELECT * FROM g2_FileSystemEntity WHERE g_pathComponent='".$row[username]."';";
                                        if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
                                        $results2 = mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
                                        if(mysql_numrows($results2)) {
                                                                        if($whodiag) {echo "<BR>line ".__LINE__.": Found an album for ".$row[username]."<BR>"; }
                                                                        while ($row2 = mysql_fetch_array($results2)) {
                                                                                          $whomysqlstring = "UPDATE userfield SET `field10` = '".$row2[g_pathComponent]."' WHERE userid = '".$row[userid]."';";
                                                                                                if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
                                                                                    mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
                                                                        }
                                        }

                }               
?>

go to: Scheduled Tasks -> Add New Scheduled Task
call it:
Title: Gallery Profile Updater
Filename: ./includes/cron/gallery_field10.php
(unless u used a different Filename above... if so, change accordingly)
and run it as often as u want. i run mine nightly. thus if a new user gets a gallery, it won't reflect on their posts til the next day. so for mine, everything is a star except Hour which is:
Hour: 2


after yer done, go ahead and 'Run Now' it.



3: modifying one postbit template
ok, if yer in legacy mode, yer using:
postbit_legacy
if not, it's probably
postbit
(someone correct me if i'm wrong)

so - edit the template yer using. for me, it's postbit_legacy.

in postbit or postbit_legacy (we use legacy), find:
Code:

<div>
                                        $vbphrase[posts]: $post[posts]
                                </div>

below it add:
Code:


                                <if condition="$post['field10']">
                                                <div>
                                                    <a href="$vboptions[bburl]/v/CVR_members/$post[field10]/">$post[musername]'s Gallery</a>
                                                                <if condition="$blockinfo['whodahuserrandompic']">
                                                                        <!--  -->
                                                                        <BR>Their Daily Random Pic:<BR>$post[field14]
                                                    </if>
                                                </div>
                                </if>

and now u'll get a nifty little link below their posts saying:
whodah's gallery

or

nifty_guy's gallery

ggs! :D

fringehead 10-07-2005 07:57 AM

I would like to have the vbulletin users have an account created for them, but I want to run Gallery as stand alone. Will their password work in stand-alone after their account has been created? How do I modify this script to use stand along instead of embedded? I have gotten an embedded to work I just don't like the big window fixing the gallery size. I also have my forum in a subdomain as well as my gallery....

zquestz can you post your code? Your site looks like what I want except your not in a subdomain... I have it working minus the images. The Matrix theme and gallery image comes through but all the pics are broken links and it seems the mod rewrite is all screwed up...

Thanks,

S

zquestz 10-07-2005 11:29 AM

Fringehead, you may be able to fix things by modifying the rewrite rules yourself to reflect your subdomains and other changes.

The rewrite code in gallery assumes you are running on a single domain. I also don't think you are going to be able to share cookies amongst both subdomains, so you are stuck with passing session id's in the url which I have found to be fairly slow.

As for the other problem with your gallery appearing inside a vbulletin window, thats easy to fix. Open the template for gallery2 and change it to:

Code:

$data[bodyHtml]
Yep... thats it. This keeps all the vbulletin headers, css and other things far away from your embed gallery the way it should be =)

Good luck on mod_rewrite, it's a nice site you have there.

whodah 10-07-2005 01:54 PM

last i looked - no, the password created from the vB integration into G2 will not work in standalone.

at least - not the way you want it to...

supose my password is: 123

so i go to vB and log on w/ my password of 123.

vB takes that '123' and adds it's SALT to it. i'm not exactly sure where/how, but that's what it does. so you enter '123' and vB sees 'SALT(123)'.

thus, the G2 integration script sends 'SALT(123)' to G2 as my password.

so - now i log out of vB and visit the standalone G2.

i attempt to log on w/ my password of '123' and get denied. because my password is not '123' but 'SALT(123)'.

so you'd have to do some code modification (sorry, i havn't looked into this myself nor plan to) to make the G2 authentication go through the same SALT as vB does or soemthing to that effect...

however - on the G2 forums, the user 'valiant' who works w/ the integration side of G2 has added SALT integration to the todo list. but on a low priority as aparently not a lot of CMS and/or forums use it in this manner.

i do have to add the 1 disclaimer that this information was based on about G2 RC2 and i havn't looked to see if it's been worked into G2 final. so u may want to research that!

HTH

fringehead 10-07-2005 06:53 PM

Quote:

Originally Posted by zquestz
Fringehead, you may be able to fix things by modifying the rewrite rules yourself to reflect your subdomains and other changes.

The rewrite code in gallery assumes you are running on a single domain. I also don't think you are going to be able to share cookies amongst both subdomains, so you are stuck with passing session id's in the url which I have found to be fairly slow.

As for the other problem with your gallery appearing inside a vbulletin window, thats easy to fix. Open the template for gallery2 and change it to:

Code:

$data[bodyHtml]
Yep... thats it. This keeps all the vbulletin headers, css and other things far away from your embed gallery the way it should be =)

Good luck on mod_rewrite, it's a nice site you have there.


Thanks for the compliment! Those guys take some nice photos :) I see there is a line of code that looks very similiar to what you say to change... is this the line I change?

Code:

// put the body html from G2 into the xaraya template
    $data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';

Thanks for the help!

Sean

zquestz 10-08-2005 05:36 PM

Nope, you don't change the gallery2.php file at all. Only change the template it installed in admincp to the value I mentioned.

fringehead 10-25-2005 01:27 AM

Hi Whodah and zquestz,

I got the gallery setup with Whodah's file, but I am having trouble getting the mod_rewite to work properly.....

From the docs I have read on menalto's site and here, I gather it's just in the Embeded Setup settings:

Embedded Setup

For URL Rewrite to work in an embedded environment you need to set up an extra htaccess file to hold the mod_rewrite rules.

Htaccess path: (I put in /var/www/forums)
Public path: http://forums.scubapost.net (I put in /gallery and tried /gallery2.php)

My embeded album is in http://forums.scubapost.net/gallery/

When I put in /gallery/It shows the path to the non-embeded photos. When I put in /gallery2.php it gives me urls' without the /gallery/ directory...

How did you guys get the embeded short urls to work?

EDIT:

I put in / instead of gallery2.php, also I have my Cookies settings to:

Path: /
Domain: .forums.scubapost.net (my forum is in a subdomain)


It is now working with the urls but some icons are missing. The program paths are :

embed: http://forums.scubapost.net/v/scripp...-0046.jpg.html
stand alone: http://forums.scubapost.net/gallery/...-0046.jpg.html

I assume is wrong. Any idea what I don't have configured right?


Thanks,

Sean

fringehead 10-26-2005 10:54 AM

OK I actually modified my board to match all of your settings... My gallery is working! but I still have the link issue. Check out this photo and notice the broken links.

http://www.scubapost.net/forums/v/sc...-0184.JPG.html

I check out the navbar and made the changes you said to make but they didn't have any effect. I am using 3.5, might these templates have changed?

When I click on a picture the broken links are "reload page" and "go back"... Is there anyway to eliminate them or hard code them?

As far as random blocks, I have made an html file and call it from the forum... Here is my html file:

table width="100%" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td align="center"><?php readfile('http://gallery.scubapost.net/main.php?g2_linkTarget=_blank&g2_view=imageblock.E xternal&g2_show=none&g2_blocks=randomImage&g2_maxS ize=140'); ?></td>
<td align="center"><?php readfile('http://gallery.scubapost.net/main.php?g2_linkTarget=_blank&g2_view=imageblock.E xternal&g2_show=none&g2_blocks=randomImage&g2_maxS ize=140'); ?></td>
<td align="center"><?php readfile('http://gallery.scubapost.net/main.php?g2_linkTarget=_blank&g2_view=imageblock.E xternal&g2_show=none&g2_blocks=randomImage&g2_maxS ize=140'); ?></td>
<td align="center"><?php readfile('http://gallery.scubapost.net/main.php?g2_linkTarget=_blank&g2_view=imageblock.E xternal&g2_show=none&g2_blocks=randomImage&g2_maxS ize=140'); ?></td>
</tr>
</table>

here is the code I put in the forumhome:

<!---------- PHOTO GALLERY START ---------->


<table class="thead" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">

<tr class="alt2" align="center" colspan="100%" border="0">
<div><iframe id="main" name="main" align="middle" valign="middle" src="http://www.scubapost.net/forums/randomimage.php/" border="0" frameborder="0" resizeable="no" scrolling="no" height="190" width="100%">
</iframe></div></tr>


<td class="tcat" colspan="100%" height="25" align="center" nowrap>Random Photographs from Our Member Photo Galleries</td>
</table>

<!---------- PHOTO GALLERY END ---------->

I'm no coder, but I saw the question was asked....

I do appriciate all documents to get me so far... I just have to clear up those urls and I'm good to go!

Thanks,

Sean

whodah 10-26-2005 05:43 PM

heya! it's quite possible they have changed in 3.5...

i'm not running it yet myself, but plan on doing so soon!

dsko 11-10-2005 06:07 AM

hi,

i have been following the directions in this thread to attempt the bridge between gallery and vb. i am currently getting the following error message

Notice: Undefined index: HTTP_REFERER in
/home/freshdis/public_html/forum2/includes/class_core.php on line 1546

Unable to add cookies, header already sent.
File: /home/freshdis/public_html/forum2/includes/class_core.php
Line: 1546

I am using galler 2.0.1 and vb 3.5.1

I do realise that this bridge is for an earlier veersion of vb but i did notice that a few ppl on here said they have got this working in 3.5

any ideas?

fringehead 11-15-2005 04:17 PM

Quote:

Originally Posted by whodah
heya! it's quite possible they have changed in 3.5...

i'm not running it yet myself, but plan on doing so soon!


Whodah,

Thanks for all the information for embedding Gallery into Vbulletin! I tried the phrase and menu bar again and your instructions worked! I don't know what was up earlier, but my Gallery is working great now!

Thanks again!

Sean

tercede 11-27-2005 04:12 AM

so, is there a way that works for vb 3.5.1? the one post before doesnt work for me :ermm:

fringehead 11-28-2005 03:25 AM

Quote:

Originally Posted by tercede
so, is there a way that works for vb 3.5.1?

It works for 3.5.1... Read each post... Someone posted the different code required to use it for 3.5.1....

Sean

inkpassion 12-20-2005 08:08 PM

Would it be possible to see your .htaccess file so I can get the mod_rewrite to work. Ive been pulling my hair out for hours trying to figure it out. Ive also setup the site with Multiaccess to aleviate andy login issues.

ZED28 12-24-2005 04:27 PM

It's not too clear to me where I'm supposed to make the changes for this to work with VB 3.51. Can someone post the updated code please?

ZED28 12-26-2005 02:26 AM

NM guys, figured it out.


All times are GMT. The time now is 09:36 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01858 seconds
  • Memory Usage 1,989KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (21)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete