UserEvent events
10 FeatherPanel plugin events on UserEvent (10 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.
Setup
Import UserEvent 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\UserEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(UserEvent::onUserApiKeyCreated(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:created ' . json_encode(['user_uuid' => $userUuid, 'api_client' => $apiClient]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}UserEvent::onUserApiKeyCreated()
Docblock: string user uuid, string api key id.
Same event name as UserApiClientEvent::onUserApiClientCreated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | api_client | $apiClient | stringfrom docblock |
When it fires (1 site)
$event->on(UserEvent::onUserApiKeyCreated(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:created ' . json_encode(['user_uuid' => $userUuid, 'api_client' => $apiClient]));
});UserEvent::onUserApiKeyDeleted()
Docblock: string user uuid, string api key id.
Same event name as UserApiClientEvent::onUserApiClientDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | api_client | $apiClient | stringfrom docblock |
When it fires (1 site)
$event->on(UserEvent::onUserApiKeyDeleted(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:deleted ' . json_encode(['user_uuid' => $userUuid, 'api_client' => $apiClient]));
});UserEvent::onUserApiKeyUpdated()
Docblock: string user uuid, string api key id. (the emitter passes 3 values, see the table)
Same event name as UserApiClientEvent::onUserApiClientUpdated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | api_client | $apiClient | not declared |
| 3 | updated_data | $updatedDatanot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, api_client, updated_data | ApiClientController::updateApiClient |
user_uuid, api_client, action | ApiClientController::regenerateApiKeys |
When it fires (2 sites)
$event->on(UserEvent::onUserApiKeyUpdated(), function ($userUuid, $apiClient, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:updated');
});UserEvent::onUserCreated()
Docblock: array user data, int user id, array created by. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user | $user | not declared |
| 2 | created_by | $createdBynot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user, created_by | PterodactylImporterController::importUser |
user, user_id, uuid, created_by | UsersController::create |
When it fires (2 sites)
$event->on(UserEvent::onUserCreated(), function ($user, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:created');
});UserEvent::onUserDeleted()
Docblock: array user data, array deleted by.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user | $user | array |
| 2 | deleted_by | $deletedBy | array|null |
When it fires (1 site)
$event->on(UserEvent::onUserDeleted(), function ($user, $deletedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:deleted ' . json_encode(['user' => $user, 'deleted_by' => $deletedBy]));
});UserEvent::onUserSshKeyCreated()
Docblock: string user uuid, string ssh key id.
Same event name as UserSshKeyEvent::onUserSshKeyCreated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | ssh_key | $sshKeynot at every site | stringfrom docblock |
| 2 | created_by | $createdBynot at every site | stringfrom docblock |
| Arguments passed | Emitted from |
|---|---|
ssh_key, created_by | PterodactylImporterController::importSshKey |
user_uuid, ssh_key | UserSshKeyController::createUserSshKey |
When it fires (2 sites)
$event->on(UserEvent::onUserSshKeyCreated(), function (...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:created');
});UserEvent::onUserSshKeyDeleted()
Docblock: string user uuid, string ssh key id.
Same event name as UserSshKeyEvent::onUserSshKeyDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | ssh_key | $sshKey | stringfrom docblock |
| Arguments passed | Emitted from |
|---|---|
user_uuid, ssh_key | UserSshKeyController::deleteUserSshKey |
user_uuid, ssh_key, action | UserSshKeyController::hardDeleteUserSshKey |
When it fires (2 sites)
$event->on(UserEvent::onUserSshKeyDeleted(), function ($userUuid, $sshKey, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:deleted ' . json_encode(['user_uuid' => $userUuid, 'ssh_key' => $sshKey]));
});UserEvent::onUserSshKeyUpdated()
Docblock: string user uuid, string ssh key id. (the emitter passes 3 values, see the table)
Same event name as UserSshKeyEvent::onUserSshKeyUpdated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | ssh_key | $sshKey | not declared |
| 3 | updated_data | $updatedDatanot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, ssh_key, updated_data | UserSshKeyController::updateUserSshKey |
user_uuid, ssh_key, action | UserSshKeyController::restoreUserSshKey |
When it fires (2 sites)
$event->on(UserEvent::onUserSshKeyUpdated(), function ($userUuid, $sshKey, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:updated');
});UserEvent::onUserUpdate()
Docblock: string user uuid.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
When it fires (1 site)
$event->on(UserEvent::onUserUpdate(), function ($userUuid): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:update ' . json_encode(['user_uuid' => $userUuid]));
});UserEvent::onUserUpdated()
Docblock: array user data, array updated data, array updated by.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user | $user | arrayfrom docblock |
| 2 | updated_data | $updatedData | array |
| 3 | updated_by | $updatedBy | arrayfrom docblock |
When it fires (4 sites)
$event->on(UserEvent::onUserUpdated(), function ($user, $updatedData, $updatedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:updated ' . json_encode(['user' => $user, 'updated_data' => $updatedData, 'updated_by' => $updatedBy]));
});