Invisible button

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

ubksu615
Posts: 2
Joined: 07 Aug 2018, 10:48

Invisible button

Postby ubksu615 » 07 Aug 2018, 12:25

how can i make a button visible ONLY if the user's name is xyz?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Invisible button

Postby Lapo » 07 Aug 2018, 14:13

Hi,
this is not a very SmartFoxServer related question. It has to do more with the tools you're using to build your interface.

In terms of code you would just need to check the user's name which is done by calling user.getName() on any user object. By the way, you haven't even specified which client technology you're using...

One small advice: it doesn't sound seem a particularly great idea to hardcode a specific user name inside your client to check for a specific user and trigger some special buttons.
What happens if at some point the user's name changes? Or if you need to check more than one user name?
Also people might decompile the code and figure out how to trigger this "hidden function".

It would be much better to create an optional button (i.e. one that appears only to certain people) by using SFS2X user privileges. For example by checking that a user has his/her privileges set to Admin.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 113 guests