MyBB Community Forums

Full Version: Way to marry MyBB users & Site members?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi-

First off, I'm not even sure how to search for this sort of problem -- the searches I did do on this forum before posting produced nada...

Second, I'm not even sure of the approach to the solution, so I'm hoping to gain some insight into how to proceed to solve my dilemma...

OK, here's the thing: We have a site (home-grown PHP/Javascript CMS) that people can join & become members. We also have a MyBB forum on the site. The problem is that people become members of the site, but MyBB uses its own user system, so our members then have to create a MyBB account to access the forum...not an ideal situation.

What we want to do is to have people become site members and when they log in, _also_ be logged into MyBB...

We're considering three approaches:

1) Ditch the MyBB users table and have MyBB look to our members table for 'logged-in' status. This approach seems dangerous, as there could be (and probably are) areas in MyBB that use the users table that would not be obvious, requiring lots & lots of testing, bug-tracking & the like to make sure MyBB was fully converted over to using our membership system...not too appealing....

2) Scrap our member system & use MyBB's....however this would raise numerous problems in itself: first, there are a lot of areas on the site that use member info in non-obvious ways, so we'd have to test everything as in #1, but with our system instead of MyBB's...probably a little easier, but still onerous. In addition, our membership system has a bunch of data related to the site that isn't in MyBB's user table...we could alter the user table and migrate the data, but that seems like quite a hassle...

3) Use both systems in tandem. This seems to be the easiest -- when members log into the site, run a script that would also log them into MyBB. The main issue, as I see it, would be figuring out how MyBB uses its password encryption/salt routines to be able to pass the user name/PW via a script to perform the login (and to create a MyBB user record when a new member joins the site)...or is it possible to simply tell MyBB "this user -- he's logged in" programatically and not have to deal with the PW issue?

Other than shoe-horning MyBB into an iframe and changing the skin, I don't have any experience altering MyBB code, so am a bit apprehensive about mucking about in MyBB's innards...but the issue has come to head where I simply have to do away with the dual accounts/passwords and have a consolidated system between the site and the forum...

So at this point, I suppose my questions are:

1) Has anyone else encountered this situation? If so, how did you remedy it?

2) are there any good docs that specify the structure/methodology of MyBB's user table/routines and how to modify them?

3) Do you agree that Approach #3 is the way to go? if not, why and which do you recommend? Is there an alternative I haven't considered?

4) Is there a plugin or canned script for achieving this? Am I being stupid/naive about needing to do this? Is there something simple I'm overlooking?

Any thoughts, comments, suggestions welcomed and appreciated...

Thnx!

-CSense
I would not go with option 1. MyBB uses the users table extensively and also uses elements from the user table (such as usernames) to update other tables (such as thread opener etc)

In the same way I'm not sure how viable option 2 would be as I do not know how extensive your home grown script is.

What I would do is to disable the registrations on the forum and point the register/login to the main site's. Write a script that adds a user to MyBB when they register on the site and generates the cookies to log them in to MyBB. From here on, the users will be on 2 different systems but can appear as one to the end user. Possible problems might come if you have same usernames already registered on both systems by different users so you would have to watch for that.
You can customize the script to actually keep the username as well as the uid in sync, this way it would become easier for you to pull data from one system in to the other without too many problems.