question

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) asked

Clear a user's display name

I would like to be able to set a user's display name to null/empty. In other words, I would like to restore its display name to its default value.

My main use case for this is when we go from alpha testing to live, I want to preserve existing user accounts, but force them to choose new display names. I also want all alpha tester names to be freed so they can be used again.

I was planning to go about doing this by clearing their existing display names, since my lobby server currently already handles an empty/unset display name by giving the user a prompt to set their name.

Account Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Sorry, but Title Display Name must be unique within the Title ID, and we don't currently have a "DeleteTitleDisplayName" API call (which is really what you need). I'd recommend adding that to the Feature Requests forum, to see if this is something that would help others.

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Thanks - I went ahead and made a feature request.

Would you have any recommendations on how I can implement my desired behavior? i.e. how to free all existing display names and force them to choose a new one?

Only thing I can think of is by iterating through all players, prepend something to their display name like "__", then have the lobby server treat a username beginning with "__" as an empty username.

0 Likes 0 ·
brendan avatar image brendan Brent Batas (Lisk) commented ·

Assuming that your "lobby server" is a custom game server, what I would do is update a player (read only or internal) data key/value pair that you use for saving details about the player to have a flag indicating that their Title Display Name has been updated (with a date or game version number, so that if you want to force them to change again later, you have that info). When the player joins the server, get that data and check it - if there's no value at all, they've never had to reset, and should be prompted for a new name.

0 Likes 0 ·
Brent Batas (Lisk) avatar image Brent Batas (Lisk) brendan commented ·

Hi Brendan,

Thanks for the suggestion. That is correct - my lobby server is a custom game server. That would work for prompting them to set a new name; however, I think it wouldn't free up existing display names for use by other people. What would you recommend?

0 Likes 0 ·
Show more comments
Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Hi Brendan,

I'm imaging we have a user named John and a user named Johnny. Then I trigger the "reset" on both names. Then Johnny wants to name himself "John." He should be able to, because "John" should be freed for use. However, since I believe title display names are unique, it would reject his request.

0 Likes 0 ·
brendan avatar image brendan Brent Batas (Lisk) commented ·

Thanks - yes, on re-reading your question, I realized what you meant. There is an option to make title display names non-unique, but using it makes it no longer possible to look players up by that string, so I tend to recommend that titles not use that option.

The nice thing about this flow is that it lets you prevent players from "sniping" someone else's display name. What I'd recommend is, use GetAccountInfo to look up the display name, to see if it's taken. If it is, get the profile info and check to see if you want to let the other player have it (I'd at least check their last login date). If so, change the old player's display name to a randomized value, but don't set the "name changed" value from above. Then, set the requesting player to the name, and set their "name changed" value.

0 Likes 0 ·
Brent Batas (Lisk) avatar image Brent Batas (Lisk) brendan commented ·

Thanks for the answer. As I started implementing your suggestion, I thought of another solution: what if I just established a convention where if your Title Display Name equals your playFabId, then treat that Title Display Name as "unset" and prompt the user to set their display name again. This would potentially save having to read/write UserData. It would also simplify the logic to free up their Title Display Names, since the PlayFabIds wouldn't be usernames people would want to take. Edit: fixed to read Title Display Name instead of Username for clarity.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.