How to create new users via API and log them in [message #33436] |
Fri, 01 September 2006 10:43 |
magnalox
Messages: 4 Registered: September 2006
Karma: 0
|
Junior Member |
|
|
Hi,
we are using FUDforum in an environment, where people already have a user profile and are logged-in.
To avoid multiple creation/log-in procedures, I would like to create a new user in FUDforum's database and log them in via PHP, whenever the user logs in in the main application.
What is the recommended procedure ?
To automate the log-in, I found a function mentioned here.
I haven't found a hint how to create a new user via API.
Any recommendations/examples ?
Thanks
|
|
|
|
Re: How to create new users via API and log them in [message #33472 is a reply to message #33440] |
Sun, 03 September 2006 10:23 |
magnalox
Messages: 4 Registered: September 2006
Karma: 0
|
Junior Member |
|
|
Thanks, found that.
Now I'm able to create a session ID by using$ForumSessionID = external_fud_login($UserID); but how do I send them logged-in onto the main index page?
A header('Location: http://...forum root../index.php?t=index&S='.$ForumSessionID); still shows them logged out.
Btw, a function like external_fud_login_bylogin($UserLogin) would be nice. Logins are required to be unique, so I don't needed to retrieve the UserID first.
Regards
Edit:
Meanwhile I found out that it works when cookies are
disabled, because the cookie set by external_fud_login()
is using the wrong session-id. Disabling cookies in
the browser forces FUDforum to use the (correct) sessid
passed via URL.
The forum runs in forum.mysite.com, not www.mysite.com
like my own scripts, including the handover-script.
Should I prevent external_fud_login() from setting a
cookie somehow ?
I could temporarily overwrite $COOKIE_NAME, but thats
not a terribly beautiful solution.
Hmmm....
[Updated on: Sun, 03 September 2006 16:48] Report message to a moderator
|
|
|
Re: How to create new users via API and log them in [message #33481 is a reply to message #33472] |
Mon, 04 September 2006 13:41 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
external_fud_login() should definitely be setting the correct session id. What makes you think it does not? The function creates a new session id, associates the user with it and sets a cookie with the given session id.
FUDforum Core Developer
|
|
|
|
Re: How to create new users via API and log them in [message #33512 is a reply to message #33502] |
Tue, 05 September 2006 12:16 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I suspect that is exactly what the problem. Your forum's cookie domain is probably set to forum.mysite.com and when you try to set a cookie for that via www.mysite.com it is rejected. To fix the problem, you need to to change the cookie domain to .mysite.com after that it should work.
FUDforum Core Developer
|
|
|
|