vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Shared user database for multiple forums, same server (https://vborg.vbsupport.ru/showthread.php?t=98233)

CyberRanger 10-13-2005 02:36 PM

Quote:

Originally Posted by boostedsti
What about Subscriptions are those per user or per board?

Subscriptions to forums and threads would be by board. However, settings like always getting an email to a thread you start would be by user. The trick is looking at what is in the user table. That determines if the setting is by board or by user. For example, since the custom title is in the user table, it will be the same on both forums. (It cannot be different). Same for the user's signature. Since signature is in the usertextfield table (a shared table) it will be the same for both forums.
Quote:

Originally Posted by boostedsti
Also is that a backup copy you are using or is it really live?
Reason I ask is

Stats: Armchairgeneral
Threads: 1, Posts: 1, Members: 7,631
Welcome to our newest member, vernon.miles

Stats:strategyzoneonline
Threads: 32,469, Posts: 421,417, Members: 7,637
Welcome to our newest member, josephhnewkirk

Great question! It's live! Each forum has it's own stats table so one can see the threads and posts separately for each table. The user number will be off until the nightly cron runs that updates the user count. Some weird effects here but if you dig through the tables and the code it makes sense.
Quote:

Originally Posted by boostedsti
Either way I'm digging script.
Your sites are pretty sweet too.

Thanks!

CyberRanger 10-13-2005 02:37 PM

Quote:

Originally Posted by goyo
Great hack...

Now only if we could use separate servers for this... :nervous:

Yes, that would be great but ... that's an entirely different beast! :nervous:

CyberRanger 10-13-2005 02:41 PM

Quote:

Originally Posted by Bad Bunny
What transfers with the character to both forums? All of their setting and profile (including profile pic and avatar)? Some of it? None of it?

Ideally it would seem to me you would have password and email the same while everything was per site.

Anything that is in the user* tables is shared between the sites. So, email, sig, custom title, etc. Avatars are trickier. Since the avatar field is in user, the user will have the same avatar number for each site. However, the avatar table is not shared so ... he could have a different avatar on each site. However, he could really only control what one of them looks like! If the user has a custom avatar, he could actually control what is displayed on each site. I guess ideally the avatar table should also be shared.

CyberRanger 10-13-2005 02:43 PM

Quote:

Originally Posted by GoTTi
can u clear up number 8 for me. i dont understand what u mean...

before i start on a hack or modification i like to know exactly whats goin on...

this has nothing to do with posts right? just user login?

The posts and threads are not impacted at all. Only the user* tables, strike, and pm* tables are shared. (I'll clear up #8 in a bit!)

Bad Bunny 10-13-2005 04:37 PM

The only real use I would have for this is if it totally ran like 2 distinct forums that only shared the core user information (username, password, & email).

CyberRanger 10-13-2005 06:21 PM

Quote:

Originally Posted by Bad Bunny
The only real use I would have for this is if it totally ran like 2 distinct forums that only shared the core user information (username, password, & email).

That would be very hard to do given the current database layout.

Paul M 10-13-2005 06:48 PM

I might be more useful if you actually created a second prefix (TABLE_PREFIX_USERS) and used this, rather than removing the prefix - most people use a prefix for a reason. :)

CyberRanger 10-13-2005 07:47 PM

Quote:

Originally Posted by Paul M
I might be more useful if you actually created a second prefix (TABLE_PREFIX_USERS) and used this, rather than removing the prefix - most people use a prefix for a reason. :)

Yes, absolutely. You may have noticed that in my "find and replace" commands I didn't totally remove TABLE_PREFIX. Instead, where the code reads " . TABLE_PREFIX . ", I replaced that with "." One could easily substitute anything else where the dot is between the quotes. Also, if you need to go back and replace TABLE_PREFIX, you could do a "find-replace" on say ["."user] replace with [". SHARED_TABLE_PREFIX . "user].

lanas 10-17-2005 07:57 AM

On a Linux/Unix machine, you can use this script

Code:

# !/bin/bash
# Replace a text inside all files of current dir
# Customize $a and $b variables

# text to search
a='TABLE_PREFIX . "user';

# text to replace
b='USER_PREFIX . TABLE_PREFIX . "user';

for i in `grep -lr $a`
 do
  echo $i;
  mv $i $i~
  sed -e "s/$a/$b/g" $i~ > $i
  rm $i~
done

Run this script from the forum root 4 times: one for "user" (as above), one for "cp", one for "pm", and one for "custom".

Of course, you still need to manually modify the scripts that use a variable like $table instead of 'user[...]' (and stuff), as stated in first post, adding USER_PREFIX where needed, and insert somewhere your definition (I inserted it in class_core.php, just below the TABLE_PREFIX one).
I also noticed a lack in the first post: if you want to also keep avatar images, you should modify image.php in line 129, adding as usual "USER_PREFIX . " before TABLE_PREFIX.

CyberRanger 10-19-2005 12:53 PM

Handy little script. Note that when you run it you should be logged as the web server user. The file's owner and group will get changed to whoever you run the script as. Also, the files will have the permissions changed to whatever that users umask is set to, which will probably be 644 and okay.

I also had to change:
Code:

for i in `grep -lr $a`
to:
Code:

for i in `grep -lr $a *`
for it to run on my Suse system.


All times are GMT. The time now is 12:06 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.01413 seconds
  • Memory Usage 1,749KB
  • 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
  • (3)bbcode_code_printable
  • (8)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
  • (10)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