Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b496a9a
commit 0e6a70b
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
class UserUpdatedEvent extends AbstractEvent implements HasWebhookParams { | ||
|
||
public User $user; | ||
public UserData $updated_data; | ||
|
||
public function __construct(User $user) { | ||
$this->user = $user; | ||
|
||
$data = DB::getInstance()->get('users', ['id', $user->data()->id]); | ||
$this->updated_data = new UserData($data->first()); | ||
} | ||
|
||
public static function name(): string { | ||
return 'updatedUser'; | ||
} | ||
|
||
public static function description(): string { | ||
return (new Language())->get('admin', 'user_updated_hook_info'); | ||
} | ||
|
||
public function webhookParams(): array { | ||
return [ | ||
'user_id' => $this->user->data()->id, | ||
'username' => $this->user->getDisplayname(), | ||
'profile_url' => URL::getSelfURL() . ltrim($this->user->getProfileURL(), '/') | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters