ServerUserEvent events
3 FeatherPanel plugin events on ServerUserEvent (1 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions. 2 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import ServerUserEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\ServerUserEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(ServerUserEvent::onServerUserUpdated(), function ($userUuid, $serverUuid): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:updated ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}ServerUserEvent::onServerUserDeleted()
Docblock: string server uuid.
$event->on(ServerUserEvent::onServerUserDeleted(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:deleted ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
ServerUserEvent::onServerUserError()
Docblock: string error message, array context.
$event->on(ServerUserEvent::onServerUserError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
ServerUserEvent::onServerUserUpdated()
Docblock: string server uuid, array updated data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | server_uuid | $serverUuid | arrayfrom docblock |
When it fires (1 site)
$event->on(ServerUserEvent::onServerUserUpdated(), function ($userUuid, $serverUuid): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:updated ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid]));
});