vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Major Additions - Share users database among many forums (https://vborg.vbsupport.ru/showthread.php?t=185021)

Chunky Monkey 12-18-2008 08:18 PM

Can I somehow allow guests to view forums on installation B that guests are prevented from viewing on installation A? If so, how? Also, can I prevent other forums that exist at installation A from showing up at installation B?

Installation B's purpose will be to allow guests at domain B access to forums that are restricted on installation A at domain A. They should have the same users, same posts, etc. How can I accomplish this?

Thank you!

goncalo 12-19-2008 03:12 AM

Quote:

Originally Posted by SirAdrian (Post 1573059)
Another (similar) solution is to use MySQL 5's views.

(Example: db2.user is a view of db1.user)

Thank you very much SirAdrian, and congratulations, your solution is great, it took me a couple of hours to make it work.

Congratulations also of course to Mangel.ajo and all you guys that try to improve VBulletin and help each others.

Your solution was good also but I prefered the VIEW one suggested by SirAdrian. Why?

The View option is great, in spite of being also a php programmer, I didn't know that MySQL already had it, it's really great, it's like a way to make a symbolic link to another table.

I don't like changing my code, specially because one day I'ld need to reinstall it again and would forget to make all the updates, with the View option it's very easy, and I noticed it's an option that you are ignoring although it's a great one.

I didn't change any code and have now 2 forums working as one.

What have I done?

- First search all users on my forum b to check if they existed on forum A or not, and if so, correct the situation.
- When I had all users different somehow (small forums I had only to change 5 users that didn't post for over 1 year), I ran a small php script to add all those users one by one on the new forum updating user, usertextfield, userfield fields, the ones that are created with each new user.
- Then I ran a script to find to which userid on the new forum each user on the old forum had.
- Now, changed the user and userfield and usertextfield tables to something like "old_user", and creating a new VIEW for each of those 3 tables pointing them to the same tables on the new forum.

From that moment one, it was done. All users signing up would be added to the new forum user table, and each user signing up on the new forum would be able to login to the old forum as well (signing on forum A and logging to B), because they all shared the same database.

This without changing any code.

But now there are stuff que needs to be done, you have lots of tables there that needed to be changed here also. For each table that we want to be used on the new forum (forum A) you need to rename the table do "old_" and creating a view to the new forum database, so that all those tables are ran on the new forum. I've did this for over 20 tables, like smilies, user reputations, usergroup, many tables that I wanted to be using the new forum.

Even the pm table are duplicated now, the 2 forums with separated private messages, but I'll do the same to those, so that all pm's go to the same database.

Having this done, only one thing was left, obviously, the usernames were all mixed up on the old forum, where their usernames changed so the posts appear with the wrong author.

So as we already had the table showing each user's old and new id, something like:
$olduseridbpt['572']=1027;//Old user 572 is now 1027;
We just need the script to have an update userid query on each table saying that the old user will be the new one, with a simple script (carefull that if the user 100 changes to 80, and then the 80 changes to 200, two users instead of one will have the same number which is bad).

Then we run this process in all tables that have a record and that user's userid or fromuserid (pmtext), receiptto, from, etc. I've done this in seconds with php scripts, on these tables:
threadpost,threadrate,pollvote,post,posthash,pm,pm receipt,pm,pmtext,moderator,moderatorlog,customava tar,customprofilepic,useractivation,subscribeforum ,subscribethread,administrator,attachmenteditlog,s igparsed,userlist,userlistrelationid.

All the tables that had the old user id's were now updated. Now everything is at 100%.

Took me only a couple of hours to program the scripts to make the users update on the tables, create views, test databases, etc, without changing any of the VBulletin code.

The old forum treats the views as they were on its own database so everything is perfect without changing any code.

If you have 2 new forums, it would take minutes! Just change about 20 tables that you want on forum A instead of B after installing forum B, make their views, without changing any code, and it's working perfectly in minutes, and you can reinstall vbulletin many times without having to update anything. All this with views.

I don't mix the session table with a view because there are forum-specific fields there like "inthread" which tell the users in which thread they are, and also I didn't put as a view the datastore table which shows things like how many users ate in a forum, those need to be separated.

Anyway many thanks for this thread, and to SirArthur also, which saved me a lot of time with a simple tip and I wanted to share this with others, because I hate changing code.

Chunky Monkey 12-20-2008 07:07 PM

Can this mod be made so that the two installations of vb can share forums with different forums having different permissions at each installtion?

Thanks!

gibgib 12-21-2008 01:18 AM

Brass monkey,
chunky,
the funky monkey,

I am having problems getting Admins on install A to be admins on install B. I'm OK as member 1 & un-editable in the config.php file. Already tried adding a new admin usergroup on install B.
Still experimenting though!

Be careful with housekeeping on the install B, eg if you have not set any ranks, usertitles, etc on install B to match A & execute rebuild member titles & ranks on install B control panel, you will lose member data. There's probably a few hidden problems like this.
Anything to do with shared tables I am using the install A control panel for now.

merk_aus 01-02-2009 02:42 PM

ok i had this working on my forum but it got hacked and i had to begin again and now it doesnt seem to work with the forum prefix?

gibgib 01-06-2009 03:39 AM

Quote:

Originally Posted by merk_aus (Post 1699329)
ok i had this working on my forum but it got hacked and i had to begin again and now it doesnt seem to work with the forum prefix?

Don't underestimate the power of the "i"
If you have mysqli as db type in the config file on the second forum this mod doesn't work. Make it "mysql"

Has anyone upgraded a forum or all forums with this mod working?
I'm tempted to remove the added lines while I upgrade each forum to 3.7 then add the lines back in afterwards.
Thoughts?

gibgib 01-25-2009 08:05 AM

Has anyone upgraded to 3.8 on one, or all of the shared forums as yet?
Any hiccups?

tiekie 01-25-2009 11:31 AM

how safe and secure is this?

ps2wiz 02-12-2009 05:00 PM

Quote:

Originally Posted by gibgib (Post 1678939)
Got it to work!!

This mod WILL NOT work if you have the database type on the subsequent forums set to 'mysqli' in the config.php. Change it to 'mysql'.
Hope that saves some pulling of hair out of your noggin :)


Starting pulling my hair out, until I found this post.

Thanks!

ROTPAR 02-27-2009 10:45 AM

can anyone please give me a detailed step by step introduction, how to make this work ? I understand some basics but I am not a coder ;) Thank you in advance

ROTPAR 03-02-2009 01:59 PM

Ok I got it working BUT I have 2 questions.

1.) Forum B does not show the registerd members in the forums statistics (bottom of the forums homepage)

2.) How can I show all online members on both forums. I want to show all current online members who are online on both forums.

ROTPAR 03-04-2009 09:07 AM

come on guys, nobody who can help me with this little detail ?

ROTPAR 03-05-2009 07:02 AM

bump

merk_aus 03-31-2009 02:36 AM

not working in the vb3.8.x - to extend on this it always comes up with a database error no matter what you try

gibgib 04-21-2009 10:15 AM

<font color="Blue">"56 installs"</font> so has anyone else successfully upgraded to 3.8 with 2 forums on one database?
If so, how did you go about it & does everything work as it did with 3.7?

kderentz 05-14-2009 04:53 PM

I took the mod out as it was working but I felt the unknow for the long term effects where too much of a hassle

gibgib 05-22-2009 10:29 AM

I intended on basing 3 sites off the one database permanently but I may need to re think if I want to upgrade vb versions.

timegate 06-15-2009 07:00 PM

Quote:

Originally Posted by merk_aus (Post 1780776)
not working in the vb3.8.x - to extend on this it always comes up with a database error no matter what you try

This modification only works in version 3.7.x? Does anyone know why it doesn't it work in 3.8.x? Thanks in advance!

Lionel 06-15-2009 07:12 PM

Yesterday I just integrated it with two 3.83 install

timegate 06-15-2009 07:15 PM

Quote:

Originally Posted by Lionel (Post 1830279)
Yesterday I just integrated it with two 3.83 install

And it works then? Did you have to make any modifications to the code to get it to work?

Lionel 06-15-2009 07:27 PM

none whatsoever. I only added sessions since the 2 forums are on same site so there was no need to re-login

webgroup 06-16-2009 10:17 PM

Im using 3.8.2, installed and worked like a charm the first time!
Thanks!!

webgroup 06-16-2009 10:18 PM

Quote:

Originally Posted by ROTPAR (Post 1758512)
Ok I got it working BUT I have 2 questions.

1.) Forum B does not show the registerd members in the forums statistics (bottom of the forums homepage)

2.) How can I show all online members on both forums. I want to show all current online members who are online on both forums.


MIne show registered users fine!
What I dont see is the current only users, I would like to be able to show it.

StonePilot 06-17-2009 08:12 AM

I would love to use this but I would have to be very caution when upgrading. Once I go down this road I would build the functioanlity of the site around the idea of a single login ability ... sign-up for one site and you're a member to all sites. Not sure what to think about that actually.

webgroup 06-17-2009 11:33 PM

Quote:

Originally Posted by Datenpapst (Post 1574271)
Hi,
is it possible that maybe some forums like off topic or so can also be used by more than 1 forum?

I need to know this too

Quote:

Originally Posted by Chunky Monkey (Post 1688237)
Can I somehow allow guests to view forums on installation B that guests are prevented from viewing on installation A? If so, how? Also, can I prevent other forums that exist at installation A from showing up at installation B?

Installation B's purpose will be to allow guests at domain B access to forums that are restricted on installation A at domain A. They should have the same users, same posts, etc. How can I accomplish this?

Thank you!

I need to know this too

webgroup 06-18-2009 12:02 AM

Quote:

Originally Posted by ROTPAR (Post 1758512)
Ok I got it working BUT I have 2 questions.

1.) Forum B does not show the registerd members in the forums statistics (bottom of the forums homepage)

2.) How can I show all online members on both forums. I want to show all current online members who are online on both forums.



Just add the "session" table to the list of shared tables.

webgroup 06-18-2009 12:07 AM

Quote:

Originally Posted by Datenpapst (Post 1574271)
Hi,
is it possible that maybe some forums like off topic or so can also be used by more than 1 forum?

I need to know this too

Quote:

Originally Posted by Chunky Monkey (Post 1688237)
Can I somehow allow guests to view forums on installation B that guests are prevented from viewing on installation A? If so, how? Also, can I prevent other forums that exist at installation A from showing up at installation B?

Installation B's purpose will be to allow guests at domain B access to forums that are restricted on installation A at domain A. They should have the same users, same posts, etc. How can I accomplish this?

Thank you!

I need to know this too


ALSO, I do not want to share the avatars or profile pictures.
I removed both the "avatar","profilefield" from the list of shared tables, still avatars and profile pictures are getting affected.

Both websites have custom avatars set to use DISK, not DB, but when you change the avatr in one website, it affects the avatar in the other website.

Can somebody explain me how to fix this?

AND the users signatures too, I dont want to share the signatures, is there any way to avoid it?

Thanks!

UPDATE: A "fix" for the avatar/picture profile issue, is to have the avatars in the "forumB" set to use DB storage.
Even when it do not makes sense to me why the problem was happening if I removed the "avatars" table from the shared table list.

Lionel 06-18-2009 07:17 AM

Quote:

Originally Posted by ROTPAR (Post 1758512)

1.) Forum B does not show the registerd members in the forums statistics (bottom of the forums homepage)

Showing the stats will not be possible, unless you do an Admicp => Maintenance=> Update counter => Username.

This is because that info is coming from the datastore which is not shared by the 2 installs, and is not recommended to share.

When you update the counter, you just rebuild the datastore for the appropriate forum. But that could be a pain to do once in a while ....

Lionel 06-18-2009 07:29 AM

you could also try to create a plugin at forumhome_start and put this in it (will add a query)

PHP Code:

require_once(DIR '/includes/functions_databuild.php');
build_user_statistics(); 

That will update the datastore and you'll be able to display stats

webgroup 06-18-2009 05:17 PM

Could anybody help with my questions?

Thanks

gibgib 06-21-2009 07:00 AM

Great to see some activity in this thread.
After reading what has been posted I might attempt vb 3.8

webgroup 06-24-2009 04:27 AM

still need to know how not to share the user signatures

deepblue 06-29-2009 03:28 PM

Can anyone tell me where i can find what the name of the main forum prefix is for forums A? I am unsure where to look.

webgroup 06-30-2009 07:52 AM

Quote:

Originally Posted by deepblue (Post 1839642)
Can anyone tell me where i can find what the name of the main forum prefix is for forums A? I am unsure where to look.


look at your config.php file, where the DB info is, there you can see what prefix you are using.

deepblue 06-30-2009 03:52 PM

Quote:

Originally Posted by webgroup (Post 1840053)
look at your config.php file, where the DB info is, there you can see what prefix you are using.

Thanks, I was able to find that information. However i dont seem be able to get the mod working. I have 2 different licenses on the same server. They are using two different databases at the moment , neither of which have a table prefix on them, its just ''. Ive tried using the same name that the main forum uses for the slave forum, howver i get a database error when i try that. I think i may be doing something wrong. Any help would be great.
Thanks.

webgroup 07-01-2009 05:49 AM

for this to work, you need to use 1 DB
That 1 DB will contatin the 2(or whatever) forums, each forum with a different table prefix
So the DB will have a duplicate of each table, one for each forum.

If neither of your forums use table prefix, you must set one before, you can use the install/tableprefix.php script to change your prefixes on the vB table. Just run it from the browser.

Be sure to also make the appropriate change to config.php.

Then you will have to merge your 2 DB's into 1
Then you apply this hack.

webgroup 07-05-2009 04:58 PM

still waiting for an idea on how to avoid sharing the signatures.

thanks

Shadawg 07-12-2009 01:43 AM

Having one problem with this, if a user joins forum a, they are added to the total member list in forum b, but if a member joins forum b, they are not added to forum a.....

how can i fix this?

Wilfred1 07-19-2009 02:15 AM

This is a godsend and would like to do some testing firstly on the "mySQL Views" option so does anyone have any idea what the source_db syntax would be in the following code for the user table located in a separate db with a different IP Address, db name, dba_username and password but both db's on the same server?

Code:

CREATE VIEW user as
    SELECT * FROM source_db.user;

Secondly with the table prefix concept here would the addition of this mod:
https://vborg.vbsupport.ru/showthread.php?t=211100
help so a user doesn't have to login at both domains?

I can see a couple more vb license costs coming up if this works ok

MagicThemeParks 10-13-2009 12:09 PM

I just want to ask a basic question to make sure that I understand this modification. :)

This modification will allow me to take multiple forums (all with separate vB licenses, of course ;) ) and 'link' them with one single database which will allow for my members on Forum "A" to use their same username/password for Forum "B" and Forum "C" automatically?

What are the drawbacks, if any, for using this setup?

This is exactly what I'm looking for and would love for this to work properly for my network of forums that I'm setting up. :up:


All times are GMT. The time now is 01:01 PM.

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.01509 seconds
  • Memory Usage 1,846KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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