Skip to content

Instantly share code, notes, and snippets.

@luceos
Created August 6, 2024 09:07
Show Gist options
  • Save luceos/9c58e073a34333ca16b5fbcfcb18a205 to your computer and use it in GitHub Desktop.
Save luceos/9c58e073a34333ca16b5fbcfcb18a205 to your computer and use it in GitHub Desktop.
setting specific preferences for new users when they register
<?php
use Flarum\Extend;
return [
(new Extend\Event)
->listen(\Flarum\User\Event\Registered::class, function (\Flarum\User\Event\Registered $event) {
$event->user->setPreference('discloseOnline', true);
$event->user->setPreference('indexProfile', true);
}),
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment