Advertisement:

Author Topic: Share user database for 2 (or more) different forums.  (Read 375886 times)

Offline jan0s1k

  • Newbie
  • *
  • Posts: 3
Re: Share user database for 2 (or more) different forums.
« Reply #460 on: May 14, 2012, 06:15:49 PM »
Hey, anyone tried to get to work "Latest member" in 2.0.x? Seems, that none of these methods doesn't work (I tried to make it for my own as well.. but I keep failing :P).

Offline Robert lee

  • Newbie
  • *
  • Posts: 2
Re: Share user database for 2 (or more) different forums.
« Reply #461 on: May 23, 2012, 08:59:53 AM »
First of all, thanks SO much for this publish - it was exactly what I required.  I now have two boards for two sub-domains on the same website using one participant desk, which is just what I desired.  however, I did observe one factor.If someone signs up on one message board, the participant depend instantly contributes another one on,but on the other message board it doesn't and I have to tell it to recall the some.

Offline airtetdotin

  • Semi-Newbie
  • *
  • Posts: 91
    • Follow me on google plus
Re: Share user database for 2 (or more) different forums.
« Reply #462 on: September 17, 2012, 10:04:16 AM »
Hi Anguz

I need your help for Shae db files between two forums
I had installed two forums in separate server and i pointed  two database paths to single one  but only one working
second one gets Connection error.
I have used same table prefix in database
Help Me Please.......!

Offline TomW

  • Jr. Member
  • **
  • Posts: 294
  • Gender: Male
Re: Share user database for 2 (or more) different forums.
« Reply #463 on: November 07, 2012, 04:51:33 PM »
I used the SQL method and it is working well, but have a question about the cookies.  Should I use the same cookie for all of my 3 forums (I am using SMF ver 2.0.2) ?

Offline Herman's Mixen

  • SMF Hero
  • ******
  • Posts: 7,257
    • HermanMixen on Facebook
    • @Hermans_Mixen on Twitter
    • Herman's Mixen
Re: Share user database for 2 (or more) different forums.
« Reply #464 on: November 07, 2012, 10:45:06 PM »
Should I use the same cookie for all of my 3 forums (I am using SMF ver 2.0.2) ?

Yes. You do use the same cookies



@airtetdotin

Anguz is not much around here anymore

forum1 use database prefix smf1_
forum2 use database prefix smf2_
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Offline TomW

  • Jr. Member
  • **
  • Posts: 294
  • Gender: Male
Re: Share user database for 2 (or more) different forums.
« Reply #465 on: November 11, 2012, 12:33:53 AM »
Thank you !

Offline airtetdotin

  • Semi-Newbie
  • *
  • Posts: 91
    • Follow me on google plus
Re: Share user database for 2 (or more) different forums.
« Reply #466 on: December 07, 2012, 06:39:39 AM »
Shared two forums exactly

But the problems is settings and themes

when i change the description of forum1 forum2 changed
theme would be same

Offline Benchapon

  • Newbie
  • *
  • Posts: 2
Re: Share user database for 2 (or more) different forums.
« Reply #467 on: May 10, 2014, 02:48:36 AM »
Thanks ;D

Offline MythikAngel

  • Semi-Newbie
  • *
  • Posts: 23
  • Gender: Male
  • POOTIS POW! HAHA!
    • @HereisIngo on Twitter
Re: Share user database for 2 (or more) different forums.
« Reply #468 on: July 10, 2014, 06:43:45 AM »
Thanks for the tutorial!

It's only a bit outdated {$db_prefix} is now {db_prefix} and im_recipients is now pm_recipients and instant_messages is personal_messages.

And I can't get the cookie to work.

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Share user database for 2 (or more) different forums.
« Reply #469 on: July 10, 2014, 08:57:01 AM »
This tutorial is ancient and it was written for a previous SMF version.

Isn't it easier to use a "subforum" mod?
http://custom.simplemachines.org/mods/index.php?mod=3730
http://custom.simplemachines.org/mods/index.php?mod=3148
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: Share user database for 2 (or more) different forums.
« Reply #470 on: July 15, 2014, 10:00:42 PM »
Yes. And no.

Some method in this topic discussion are still related and useful. For example this method:
I have a theme set for each forum (3) and don't allow users to select their own. No problems. The main forum has 2 separate forums in sub directories.  To simplify use and allow for a single log in on these I have shared these database tables :

ALTER TABLE smf2_members RENAME TO smf2_members_old;
ALTER TABLE smf2_personal_messages RENAME TO smf2_personal_messages_old;
ALTER TABLE smf2_pm_recipients RENAME TO smf2_pm_recipients_old;

ALTER TABLE smf3_members RENAME TO smf3_members_old;
ALTER TABLE smf3_personal_messages RENAME TO smf3_personal_messages_old;
ALTER TABLE smf3_pm_recipients RENAME TO smf3_pm_recipients_old;

ALTER TABLE smf_members RENAME TO shared_members;
ALTER TABLE smf_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE smf_pm_recipients RENAME TO shared_pm_recipients;

CREATE VIEW smf_members AS SELECT * FROM shared_members;
CREATE VIEW smf_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf2_members AS SELECT * FROM shared_members;
CREATE VIEW smf2_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf2_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf3_members AS SELECT * FROM shared_members;
CREATE VIEW smf3_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf3_pm_recipients AS SELECT * FROM shared_pm_recipients;

ALTER TABLE smf_log_online RENAME TO shared_log_online;
ALTER TABLE smf2_log_online RENAME TO smf2_log_online_old;
ALTER TABLE smf3_log_online RENAME TO smf3_log_online_old;

CREATE VIEW smf_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf2_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf3_log_online AS SELECT * FROM shared_log_online;

ALTER TABLE smf_attachments RENAME TO shared_attachments;
ALTER TABLE smf2_attachments RENAME TO smf2_attachments_old;
ALTER TABLE smf3_attachments RENAME TO smf3_attachments_old;

CREATE VIEW smf_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf2_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf3_attachments AS SELECT * FROM shared_attachments;

ALTER TABLE smf_sessions RENAME TO shared_sessions;
ALTER TABLE smf2_sessions RENAME TO smf2_sessions_old;
ALTER TABLE smf3_sessions RENAME TO smf3_sessions_old;

CREATE VIEW smf_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf2_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf3_sessions AS SELECT * FROM shared_sessions;

Before doing this I also pointed the settings for attachments & avatars to the main forums directories. I use sub domain independent cookies (PROBABLY NOT NECESSARY IN MY SITUATION) with the same cookie name, database sessions & for all forums. Disabled registration on all but the main forum and can log in/out to all at the same time. I did not share the permissions or member groups so I can control user permissions on the other boards separately.

To keep the script kiddie's reg bots out, I  use the MOD's httpBL with Honey Pot with a few simple questions for registration on the main forum. 6719 Spammers blocked up until today

Everything is working very well.

With this example, database can be shared without modifying SMF files.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Share user database for 2 (or more) different forums.
« Reply #471 on: July 15, 2014, 10:03:42 PM »
Except, as repeated numerous times throughout this topic, there are unpleasant side effects to doing this.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: Share user database for 2 (or more) different forums.
« Reply #472 on: July 15, 2014, 10:11:57 PM »
Indeed. All modifications have their own effects. Pleasant or unpleasant will depends on each mods.

But for learning and gaining knowledge, it is still useful, undoubtedly.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Share user database for 2 (or more) different forums.
« Reply #473 on: July 15, 2014, 10:15:26 PM »
Except it gives users bad impressions.

Sharing post counts between forums is bad enough, but sharing avatars (brokenly) between them is even less clever, as is the absolute requirement to share all user groups between forums. Paid subscriptions also shouldn't be used on any of the forums.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: Share user database for 2 (or more) different forums.
« Reply #474 on: July 15, 2014, 10:27:09 PM »
Not really. I have taken liberty to list all of these caveats so that people will know them if they are trying to apply this mod. If they read thoroughly, they should know them.

I listed the note on the Caveat & Gotchas of this database mod:
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 :(
Avatar Caveat:
Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Membergroup Caveat:
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Attachment Caveat:
Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Cookie Caveat:
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
Theme & Board Caveat:
I found a caveat to a shared member DB. Make sure all the Themes on your boards are numbered the same way. If I make a change the default to one (and reset the members options), all 3 get the change pushed.
Custom Profile Caveat:
Note also that custom profile fields are also in that table...
Statistic Caveat:
I ran into the same thing. If you run the "update statistics" maintenance, it fixes it. So now I just run that every few days until I can get around to writing a cron script that does it for me. Everything functions correctly, it just doesn't update the number of users in the bottom of the page..
Hope this will help. Happy testing! ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Share user database for 2 (or more) different forums.
« Reply #475 on: July 15, 2014, 10:31:36 PM »
I'm sure there's more than that, actually, and also quoting me saying "but see the above note" doesn't really help in this case.

But your own post indicates how many issues there are with this approach and why it's not a good idea...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: Share user database for 2 (or more) different forums.
« Reply #476 on: July 16, 2014, 03:06:21 AM »
Indeed. All modifications have their own effects. Pleasant or unpleasant will depends on each mods.

But for learning and gaining knowledge, it is still useful, undoubtedly.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Share user database for 2 (or more) different forums.
« Reply #477 on: July 16, 2014, 03:31:50 AM »
I disagree. Bad knowledge is worse than no knowledge.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: Share user database for 2 (or more) different forums.
« Reply #478 on: July 16, 2014, 04:01:01 AM »
It is not bad knowledge to learn. And IMO you know it. People do learn a long way, a short way, an easy way and a hard way. People also learn from errors and mistakes.

The mod gives ideas and ways to resolve or achieve something that someone need to accomplish. Whether it is important or not, it is another issue.

The idea itself has been developed into various another mods. This one is database with various forum installations sharing needed data. The other with single installation with same data but various forums.

It is undoubtedly useful to me and many others who discussed in this tips and tricks topic. It is even expandable and not only limited to SMF.

I can see your side of argument but it is not sound to me. Besides, we can always agree to disagree Captain Arantor. ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Share user database for 2 (or more) different forums.
« Reply #479 on: July 16, 2014, 04:03:22 AM »
Oh, same as always, you see my point but declare it as not sound because you disagree with it.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.