ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How I did it: Vbulletin login on EE pages

August 27, 2008 2:16pm

Subscribe [4]
  • #1 / Aug 27, 2008 2:16pm

    scottmoa

    19 posts

    I’m building a new site for a large motorcycle community. We already use VB for our forum and its login for member access to content, the flea market (another large pile of scripts), etc. This login information is set by yet another pile of code in another application on another server. Because of all of this, we were never interested in a full integration with EE. We wanted a CMS that hand picked staff and volunteers could use to expand and maintain the site.

    This boiled down to us needing:
    1. VB login on EE pages.
    2. Passing of VB info - username, userid, VB group, # of PMs, and logout hash.

    This is probably obvious to everyone else, but I’m a little dense at times and I’ve found the EE user guide somewhere between thin and obtuse (it feels more like an abbreviated reference for someone already very experienced with EE). The solution was to use the path.php file. I inserted…

    chdir("/pathtolivedirectory/forum/");
    require_once('./global.php'); 
     chdir("/pathtolivedirectory/"); 
     $bbuserinfo = &$vbulletin->userinfo;

    and then set the global variables…

    $global_vars = array("vbuser" =>$bbuserinfo['username'],
    "vbid" => $bbuserinfo['userid'],
    "vbpms" => $bbuserinfo['pmunread'],
    "vblogout" => $bbuserinfo['logouthash'],
    "vbgroup" =>$bbuserinfo['permissions']['usergroupid']); // This array must be associative

    I could then use the above variables to present the user a simple welcome, a link to their private messages and so on. Or, if vbid == 0, I show the VB login form. And, more importantly, this makes setting up a simple conditional to determine what information a user can or can’t see super easy. There isn’t a public login for EE, but that suits our needs just fine.

    To save server load, I created a stripped down version of global.php that omits a good bit of the style construction ‘stuff’ and other fluff that only matters when in the actual forum, but the above works. It isn’t elegant and I’m sure there’s a reason this is a bad idea, but, again, it works.  :lol:

  • #2 / Aug 27, 2008 10:31pm

    iseem

    41 posts

    Thanks for sharing scottmoa!

  • #3 / Aug 28, 2008 3:31am

    Doggie52

    113 posts

    Woah, this is good! Thanks for sharing!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases