Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: chamu on November 01, 2008, 12:56:40 PM

Title: Start a smf session from codeigniter
Post by: chamu on November 01, 2008, 12:56:40 PM
Hi, this is the first time I write here, English is not my natural language, please be patient.
now comment on a problem I have with SMF, I installed SMF 1.1.6 and it works!
I have another project I did with codeigniter and I used CL_AUTH for user authentication. I want to do is when a user logs in to my system automatically logs on SMF, and when a new user is logged on the Web is recorded in SMF.
Please can someone give some help on this?

   
I could use SMF 2 if necessary ;)
Title: Re: Start a smf session from codeigniter
Post by: SlammedDime on November 05, 2008, 06:21:18 PM
There really is no easy way to do this, but to get you started in the right direction, I'd download the Mambo bridge and look at the SMF_login and SMF_register mambots included with it.

Essentially you'd have to write a small routine that, when the user logs in, you'll have to check if they are a valid user in SMF, and if so, set a login cookie.  If they aren't a user in SMF, but they should be a valid user, you'd have to add them to the SMF database.

Likewise for registrations, you'd have to add a routine that would register the user into the SMF database.

You'd have to include SSI.php, and SMF does have functions to automate the logging in and registering, the main thing you have to do is validate the user, then tell SMF it is okay to login or register and call the function.  To log someone in/out, you'd use the setLoginCookie() function from Subs-Auth.php, and for registration, you'd use the registerMember() function from Subs-Members.php