News:

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

Main Menu

Advice needed on how to sync two SMF forum's user tables

Started by bork, January 29, 2011, 07:38:03 AM

Previous topic - Next topic

bork

Forgive me if this is in the wrong section.

I'm just after any advice/pointers on the best way to achieve the following.

I have two separate SMF 2.0 boards, say Board A and Board B

Users can register for either board independently.

When a user registers for Board A, I want to also create an identical user in Board B.

However this is a one way process, so when a user signs up to Board B a user will not be created in Board A.

I'm wondering if this would be best achieved in MySql, a server script (perhaps triggered by cron every x minutes) or by using SMF API calls.

An advice gratefully received  :)

CapadY

This isn't realy simple.

You'll have to extend the registration module of the SMF software at both forums.
Beware the member ID's from a member will differ at each of your forums.

I think when the forums are on different servers it wil be nearly impossible to realise this.
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

bork


Would it not be possible to run a script every x minutes that would:

- examine the MySql smf_members table of Board A
- any new rows that have been added in the last x minutes would be copied and appended to the smf_members table of Board B (assuming there were no duplicate usernames)

I'm assuming this would be ok as all the user validation procedures would have been carried out when the user was originally registering on Board A.

Both forums and databases will be on the same server.

It doesn't matter if the userids would be different.

Am I over-simplifying what needs to be done to add a user?

CapadY

No, copying member records wouldn't work.

In the member record is also an auto-increment field, the member-id. This is an internal counter in the database and these counter shouldn't be equal. When you try to copy a member with ID 47 while there exist already a member with id 47 in the other forum you'll get an error.

You realy need to create a new member record in both member tables.
By the way, the forum profile have to be edit also twice. In both forums.
Believe me, It will be a real hard job to synchronize two forum member tables.


Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

bork


Good point regarding the auto-increment.

I suppose the script could be written to append a record to the end of the Board B table but copy the rest of the information from the Board A record, rather than copy the whole record.  This would keep the auto-increment field working correctly.

The profile information could be copied over but then if you wanted to update it I can see that you'd need to edit it twice. I can't see there being any way around this.

Agree it will be difficult but it's a requirement going forward so I may have to attempt it !


Advertisement: