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
  #42  
Old 08-04-2008, 12:48 AM
rsuplido rsuplido is offline
 
Join Date: May 2002
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mangel.ajo View Post
Uhh, I have to check that.

For me it's working:

If I search here for "pruebecita" it works
http://www.economiahoy.es/foro/search.php

this forum is using the user database from:

http://www.foropymes.es/foro/

Could you give some details of your problem?
It seems like when it is set to FULLSEARCH it doesn't work. I decided to use the key words option and it works now.
Reply With Quote
  #43  
Old 08-04-2008, 01:12 AM
ps2wiz ps2wiz is offline
 
Join Date: Apr 2005
Posts: 217
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rsuplido View Post
Store the avatars back to the database and add 'customavatar' to the list.
Thank you very much, that did the trick.
Reply With Quote
  #44  
Old 08-04-2008, 01:28 AM
lovevn lovevn is offline
 
Join Date: May 2004
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works well but I have some problems:
-Private message text is broken in the slave board.
-User's title is broken in the slave board.
-signature is broken in the slave board

My board is using utf-8 charset(vietnamese languages)
Reply With Quote
  #45  
Old 08-04-2008, 06:54 AM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ps2wiz View Post
I got it up and running and every thing seems to function perfect besides one thing.

I store my avatars on disk (file system) instead of the database storage. Anyone know how to properly link this? I am scratching my head on this, as avatars do not show up.
Yes, that's one of the things that cannot be used with this patch "directly"

If you can enter the machine as root you could make a hard-link from the secondary forum avatars directory to the main one using "ln" (I'm assuming it's a U*IX/Linux machine)
Reply With Quote
  #46  
Old 08-04-2008, 06:56 AM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello loven!

That seems strange since str_replace shouldn't affect the strings encoding.

Could you please check if both forums are running using the same encoding? The problem could be there...

Could you provide the urls for us to test?


Quote:
Originally Posted by lovevn View Post
It works well but I have some problems:
-Private message text is broken in the slave board.
-User's title is broken in the slave board.
-signature is broken in the slave board

My board is using utf-8 charset(vietnamese languages)
Reply With Quote
  #47  
Old 08-04-2008, 09:04 AM
lovevn lovevn is offline
 
Join Date: May 2004
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mangel.ajo View Post
Hello loven!

That seems strange since str_replace shouldn't affect the strings encoding.

Could you please check if both forums are running using the same encoding? The problem could be there...

Could you provide the urls for us to test?
Hello
Thanks for your reply.
Both forums are running the same ecodeing. However, in my main board
I turn this off

Quote:
$config['Mysqli']['charset'] = 'utf8';
And on my slave board(which is vbulletin chinese version) it is on.

I try to turn this off on the slave board but I got some error.

Could you tell me how to fix on this case?

Thanks again
Reply With Quote
  #48  
Old 08-04-2008, 09:41 PM
ps2wiz ps2wiz is offline
 
Join Date: Apr 2005
Posts: 217
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mangel.ajo View Post
Yes, that's one of the things that cannot be used with this patch "directly"

If you can enter the machine as root you could make a hard-link from the secondary forum avatars directory to the main one using "ln" (I'm assuming it's a U*IX/Linux machine)
Yeah, I just transferred them back into the database and added "customavatar" to the list of shared tables.

I also let people host their signature pics on my forum. So I also added "sigpic" to the list of shared tables.
Reply With Quote
  #49  
Old 08-19-2008, 03:02 AM
ps2wiz ps2wiz is offline
 
Join Date: Apr 2005
Posts: 217
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also, I figured if both board share the same PMs, then why not visitor messages too?

Just add:

"visitormessage","visitormessage_hash"

And you are good to go
Reply With Quote
  #50  
Old 08-26-2008, 02:09 AM
Zate Zate is offline
 
Join Date: Apr 2003
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Interesting way of doing it.

we've been running shared users for about 3+ years now and it has some minor "issues".. we initially did ours with PHP edits, then eventually by static links.. works well but has some issues with groups not updating sometimes. Currently looking at what modifications I'd need to make the functions affecting registration, changing password, changing username, changing email address... ideally i'd love to just share username, password and email address, and nothing else. Much to do.
Reply With Quote
  #51  
Old 09-02-2008, 01:54 PM
z4media z4media is offline
 
Join Date: Sep 2007
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 03:50 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.04795 seconds
  • Memory Usage 2,321KB
  • 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
  • (1)bbcode_code
  • (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