From 2e22631269264a6b5cc6704036d56de14f7fe27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F=E7=99=BD=E5=93=A6?= Date: Mon, 27 Jul 2026 16:56:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8C/=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 23 +++++++++++++++++++++++ extend.php | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 composer.json create mode 100644 extend.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..00ff5fb --- /dev/null +++ b/composer.json @@ -0,0 +1,23 @@ +{ + "name": "xxb5724/no-email-register", + "description": "Remove email field from registration form and skip email verification.", + "type": "flarum-extension", + "require": { + "flarum/core": "^2.0" + }, + "autoload": { + "psr-4": { + "XXB\\NoEmailRegister\\": "src/" + } + }, + "extra": { + "flarum-extension": { + "title": "XXB No Email Register", + "icon": { + "name": "fas fa-user-plus", + "backgroundColor": "#00BFFF", + "color": "#fff" + } + } + } +} diff --git a/extend.php b/extend.php new file mode 100644 index 0000000..b61d7f4 --- /dev/null +++ b/extend.php @@ -0,0 +1,23 @@ +css(__DIR__ . '/less/forum.less'), + (new Extend\Event()) + ->listen(\Flarum\User\Event\Saving::class, AutoActivateUser::class), + (new Extend\ApiResource(UserResource::class)) + ->field('email', function ($field) { + return $field + ->rules(['nullable'], fn ($context) => $context->creating(), true); + }), + (new Extend\Locales(__DIR__ . '/resources/locale')), +]; \ No newline at end of file