Index » Tech help » FluxBB login? (Atom feed)
Pages: 1
Member
Hi do you have a way to integrate a website's login with forums (I'm using FluxBB) so that all users are the same. It does not matter to me if you have to use login.php, but I'd like users to not need to use register.php (and already have an account)
Administrator
You may be better off using the FluxBB forums for this, as our website is currently running off FutureBB and FST hasn't really done much with FluxBB in over two years.
However, in order to get the information about the current logged in user, put the following code at the top of all files that need it:
define('PUN_ROOT', dirname(__FILE__) . '/'); include PUN_ROOT . 'include/common.php';
To get the user information, use the following:
$pun_user['username']; //username $pun_user['id']; //user id $pun_user['email']; //email address $pun_user['g_id']; //group ID
To make your own registration page, you would probably be best off copying the FluxBB registration page and modifying it as necessary.
Member
Thanks, but I wasn't really asking how to get info of the FluxBB user. I want people to create a main site account and automatically be logged in on the forums, not the other way around. (How did you do it on Mod Share?)
Administrator
The way we did it was by automatically creating a user in FluxBB with the same username as the main site, and automatically logging users in/out as necessary. You can find the relevant code in include/common.php which is available here. Lines 218-298 and 339-346 are the most important, being the section that either creates the forum account or logs the user in/out of the forums as appropriate respectively. You would need to add those to the same location in the same file in your FluxBB installation.
You can also adapt the code on lines 300-337 to set the user group as appropriate, but that's a bit more complicated, as that code also involves the new Mod Share-er system.
In that file, $ms_user represents the information about the user on Mod Share, with $ms_user['valid'] representing whether or not the user is logged in, and ['username'], ['id'], etc. having their respective meanings. You will need to change the variables as appropriate to get the user's information from your main site.
Member
Oh, you modified the *forums*. That was the part I didn't get. Thanks for clearing all this up
Member
But wait----why can the forums use things like $ms_user? What line defines that?
Administrator
That's where the following line comes in:
check_user($ms_user);
That populates the $ms_user variable with the information about the Mod Share user. The code for the check_user function is defined in one of the various Mod Share include files. You'll need to figure out your own way to transfer the user's login information to the forums. PHP session data would probably be the easiest way.
Member
Oh, *that* is my problem, right there. I couldn't see and Mod Share files included, only FluxBB ones.
Index » Tech help » FluxBB login? (Atom feed)
Pages: 1