vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Shared user database for multiple forums, same server (https://vborg.vbsupport.ru/showthread.php?t=98233)

CyberRanger 10-11-2005 10:00 PM

Shared user database for multiple forums, same server
 
For version 3.5x+, please see https://vborg.vbsupport.ru/showthread.php?t=118473

This thread will detail how to have a single login for multiple forums. It makes the following assumptions:
  • A valid vbulletin license exists for each install
  • All forums will be on the same server
  • You already have one forum operational AND that forum uses a BLANK $tableprefix!
  • One database will contain all the tables
This thread is a follow-up from this discussion over at vbulletin.com. Thanks to Brains for some pointers!

Here are the steps:
  1. Copy your forum directories to a parallel directory (for example copy /www/forums to /www/new_forums)
  2. In /includes/config.php, change $tableprefix (line 91) to a new prefix [for example $tableprefix = 'new_';]
  3. Run the vb install from the new directory (/www/new_forums/install/install.php)
  4. During the install, be sure NOT to empty the tables. If you have any doubt about what this means, stop NOW! If you empty the tables, you will lose all of your existing data from a prior install!
  5. Download the files from these directories to your PC: /new_forums, /new_forums/admincp, /new_forums/archive, /new_forums/includes, /new_forums/modcp, /new_forums/subscriptions
  6. We are now going to make global changes to the files in the folders (and subfolders) above. I used Dreamweaver's "edit-find and replace" function with "find in" set to "Entire Current Local Site". We are basically going to remove the "TABLE_PREFIX" from any code dealing with the user. (Note - if you are comfortable with unix command, you could do these changes from the command line on the server.)
  7. Run the following find and replace operations:
    • Find [" . TABLE_PREFIX . "user] (find what's inside the brackets). Replace with [?.?user] This should find 562 instances of user, usergroup, userfield, and usertextfield
    • Find [" . TABLE_PREFIX . "strikes] (find what's inside the brackets). Replace with [?.?strikes] This should find 5 instances of strikes
    • Find [" . TABLE_PREFIX . "pm] (find what's inside the brackets). Replace with [?.?pm] This should find 61 instances of pm, pmtext, pmtextid, and pmreceipt.
    • Upload these directories back to the server.
  8. We now need to do a little fine tuning
    • In /includes/functions.php: on line 1171 remove the table_prefix before $idname.
    • In /includes/adminfunctions: modify print_choser_row (line 1161)to check for $tableid of user, usergroups

      PHP Code:

      if ($tableid == "user" OR $tableid == "usergroup") {
                      
      $result $DB_site->query("SELECT title, $tableid FROM "."$tablename $wherecondition ORDER BY title");
              } else {
                      
      $result $DB_site->query("SELECT title, $tableid FROM " TABLE_PREFIX "$tablename $wherecondition ORDER BY title"); // existing code
              


    • In /includes/adminfunctions_user.php around line 116 (construct_style_chooser)

      PHP Code:

          $tableid $tablename "id";

          if (
      $tablename == "user" OR $tablename == "usergroupid") {
              
      $result $DB_site->query("
                  SELECT title, 
      $tableid
                  FROM "
      ."$tablename
                  WHERE userselect = 1
                  ORDER BY title
              "
      );

          } else {
                      
      // existing code
                              
      $result $DB_site->query("
                  SELECT title, 
      $tableid
                  FROM " 
      TABLE_PREFIX "$tablename
                  WHERE userselect = 1
                  ORDER BY title
              "
      );
          } 


Done! Both forums are now accessed by the same user table! PM's are unified across forums as is the user count.

FleaBag 10-12-2005 06:06 PM

Although I personally have no use for this I just wanted to say good work! I know a lot of people will be greatful. :)

Corriewf 10-12-2005 08:08 PM

Awww man you stole my idea!!!!! Its ok though cause I am just happy to see it!

LICryptkeeper 10-12-2005 10:12 PM

oh dear god I have waited for this for so long :S now port it to 3.5! I command you! (;) kidding, nice job)

I would love to get this working with the drupal CMS (I'm having a cookie issue at the moment)

Nutz 10-12-2005 11:15 PM

Very nice hack.
Very nice forums.

Thanks,
Mat

GoTTi 10-13-2005 01:01 AM

can u clear up number 8 for me. i dont understand what u mean...

before i start on a hack or modification i like to know exactly whats goin on...

this has nothing to do with posts right? just user login?

Bad Bunny 10-13-2005 02:24 AM

What transfers with the character to both forums? All of their setting and profile (including profile pic and avatar)? Some of it? None of it?

Ideally it would seem to me you would have password and email the same while everything was per site.

boostedsti 10-13-2005 04:14 AM

What about Subscriptions are those per user or per board?

Also is that a backup copy you are using or is it really live?
Reason I ask is

Stats: Armchairgeneral
Threads: 1, Posts: 1, Members: 7,631
Welcome to our newest member, vernon.miles

Stats:strategyzoneonline
Threads: 32,469, Posts: 421,417, Members: 7,637
Welcome to our newest member, josephhnewkirk

Either way I'm digging script.
Your sites are pretty sweet too.

goyo 10-13-2005 10:17 AM

Great hack...

Now only if we could use separate servers for this... :nervous:

boostedsti 10-13-2005 11:33 AM

Quote:

Originally Posted by goyo
Great hack...

Now only if we could use separate servers for this... :nervous:

By looking at the code it looks like you can as long as the database in shared between the boards..

The only thing bad I see is if you decide to expand and add another forum IE 3, 4, 5, 6 etc just imagine how many tables would be in that DB..


All times are GMT. The time now is 05:53 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01202 seconds
  • Memory Usage 1,751KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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