• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

External login to XenForo from a PHP site

#1
Hello,

Is there a documented way to implement "login" to XenForo from a PHP site?

I've searched the forum but found only one original post without any reply.

Thank you!
 

Liam W

Well-known member
#2
What do you mean by login would be the first question.

You could easily post the relevant auth details to the login script, get the session ID and set the cookie yourself, however I don't think that's what you want to do.
 
#3
I'd like to be able to access the logged-in user name, group name, etc... from within my own PHP web site.

And to be able to provide login and logout links and/or custom web pages from that same PHP website.

Thank you!
 

Liam W

Well-known member
#4
I'd like to be able to access the logged-in user name, group name, etc... from within my own PHP web site.

And to be able to provide login and logout links and/or custom web pages from that same PHP website.

Thank you!
Why? Can't you implement your own website into XenForo? It would make things 1000x easier :)

I guess the easiest way to do it would be to make XenForo take cookies from the same domain as the main site (I'm already assuming it's on the same domain, so that's no too easy).

You could either link to the XF login form, or simply request the login details, check them yourself with the XF classes and set the cookie, or get the login details and post them to the XenForo login, then set the cookies you get back to the users browser.

You could then include the XenForo system in your PHP, and use it to get the relevant details.

Liam
 
#5
Thank you Liam!

Unfortunately, I don't have access to XF classes since I don't own an XF license. I'm thinking of switching away from phpBB forum, and am looking for an alternative.

Thank you again.
 

feldon30

Well-known member
#10
I can tell you that we went through this on our PHP/CodeIgniter application and it took over 30 hours of development to get external logins working with XenForo, and still, accessing the AdminCP requires a kludgy workarond.

Here's my thread about what it took to get this working:
http://xenforo.com/community/threads/login-logout-register-from-outside-xenforo.65878/

and here's my Suggestion thread asking for XenForo to add external login support:
http://xenforo.com/community/threads/xenforo-login-api-for-third-party-scripts.67696/


XenForo needs to provide a way for a third party script to say "This user is logged in". Not, here's the user's password, let's juggle hashing algorithms and go ten rounds. Just, this user (e-mail address) is logged in so get over it!

SMF, a free forum, provides exactly this functionality through a third party script. We got external logins completely working in less than 2 hours. However we wanted to use a professional forum and so endured rewriting all this in XenForo.
 
#11
I'm looking to migrate to a professional board as well.

Thank you for referencing the above two threads -- I will review them carefully.

At present I'm using phpBB -- (a few years ago) it took less than an hour to read a relevant phpBB thread and to implement code into my website with which to get user status, name, etc...

I wish that XF would offer a development or a trial license, so I could try to implement new or test existing code first.

Best,

Alex.