Customizing SMF > SMF Coding Discussion
Question about sharing tables
DLD:
ok I have several instances of SMF running (6 total) which were upgraded from yabbse and have been running for some time. I know it is almost imposiable to combine all of them together into one instance of SMF so what I am looking to do is share the member table with all of them so a when a user signs up at one site that user is now signed up for all sites.
If this can be done easily then making a HTML based forum page that has links to the other sites will be easier.
Thanks for any help I can get :)
Oldiesmann:
I'm not sure how easy that would be to do. I guess you could modify Register.php for each site so that when they registered for one site, it would automatically copy the information to the other tables. However, in order for this to work properly, the cookie name has to be the same on each board.
DLD:
I was thinking more on the lines of changing the settings.php so that it would read the same table for all the boards, but I have no idea where to start
The cookies are already he same name :)
Oldiesmann:
Ok. I see what you're saying. Yeah, you could do that, but it would be a pain in the rear. If you do want to do that, here's how:
Go through every file in the sources directory and replace every occurrence of {$db_prefix}members with the name of the table you want to use. This would probably take you at least 20 or 30 minutes, but it can be done. Just make sure you put all the boards in maintenance mode before you do that.
Jack.R.Abbit™:
I think this is what you would really need to do.
1) eliminate/combine all you member tables into one and give them a prefix that is different than all your instances of SMF.
2) find everyplace where SMF is querying the member table (189 times by my count).
3) instead of using the "{$db_prefix}" variable, you would need to use the new prefix you gave your member table.
This should work for sharing member log in info... however, I suspect this will pretty much prevent you from ever doing an upgrade.
I just did this locally and it did work. I renamed my members table to be "smf_shared_members" and then did a search and replace like:
<search>
{$db_prefix}members
</search>
<replace>
smf_shared_members
</replace>
Unfortunately, if you want to use a variable to hold the "shared" prefix, you'll need to examine each file that uses it and locate each function that uses it and add the variable to the globals for that function. That was too much work just to test it so I just hard coded the prefix in.
[edit]I guess I took too long to write that... Oldiesman had it answered long before I did... but at least I can confirm that it works[/edit]
Navigation
[0] Message Index
[#] Next page
Go to full version