# Developing Discourse Plugins - Part 3 - Add custom site settings

**URL:** https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115
**Category:** Developer Guides
**Tags:** plugin-guides, tutorial
**Created:** [July 16, 2015, 3:35pm UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115 "2015-07-16T15:35:33Z")
**Posts on this page:** 1
**Showing post:** 23

<div class="post-metadata">

### Author: ![eatcodetravel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eatcodetravel/32/94385_2.png) [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)
#### Post date: [July 19, 2018, 9:09pm UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115/23 "2018-07-19T21:09:16Z")

</div>

I was looking how to create a site setting that validates a username, but found there’s a `username` type to do this. Here the list of site setting types we have today:

- `email`
- `username`
- `integer`
- `regex`
- `string`
- `list`
- `enum`

Also, you can do custom validations for your plugin settings, it accepts a `validator` field that expects a Ruby class. You use it like this.

```yml
plugins:
  my_custom_username_validation:
    default: 'system'
    validator: 'UsernameSettingValidator'

```

You can check the [UsernameSettingValidator](https://github.com/discourse/discourse/blob/master/lib/validators/username_setting_validator.rb) class to see the interface of validators.

Cheers!

---

_[View the full topic](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115)._
