Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Share users database among many forums Details »»
Share users database among many forums
Version: 0.10, by mangel.ajo mangel.ajo is offline
Developer Last Online: May 2012 Show Printable Version Email this Page

Category: Major Additions - Version: 3.7.2 Rating:
Released: 07-10-2008 Last Update: 07-12-2008 Installs: 61
Re-useable Code Code Changes Translations Is in Beta Stage  
No support by the author.

This is a feature requested many times, and we are still waiting, so I released a patch to be able to run many forums with the same user database.

This is an EXPERIMENTAL PATCH I'm running on my forums.

Code:
--- ../../../private/upload/includes/class_core.php     2008-07-10 11:17:32.000000000 +0200
+++ class_core.php      2008-07-11 17:44:20.000000000 +0200
@@ -405,6 +405,33 @@
                $this->connection_recent =& $link;
                $this->querycount++;

+               $shared_tables = Array("user","useractivation","userban","usertitle","userchangelog","usertextfield","userfield","usergroup","userlist","usernote","profilevisitor","reputation","reputationlevel","spamlog","strikes","pm","pmreceipt","pmtext","avatar","profilefield");
+
+               $main_prefix = "FP_";
+               foreach ($shared_tables as $shared_table)
+               {
+                       $orig = TABLE_PREFIX.$shared_table;
+                       $dst  = $main_prefix.$shared_table;
+
+                       $this->sql = str_replace($orig." ",$dst." "  ,$this->sql);
+                       $this->sql = str_replace($orig.".",$dst."."  ,$this->sql);
+                       $this->sql = str_replace($orig."\r",$dst."\r",$this->sql);
+                       $this->sql = str_replace($orig."\n",$dst."\n",$this->sql);
+                       $this->sql = str_replace($orig."\t",$dst."\t",$this->sql);
+
+               }
+

                if ($queryresult = $this->functions[$buffered ? 'query' : 'query_unbuffered']($this->sql, $link))
                {
You can add "session" to $shared_tables if you want to share your sessions among forums under the same domain (Thanks Lionel)

This is only useful for new forums joining anothers one user database.

Requirements:
  • An old forum where all users are.
  • Sharing the same database, using diferent prefixes for tables (TABLE_PREFIX)
For example: Imagine we have FORUM_A , FORUM_B, and FORUM_C each one with their respective licenses.

FORUM A has table prefix FA_ in database, FORUM_B has FB_ and FORUM_C has FC_

FORUM A is the main, and older forum, where we have all our users.

then we would install FORUM_B and FORUM_C normally, using the same database that FORUM_A uses, but setting up their own table prefixes.


once FB_ and FC_ are installed then we go patching class_core.php from FORUM_B and FORUM_C setting up $main_prefix = "FA_"; so they use FORUM_A for shared tables.

Possible problems:
  • memcached issues?, not sure
  • avatar/signature pics/etc issues when storage is set to disk.
  • more to come...


Author: Optimizacion Web

Show Your Support

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

Comments
  #52  
Old 09-04-2008, 10:42 AM
mayanks mayanks is offline
 
Join Date: May 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for it...could you please provide a small tutorial on how to do it?
Reply With Quote
  #53  
Old 09-05-2008, 02:45 AM
Amenadiel's Avatar
Amenadiel Amenadiel is offline
 
Join Date: Sep 2006
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

a little question: I believe the password's salt is based on the forum's license string. ¿Why doesn't this affect this mod?
Reply With Quote
  #54  
Old 09-05-2008, 02:51 AM
Amenadiel's Avatar
Amenadiel Amenadiel is offline
 
Join Date: Sep 2006
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by z4media View Post
Hello

I?am very intersted in this modification, but there is no howto.

Please explain the implementation of this mod.

Where do i put the code in the class_core.php, btw. in which line ?

thx

Flo
Quote:
Originally Posted by mayanks View Post
thanks for it...could you please provide a small tutorial on how to do it?


1.- open includes/class_core.php

2.- find
Code:
$this->querycount++;
(should be line 406)

3.- after that, add
Code:
               $shared_tables = Array("user","useractivation","userban","usertitle","userchangelog","usertextfield","userfield","usergroup","userlist","usernote","profilevisitor","reputation","reputationlevel","spamlog","strikes","pm","pmreceipt","pmtext","avatar","profilefield");

               $main_prefix = "FP_";
               foreach ($shared_tables as $shared_table)
               {
                       $orig = TABLE_PREFIX.$shared_table;
                       $dst  = $main_prefix.$shared_table;

                       $this->sql = str_replace($orig." ",$dst." "  ,$this->sql);
                      $this->sql = str_replace($orig.".",$dst."."  ,$this->sql);
                       $this->sql = str_replace($orig."\r",$dst."\r",$this->sql);
                       $this->sql = str_replace($orig."\n",$dst."\n",$this->sql);
                       $this->sql = str_replace($orig."\t",$dst."\t",$this->sql);

               }
4.- save and close file, upload if you need to
Reply With Quote
  #55  
Old 09-16-2008, 07:12 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now that was a nice short tutorial

Would this work with two different versions of vBulletin? Say for example a 3.6.x and a 3.7.x site?

I assume that this would not cause major impacts with upgrading as long as we remember to update the core file again?

I wonder what the chances are that vBulletin could do something as a standard feature in vBulletin as I always wondered what the master and slave setting were for in the config.php file but honestly I never really had the time to investigate.

I will have to look at this code more and give it a try on one of my test boards and if it works I may need to buy some more vBulletin licenses!
Reply With Quote
  #56  
Old 09-26-2008, 11:40 AM
King Justice King Justice is offline
 
Join Date: Apr 2006
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi there.

Is this working on the latest version of vB? This will work with two different databases right, basically sharing one database's vB users?
Reply With Quote
  #57  
Old 10-02-2008, 07:08 AM
Kaelon's Avatar
Kaelon Kaelon is offline
 
Join Date: Jan 2002
Posts: 405
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I also wanted to share my Who's Online data (so that users showing up as logged in on one forum also appear as logged in on the other), is there anything I should be concerned about before just sharing those tables?
Reply With Quote
  #58  
Old 10-02-2008, 08:17 AM
myown myown is offline
 
Join Date: Jan 2007
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great hack will use at some point.
Reply With Quote
  #59  
Old 11-10-2008, 05:45 AM
chikkoo chikkoo is offline
 
Join Date: Mar 2005
Posts: 223
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been looking for such a mod to merge my two forums database, I will give a try and let everyone know the performance.
Reply With Quote
  #60  
Old 11-11-2008, 08:21 AM
gibgib gibgib is offline
 
Join Date: Nov 2003
Location: Maroochydore, Australia
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've read this thread 4 times, all 4 pages & I can't seem to get the slave board to grab anything from the main.
The main forum has no prefix in it's tables so I have used the following:

Code:
$shared_tables = Array("user","useractivation","userban","usertitle","userchangelog","usertextfield","userfield","usergroup","userlist","usernote","profilevisitor","reputation","reputationlevel","spamlog","strikes","pm","pmreceipt","pmtext","avatar","profilefield");

               $main_prefix = "";
               foreach ($shared_tables as $shared_table)
               {
                       $orig = TABLE_PREFIX.$shared_table;
                       $dst  = $main_prefix.$shared_table;

                       $this->sql = str_replace($orig." ",$dst." "  ,$this->sql);
                      $this->sql = str_replace($orig.".",$dst."."  ,$this->sql);
                       $this->sql = str_replace($orig."\r",$dst."\r",$this->sql);
                       $this->sql = str_replace($orig."\n",$dst."\n",$this->sql);
                       $this->sql = str_replace($orig."\t",$dst."\t",$this->sql);
$main_prefix = "";
I also tried
$main_prefix = ".";
&
$main_prefix = " ";

The new forum has yf_ as prefix which I had entered into the config.php before install.
Same database.
Is there a setting within the config.php that could be affecting the class_core.php mod?
I'm refreshing the member list on the new forum to check it's working. I should see it go from 1 member to 12,447 members to mirror the main forum right?
Reply With Quote
  #61  
Old 11-16-2008, 11:15 AM
merk_aus merk_aus is offline
 
Join Date: Feb 2008
Location: Australia
Posts: 582
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have the same problem my main forum does not use table prefix what can we edit to have it so that members can log into the second board - all i would like is the users shared nothing else.

Please anyhelp would be appreciated.
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 04:08 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.04752 seconds
  • Memory Usage 2,315KB
  • 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
  • (2)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