Validate Custom User Field for Fediverse Handle

Yes, I have searched and found one general method for validating the input to a custom user field. My skills here are a bit raw, so hoping for suggestions.

We’ve been encouraging people in our education community to include in their profile a username if they have a fediverse account (Mastodon, Bluesky, Threads, et al). These should be something with two @ signs, where the first is a username and the second a valid formatted domain.

 @coolperson99@someinstance.org

Despite what I thought was a clearly explained format:

The successful entry rate is like 20% or worse. I get email addresses, twitter usernames, random strings, URLs. I can only dream, but think it should be possible to check with some regex (again my skills are mid range to muddling) for the valid format.

1 Like

This plugin maybe of interest if you’re self hosted or on a Hosted plan that includes it

This theme-component maybe also of interest as well. This of course can be installed on any discourse install.

Thanks Dan, the Discourse Authentication Validations plugin looks perfect and useful for my other fields.

I am already using Clickable Social Icon Links. I can see my mistake was asking for a mastodon username rather than a URL, so it looks like I have some cleanup to do!

1 Like

You’re quite welcome!

Just found this theme-component that you might also find very useful.

You could create a post with fields that need correcting with providing format details/pic.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.