Log in

FutureSight Forums

Index » Tech help » FluxBB login? (Atom feed)

Pages: 1

#1: 04 Aug 2016 12:54

offline Krett12

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)

#2: 04 Aug 2016 13:09

offline Jacob

Administrator
user avatar

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.


Jacob G.
Executive director and co-head developer

#3: 04 Aug 2016 15:57

offline Krett12

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?)

#4: 04 Aug 2016 16:35

offline Jacob

Administrator
user avatar

Krett12 wrote
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?)

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.


Jacob G.
Executive director and co-head developer

#5: 04 Aug 2016 17:30

offline Krett12

Member

Oh, you modified the *forums*. That was the part I didn't get. Thanks for clearing all this up :)

#6: 05 Aug 2016 05:15

offline Krett12

Member

But wait----why can the forums use things like $ms_user? What line defines that?

#7: 06 Aug 2016 07:39

offline Jacob

Administrator
user avatar

Krett12 wrote
But wait----why can the forums use things like $ms_user? What line defines that?

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.


Jacob G.
Executive director and co-head developer

#8: 08 Aug 2016 11:01

offline Krett12

Member

Jacob wrote
The code for the check_user function is defined in one of the various Mod Share include files.

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

Embed topic (Show)