MyBB Community Forums

Full Version: Using mybb cookies to authenticate in wordpress?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I'm trying to write a plugin for wordpress to use Mybb's cookies to authenticate users, and I would like someone to confirm me that what I thought to do is right.

When I login to the forum, mybb creates a number of cookies:

sid
loginattempts
mybb[lastactive]
mybb[lastvisit]
mybbuser

looking at them, the two that seems being useful to me are:

mybbuser: which contain user id and loginkey
sid which contain user's session id

for use them from wordpress I thought to edit the following values in mybb configuration, so I can access them also from the root of the site, even if the forum is in /forum folder:

$settings['cookiedomain'] = "";
$settings['cookiepath'] = "/";
$settings['cookieprefix'] = "forum_";

To be sure that the user is who the cookie says, i compare loginkey from the mybbuser cookie and the value contained in the database.
Is this right and secure?
Any suggestion?

Thanks

Alder
There are some plugin to do this, i don't know how this works, but you can compare how this two scripts takes values to register users, and then you can be able to do this task, i never use wordpress, but i want to test it.

But i see one plugin to do this task here in the forum, it does not work for you ?
Unfortunately there is no plugin doing this. Not at all at least
I'm at half work developing it, my only concern is about the way mybb uses its own cookies to auth users.
How session cookie is used?
I can't find it out in documentation.
you can grab the mediawiki bridge I built to see how to use it. It in the "market" on the site in my sig.