Page 2 of 2

Posted: 02 Oct 2011, 21:59
by BigFIsh
No no.. :roll:

you need to send the user id and name inside your response package, like this:

var u = _server.instance.getUserByChannel(chan);
response.userId = u.getUserId();

Then on client side, you need to set myUserId and myUserName using the data u just sent from serverside.

i.e.

smartFox.myUserId = ...;
smartFox.myUserName =...;

Posted: 03 Oct 2011, 19:28
by Guy71173cp
Sorry, this is the most PATHETIC question, but...

What would I put as the value in the userName and userID properties? Sorry, I knew so much about SFS until I just stopped working on the computer for a while.

smartFox.myUserId = ...;
smartFox.myUserName =...;

So like, in the dots, what would I put?

Posted: 03 Oct 2011, 19:48
by BigFIsh
smartFox.myUserId = {the SFS user id you sent along with the logOK reponse};
smartFox.myUserID = {the user name used for login};

Posted: 03 Oct 2011, 20:35
by Guy71173cp
Ok, so I know that smartfox.myUserName would be valued as userName (since that would be the username), but I'm clueless about the myUserId. Here is my extension:

http://pastebin.com/K9nQWixB

Posted: 06 Oct 2011, 19:36
by Guy71173cp
Anyone have an answer?

Posted: 06 Oct 2011, 22:32
by BigFIsh
Don't you know what SFS user Id is?

smartfox.myUserId = {the smartfox user id that you'll need to fetch from the server for that particular user upon successful login}

Posted: 07 Oct 2011, 15:53
by Guy71173cp
Hey.

I've been studying SmartFoxServer for over a year. Can you direct me to a good place to learn the user variables? I know the docs, but what chapter? Avatar chat? I am an expert at AS2, but I am not too good at SFS. Could you point me where to start? Like which chapter?

Posted: 11 Oct 2011, 04:50
by BigFIsh
Note that you need to manually set the myUserId and myUserName in order for setUserVariables to work with custom login. This is because the client API needs to know the smartfoxserver user id for that user, otherwise it will not work. If you didn't set myUserId, then the client API will basically tell the server: 'Please update user variables for this user by id: -1'

There are a number of different chapters that covers userVariables. Simply search for 'setUserVariables' via doc search tool.