Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

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
  #12  
Old 07-11-2008, 09:16 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Session is useful only if it's for different forums from the same site. It will avoid double login and keep who's online synchronized.

In the example above, I remembered that I had to do those 2 changes also (version 3.60) since they appeared to be independent from class_core

Quote:
In adminfunctions.php print_delete_confirmation you also need to specify the below (insert it somewhere) or it will switch to default and you will not be able to delete any usergroups. (I don't use prefixes so I have " . ")



case 'usergroup':
$item = $vbulletin->db->query_first("
SELECT usergroupid, title
FROM " . "usergroup
WHERE usergroupid = '" . $vbulletin->db->escape_string($itemid) . "'
");
break;

also in functions.php copy function fetch_query_sql into function fetch_query_sql2 . alter that copy by replacing the 2 instances of " . TABLE_PREFIX . to reflect your master prefix.

Then in usergroup.php call that fetch_query_sql2 instead of fetch_query_sql (many instances)
Reply With Quote
  #13  
Old 07-11-2008, 09:23 PM
Q-v-n-s-Q Q-v-n-s-Q is offline
 
Join Date: Mar 2005
Posts: 289
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice, thank you
Reply With Quote
  #14  
Old 07-11-2008, 09:42 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mangel.ajo View Post
Hmmm, if database can gives us that functionality it could be interesting because we wouldn't need to patch at all.

Can you point us to some document about mysql5 views?

How do you setup a view?

Greetings,
Miguel ?ngel.
I gave a more concrete example in this thread.
Reply With Quote
  #15  
Old 07-11-2008, 09:46 PM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lionel View Post
Session is useful only if it's for different forums from the same site. It will avoid double login and keep who's online synchronized.
Yes, for the same site it's ok. In my config I have different domain names. So I should keep session table independently

[QUOTE]

Quote:
Originally Posted by Lionel View Post
In the example above, I remembered that I had to do those 2 changes also (version 3.60) since they appeared to be independent from class_core
I have tried to create/delete a usergroup from admincp in the secondary forum, and it worked fine, so I suppose that this change is not needed anymore (at least for 3.7.2PL1) :-)

Thanks Lionel!
Reply With Quote
  #16  
Old 07-11-2008, 09:52 PM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I doubt if those tables are safe to be shared: "reputation","spamlog"

They point to postid, and probably they would only mess. What do you think about that? Should I take them out?
Reply With Quote
  #17  
Old 07-11-2008, 09:56 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I never used "reputation" and "spamlog" in the other integration 3.07 => 3.60 from 2 years ago.
Reply With Quote
  #18  
Old 07-11-2008, 11:34 PM
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Location: Australia
Posts: 2,469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will just be duplicate content in search engines. If you think this is going to give you extra exposure your right, however at what cost? getting dropped from the search engines.

There is need for this tho, and only in some situations, eg. maybe you got a support board that is for registered users only and you have a few websites, then that would be useful.

Thanks for sharing, I do look forward to seeing this progress, however I currently don't have that need for it like some sites do. Just for the other sites who think great I can now have several domains but with the same forums showing, this is a really bad idea.
Reply With Quote
  #19  
Old 07-12-2008, 07:25 AM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hornstar1337 View Post
This will just be duplicate content in search engines. If you think this is going to give you extra exposure your right, however at what cost?
Code:
User-Agent: * 
Disallow: /forum/memberlist.php
Disallow: /forum/member.php
What I want is not to get my members indexed, the real intention of this patch is to make my users life easier to move between forums.

Greetings honstar1337!
Reply With Quote
  #20  
Old 07-12-2008, 10:18 PM
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Location: Australia
Posts: 2,469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mangel.ajo View Post
Code:
User-Agent: * 
Disallow: /forum/memberlist.php
Disallow: /forum/member.php
What I want is not to get my members indexed, the real intention of this patch is to make my users life easier to move between forums.

Greetings honstar1337!
I must have been really tired when I made that post lol. I can now see a much larger purpose for this mod. (I was thinking something much different yesterday lol).

I might actually end up using this afterall. Thanks.
Reply With Quote
  #21  
Old 07-13-2008, 02:00 AM
Super Jinni Super Jinni is offline
 
Join Date: Mar 2008
Posts: 437
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is really interesting and something that I was thinking about since a while..

I'm gonna keep an eye on this, and maybe I'm gonna use it soon for some reason

thanks for sharing man

best regards

Reply With Quote
Reply

Thread Tools

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:41 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.07470 seconds
  • Memory Usage 2,312KB
  • 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
  • (3)bbcode_code
  • (6)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
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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