• Welcome to Simple Machines Community Forum. Please login or sign up.
November 26, 2021, 09:41:40 PM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Share user database for 2 (or more) different forums.

Started by Spaceman-Spiff, September 03, 2004, 09:14:44 PM

Previous topic - Next topic

Arantor

Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
No good deed goes unpunished
All helpful urges should be circumvented

Hj Ahmad Rasyid Hj Ismail

Quote from: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Great. Can somebody make this for SMF 2.0 RC?

Arantor

Right, so did you read my comments about membergroups?

Are you having the exact same membergroups in all forums and giving users the same permissions in all forums or what?


Oh, and which RC, there's been 5... (RC1, RC1-1, RC1.2, RC2, RC3)
No good deed goes unpunished
All helpful urges should be circumvented

Hj Ahmad Rasyid Hj Ismail

Quote from: Arantor on March 10, 2010, 06:32:08 AM
Right, so did you read my comments about membergroups?

Are you having the exact same membergroups in all forums and giving users the same permissions in all forums or what?


Oh, and which RC, there's been 5... (RC1, RC1-1, RC1.2, RC2, RC3)
I did. I was just hoping to see somebody do it on 2.0 RC (now is 3) and see how wonderful it works.

However, playing with database like this is not advisable for me myself or others like me (newbies). I prefer a safer mod like Multiple Forum Mod or even Shared Forum Mod. It is just not worth a try and end up ruining a good running forum. Unless, you are merely just trying.

I say it is a hard work but worth it for for web programmers and developers. I will have to say no to mod like this and avoid this.

If I even try doing, I will try the first page suggestion. It seems safer to me.

gitchuone

Quote from: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.

EDIT: Corrected a couple of typos.

So far this has worked great for me on 2.0 RC2.

I also shared the membergoups.

testing continues.

Rawn

I'm also doing this, I've shared everything across 5 installs (multi-MMO community). I'm going back now and redoing it, trying to separate out:

ID_GROUP
realName
personalText
signature
avatar
usertitle
additionalGroups
ID_POST_GROUP

I'll post how it goes =)

Arantor

Just a few comments:
avatar column relates to avatar-by-URL or from gallery, not normally to uploaded avatars (which is the attachments table)

Matching up the groups is fine - provided you do something with the membergroups table too, because there will be overlaps, and you will basically have to share that table because otherwise you're going to have overwrites and permission drops when groups change for a user.
No good deed goes unpunished
All helpful urges should be circumvented

CairX

Quote from: Rawn on March 14, 2010, 08:54:58 PM
I'm also doing this, I've shared everything across 5 installs (multi-MMO community). I'm going back now and redoing it, trying to separate out:

ID_GROUP
realName
personalText
signature
avatar
usertitle
additionalGroups
ID_POST_GROUP

I'll post how it goes =)

I'm also looking for some way to filter out rows from a table.
However I'm not very familiar with MySQL, but when you create a VIEW you can't add more variables/rows.
Maybe someone could fill me in with info about that?

If you can't do it that way, is there a "simple" way to do it in some files without making to much change?

Arantor

QuoteIf you can't do it that way, is there a "simple" way to do it in some files without making to much change?

Short answer is no. SMF's schema is just not designed for this.
No good deed goes unpunished
All helpful urges should be circumvented

CairX

Quote from: Arantor on March 22, 2010, 07:45:18 PM
QuoteIf you can't do it that way, is there a "simple" way to do it in some files without making to much change?

Short answer is no. SMF's schema is just not designed for this.
Not a happy answer but yet an answer, Thank you  :)

Arantor

This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(
No good deed goes unpunished
All helpful urges should be circumvented

mkmeister

Quote from: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(

Also, it might be difficult to pull off and still make everyone happy. It's fairly obvious from this thread there are many different things people want in this kind of system and they all don't necessarily agree.

Arantor

The only way to do it to make everyone actually happy is to redesign the schema from scratch specifically to allow for it.
No good deed goes unpunished
All helpful urges should be circumvented

Hj Ahmad Rasyid Hj Ismail

Quote from: Arantor on March 24, 2010, 10:45:50 AM
The only way to do it to make everyone actually happy is to redesign the schema from scratch specifically to allow for it.
Oh... That is hardwork. By the way, will they do that?

mkmeister

I imagine that would break a LOT of mods if the schema was completely redesigned like that, considering v2 is right on the doorstep.

I could see a version 3 though... hmmm...

Arantor

Won't happen in 2.0 AT ALL. Hence the term feature locked as is made quite clear in the Feature Requests board.

I see possibly minor changes to it in 2.1 but an overhaul generally in 3.0. I don't see it being capable of this out of the box though.
No good deed goes unpunished
All helpful urges should be circumvented

Mr. Doug

I've got 4 sites that I want to share a user database for. All are on the same server, so that part isn't hard. I'm wondering if it wouldn't be easier to start an OpenID server that I host locally to accomplish the same thing.

Am I close here, or should I be looking at a different implementation?

(I also need to convert about 25,000 members from PHPbb3, but that's a whole different story.
--
Doug Hardman
doug (at) puttertalk (dot) com

Mr. Doug

March 27, 2010, 04:36:02 PM #297 Last Edit: March 27, 2010, 04:44:40 PM by Mr. Doug
I tried this today, and the result is that forumA still works fine, but forumB does not. I'm thinking that this has something to do with a fresh install, vs. an upgrade from 1.1.X (I'm using RC3 in both)

Thoughts?

ForumA works fine in every way. Forum B won't show anything other than "Please try again. If you come back to this error screen, report the error to an administrator."
--
Doug Hardman
doug (at) puttertalk (dot) com

Hj Ahmad Rasyid Hj Ismail

Though, I am very afraid to try this "MySQL things" at first glance, I actually did try this on SMF 2.0 RC3 when i read it is noted as being successful. It really works. I also shared membergroups.

I later noticed that problem with avatar and attachments can be resolved IMHO if we point avatar URL & PATH to one main site for keeping avatar & attachment files. At the same time, share the avatar / attachment table using this tips.

I didnt try this yet but is this possible Arantor?

Mr. Doug

Update: I'm a dumb-a$$

I was working with a backup that was named the same. So of COURSE the update worked for one and not the other...the DB was from the 1.1 structure, and not 2.0. (It was also about 2 years old) I noticed that the forum only had 1,800 members. We have about 11,000 now...so I was all bent that it was messing things up there too.

OK...I'll try this again in a bit and report the results.
--
Doug Hardman
doug (at) puttertalk (dot) com

Advertisement: