MyBB Community Forums

Full Version: MyBB Site Integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I'm a total noob with MyBB, but I have a website with an already existing user database (MySQL), and I want to integrate it with MyBB.

Our users already log in to use our site, and I'd like to post a link on the inner pages of the site that takes them to our MyBB forum without the user having to log on AGAIN to MyBB.

Is there a way to have MyBB authenticate against our existing user database? We already have things like user ID's, first last names, emails, etc.

Thanks,

Victor Palmer
CentSports.com
979-574-5133
The easiest thing to do would be to create a script that ports the current users into the MyBB user table, then use one of the user submitted tutorials to convert your current site login into the MyBB login.
is it at all possible to have MyBB authenticate against a custom DB?
It would require a bit of modification. Try looking in the inc/functions_user.php or inc/functions.php for the validate_password_by_uid() function. (I don't remember the exact location or name of the function, but it should be something similar, this off the top of my head)
DennisTT Wrote:It would require a bit of modification. Try looking in the inc/functions_user.php or inc/functions.php for the validate_password_by_uid() function. (I don't remember the exact location or name of the function, but it should be something similar, this off the top of my head)

Hey, the function is called validate_password_from_uid and it's in line 73.

After I looked at the function, I became interested to it, could you give us an example on how to use it?

function validate_password_from_uid($uid, $password, $user = array())

What information exactly needs to be passed to validate the password?

Thanks
You pass the uid and a plain-text password. If you read the source code you'll find out what you need to pass:
/**
 * Checks a password with a supplied uid.
 *
 * @param int The user id.
 * @param string The plain-text password.
 * @param string An optional user data array.
 * @return boolean|array False when not valid, user data array when valid.
 */

You might also be interested in validate_password_from_username in the same file. There you just have to pass the username and plain text password.
DennisTT Wrote:You pass the uid and a plain-text password. If you read the source code you'll find out what you need to pass:
/**
 * Checks a password with a supplied uid.
 *
 * @param int The user id.
 * @param string The plain-text password.
 * @param string An optional user data array.
 * @return boolean|array False when not valid, user data array when valid.
 */

You might also be interested in validate_password_from_username in the same file. There you just have to pass the username and plain text password.

Oh thanks. I hadn't read the comments. Much clear now, thanks.