mirror of
https://github.com/NamelessMC/Nameless
synced 2026-08-18 06:29:04 -04:00
* Remove internal deprecations * add convert profile posts task + remove dead lang_charset references * guard og_image usages * fix * add note about mailhog * revert group sync manager for time being * review amendments * fox
35 lines
969 B
PHP
35 lines
969 B
PHP
<?php
|
|
/*
|
|
* Made by Samerton
|
|
* https://github.com/NamelessMC/Nameless/
|
|
* NamelessMC version 2.0.0
|
|
*
|
|
* Validate user event listener handler class
|
|
*/
|
|
|
|
class ValidateHook {
|
|
|
|
public static function execute(UserValidatedEvent $event): void {
|
|
if (!defined('VALIDATED_DEFAULT') || VALIDATED_DEFAULT === null) {
|
|
define('VALIDATED_DEFAULT', 1);
|
|
}
|
|
|
|
$validated_user = $event->user;
|
|
|
|
$groups_before = array_keys($validated_user->getGroups());
|
|
|
|
$validated_user->setGroup(VALIDATED_DEFAULT);
|
|
|
|
$groups_after = array_keys($validated_user->getGroups());
|
|
|
|
$groups_to_add = array_diff($groups_after, $groups_before);
|
|
$groups_to_remove = array_diff($groups_before, $groups_after);
|
|
|
|
GroupSyncManager::getInstance()->broadcastGroupChange(
|
|
$validated_user,
|
|
NamelessMCGroupSyncInjector::class,
|
|
$groups_to_add,
|
|
$groups_to_remove,
|
|
);
|
|
}
|
|
}
|