diff --git a/database/2018_12_07_175328_add_switch_friendcode_field.php b/database/2018_12_07_175328_add_switch_friendcode_field.php new file mode 100644 index 00000000..179c7ec2 --- /dev/null +++ b/database/2018_12_07_175328_add_switch_friendcode_field.php @@ -0,0 +1,20 @@ +exec(" + ALTER TABLE `msz_users` + ADD COLUMN `user_ninswitch` VARCHAR(14) NOT NULL DEFAULT '' AFTER `user_steam`; + "); +} + +function migrate_down(PDO $conn): void +{ + $conn->exec(" + ALTER TABLE `msz_users` + DROP COLUMN `user_ninswitch`; + "); +} diff --git a/src/Users/profile.php b/src/Users/profile.php index ab38b769..fe27abbb 100644 --- a/src/Users/profile.php +++ b/src/Users/profile.php @@ -46,6 +46,11 @@ define('MSZ_USER_PROFILE_FIELDS', [ 'regex' => '#^(?:https?://(?:www.)?steamcommunity.com/(?:id|profiles)/)?([a-zA-Z0-9_-]{2,100})/?$#u', 'link' => 'https://steamcommunity.com/id/%s', ], + 'ninswitch' => [ + 'name' => 'Nintendo Switch', + 'regex' => '#^(?:SW-)?([0-9]{4}-[0-9]{4}-[0-9]{4})$#u', + 'format' => 'SW-%s', + ], 'twitchtv' => [ 'name' => 'Twitch.tv', 'regex' => '#^(?:https?://(?:www.)?twitch.tv/)?([0-9A-Za-z_]{3,25})/?$#u',