How to make a user a nickname so that it does not repeat with others

how to make a user a nickname so that it does not repeat with others

I created a nickname entry in the user database, but when updating and adding users can be with the same nickname, how to make sure that each user has their own nickname and when they try, a message about an existing nickname appears in the same way?

If I understand correctly, if a user chooses a nickname that already exists, there should be a message that says that they can’t choose? Because in that case, just add an message below the nickname input that is only visible when the amount of other users with that specific nickname is not equal to 0, and make the ‘save’ button of saving the nickname only visible when there is exactly 0 other people with that nickname in the database. This way, the user will know that they selected a nickname that is already in use, and if they chose to ignore it, they won’t be able to save it, so all nicknames will remain unique.

1 Like

try it now