Using slug as username

I want a User’s slug to be their username, which they can change themselves in the app settings, but I’m trying to add restrictions. Looking at the photo below you can see I set a condition with a bunch of different arbitrary texts that turns the font red. That one works great.

The condition on the bottom is supped to stop users from creating duplicate usernames, so I’m having it perform a user search. I’ve tried this about 6 different ways and can’t get it to work. The font never turns red when I test it with filled in data. And yes I checked the privacy settings.

FYI, Bubble will never allow duplicate slugs and automatically append duplicates (eg. slug, slug1, slug2). So why waste WUs?

Your first condition is gonna be a bitch to troubleshoot in the future. Have you tried using a regex expression instead?

1 Like

That first condition expression is wild. Next time try;

Arbitrary text:split by (,) contains This Input’s value

Then in your arbitrary text field, you can put something like;

bannedslug,anotherbannedslug,athirdbannedslug

Or just store the banned text in the database maybe and then do a search?

But yeah, like @ihsanzainal84 mentioned. Bubble already makes sure there isn’t a duplicate slug if that’s needed too. :blush:

Also, I would be very careful about exposing user data to others with privacy settings. Just double check your work by doing some tests.

I’m aware that bubble doesn’t allow duplicate slugs, but it’s awkward for a user to think they are good to hit save on their desired username only to have bubble automatically change it on them to Username-1

I’ll try this in the future, but the last condition is the one I’m struggling with

This topic was automatically closed after 70 days. New replies are no longer allowed.