Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Shared user database for multiple forums, same server Details »»
Shared user database for multiple forums, same server
Version: 1.00, by CyberRanger CyberRanger is offline
Developer Last Online: Jan 2015 Show Printable Version Email this Page

Version: 3.0.9 Rating:
Released: 10-11-2005 Last Update: Never Installs: 15
Code Changes  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 10-31-2005, 08:45 AM
CyberRanger's Avatar
CyberRanger CyberRanger is offline
 
Join Date: Mar 2004
Posts: 1,319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hugojr
here is the error I am getting
Code:
Invalid SQL: 
		SELECT username, userid, birthday
		FROM ?.?user
		WHERE (birthday LIKE '10-30-%' OR birthday LIKE '10-31-%')
		AND usergroupid IN (0, 6, 7, 2, 5)
		
	
mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?.?user
		WHERE (birthday LIKE '10-30-%' OR birthday LIKE '10-31-%')
		AND use' at line 2

mysql error number: 1064
what does this mean?
It looks like maybe you've created a a double-double quote in that sql statement. Something that looks like
Code:
"".""user
I'll try to locate the exact spot where this sql is coded later today but if you can search in for "birthday" in the php files under includes.
Reply With Quote
  #33  
Old 10-31-2005, 11:31 PM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by westpointer
It looks like maybe you've created a a double-double quote in that sql statement. Something that looks like
Code:
"".""user
I'll try to locate the exact spot where this sql is coded later today but if you can search in for "birthday" in the php files under includes.
I have look everywhere can't find nothing wrong, just incase I am using version 3.0.9

Please if you can clear up your explanation of #8 a little better..

Thank You..
Reply With Quote
  #34  
Old 10-31-2005, 11:35 PM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In /includes/functions.php: on line 1171 remove the table_prefix before $idname.
PHP Code:
if (!$check $DB_site->query_first("SELECT $selid FROM " TABLE_PREFIX "$idname WHERE $idname"id=$id")) 
this is what it look like after according to your explination

PHP Code:
if (!$check $DB_site->query_first("SELECT $selid FROM " "$idname WHERE $idname"id=$id")) 
is that correct?
Reply With Quote
  #35  
Old 10-31-2005, 11:44 PM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

also In /includes/adminfunctions: modify print_choser_row (line 1161)to check for $tableid of user, usergroups

line 1161 before code change
PHP Code:
if (!is_array($GLOBALS["$cachename"])) 
now what I want to know is where do I add your code before or after

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

line 116 before code change
PHP Code:
function construct_style_chooser($title$name$selvalue = -1$extra ''
is the code you are giving before or after the code that is there
Reply With Quote
  #36  
Old 11-01-2005, 01:35 AM
CyberRanger's Avatar
CyberRanger CyberRanger is offline
 
Join Date: Mar 2004
Posts: 1,319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hugojr
here is the error I am getting
Code:
Invalid SQL: 
		SELECT username, userid, birthday
		FROM ?.?user
		WHERE (birthday LIKE '10-30-%' OR birthday LIKE '10-31-%')
		AND usergroupid IN (0, 6, 7, 2, 5)
		
	
mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?.?user
		WHERE (birthday LIKE '10-30-%' OR birthday LIKE '10-31-%')
		AND use' at line 2

mysql error number: 1064
what does this mean?
Can you post what you have in includes/functions_databuild.php from line 840 to 846? It should look like this (assuming you've replaced " . TABLE_PREFIX . " with "."
PHP Code:
    $bdays $DB_site->query("
        SELECT username, userid, birthday
        FROM "
."user
        WHERE (birthday LIKE '
$todayneggmt-%' OR birthday LIKE '$todayposgmt-%')
        AND usergroupid IN (
$usergroupids)
        
$activitycut
    "
); 
What do you have there?
Reply With Quote
  #37  
Old 11-01-2005, 01:54 AM
CyberRanger's Avatar
CyberRanger CyberRanger is offline
 
Join Date: Mar 2004
Posts: 1,319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hugojr
In /includes/functions.php: on line 1171 remove the table_prefix before $idname.
PHP Code:
if (!$check $DB_site->query_first("SELECT $selid FROM " TABLE_PREFIX "$idname WHERE $idname"id=$id")) 
this is what it look like after according to your explination

PHP Code:
if (!$check $DB_site->query_first("SELECT $selid FROM " "$idname WHERE $idname"id=$id")) 
is that correct?
Correct, you may want to do a "." just to help you find it in the future. To be honest, I don't know for sure what else is used by this query. This may need to be wrapped in an if statement instead. Can anyone else verify if this is only used for user type queries?
Reply With Quote
  #38  
Old 11-01-2005, 02:24 AM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by westpointer
Can you post what you have in includes/functions_databuild.php from line 840 to 846? It should look like this (assuming you've replaced " . TABLE_PREFIX . " with "."
PHP Code:
    $bdays $DB_site->query("
        SELECT username, userid, birthday
        FROM "
."user
        WHERE (birthday LIKE '
$todayneggmt-%' OR birthday LIKE '$todayposgmt-%')
        AND usergroupid IN (
$usergroupids)
        
$activitycut
    "
); 
What do you have there?
this is what I have from line 840 to 846
PHP Code:
$bdays $DB_site->query("
        SELECT username, userid, birthday
        FROM ?.?user
        WHERE (birthday LIKE '
$todayneggmt-%' OR birthday LIKE '$todayposgmt-%')
        AND usergroupid IN (
$usergroupids)
        
$activitycut
    "
); 
Reply With Quote
  #39  
Old 11-01-2005, 04:04 PM
CyberRanger's Avatar
CyberRanger CyberRanger is offline
 
Join Date: Mar 2004
Posts: 1,319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hugojr
this is what I have from line 840 to 846
Could you post the URL of the problem page?
Reply With Quote
  #40  
Old 11-02-2005, 06:56 AM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by westpointer
Could you post the URL of the problem page?
Please check your pm's

Thank You
Reply With Quote
  #41  
Old 11-02-2005, 04:52 PM
hugojr hugojr is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there anyone else that has installed this hack that can help us out we are willing to pay $$$$ please pm us if you are intrested...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:31 PM.


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.04987 seconds
  • Memory Usage 2,356KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (11)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete