Updating a user's name

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
tdous
Posts: 7
Joined: 08 Jun 2006, 08:23

Updating a user's name

Post by tdous »

Hey all,

Probably being stupid here and missing something obvious (it's been a long week so far ;) ) but I can't work out how to change a user's user name after they have already logged into SFS.

The whole point is that our full site will run through SFS so guest users can browse who's online but will ahve to log in for certain areas. I would like to change their user name from "guest_x" to whatever it is when they login without relogging and losign the user_id or anything like that.

Is this possible?

Thanks
Tom
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

not a stupid question at all :)
Originally the user name was thought to be immutable in a user session.
At the moment you can't rename your user during the same session.
There's however a simple workaround, you can add this feature using an extension. You can attach any number of properties to a User object using the properties attribute.

What you have to do is store the user name inside a variable in the properties object and then let the user modify it through a custom request to the extension.
Once changed you will also need to broadcast the event to the other users that are in the room with the client that just modified its name

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
tdous
Posts: 7
Joined: 08 Jun 2006, 08:23

Post by tdous »

Very interesting, thank you :)

I'll have a play and see what happens.
Dan0
Posts: 16
Joined: 22 Sep 2006, 20:39

Post by Dan0 »

Yeh, I thought this aswell I realised that you should include this in a new version of SFS. I guess it wasn't included cos if movieclips are named with a users name and not ID the flash will mess up if the name is changed. I just added another variable but I dont know howt o do extensions/objects :(
Post Reply