dsadsa
All checks were successful
Deploy / deploy (push) Successful in 54s

This commit is contained in:
2026-08-17 00:24:57 +02:00
parent 9d5bad8294
commit 0d384cee2d
10 changed files with 237 additions and 17 deletions

View File

@@ -707,6 +707,31 @@ final class AccountPages
}
$community->saveMembershipLevels($levels, $userId);
$info = 'Community-Level gelöscht.';
} elseif ($action === 'community_points_adjust') {
if (!$canManageProfileLevels || !$community) {
throw new \RuntimeException('Keine Berechtigung für Community-Punkte.');
}
$targetUserId = (int)($_POST['target_user_id'] ?? 0);
$amountRaw = trim((string)($_POST['points_amount'] ?? ''));
$reason = trim((string)($_POST['points_reason'] ?? ''));
if ($targetUserId <= 0) {
throw new \RuntimeException('Bitte wähle einen Benutzer aus.');
}
if ($amountRaw === '' || !is_numeric($amountRaw)) {
throw new \RuntimeException('Bitte gib eine gültige Punktzahl an.');
}
$amount = (float)$amountRaw;
if ($amount <= 0) {
throw new \RuntimeException('Es können hier nur zusätzliche Punkte vergeben werden.');
}
if ($reason === '') {
throw new \RuntimeException('Bitte gib eine Begründung für die Punktevergabe an.');
}
$community->adjustPoints($targetUserId, $amount, $reason, $userId);
$info = 'Community-Punkte wurden erhöht.';
}
} catch (\Throwable $e) {
$error = $e->getMessage();
@@ -913,6 +938,21 @@ final class AccountPages
$communityLevelRightDefinitions = Community::membershipRightDefinitions();
$communityRoles = $communityAccess ? $communityAccess->getUserRoles($userId) : [];
$systemRoleAssignments = $communityAccess && $canManageProfileLevels ? $communityAccess->listRoleAssignments() : [];
$profileLevelUserSearchQuery = '';
$profileLevelUserSearchResults = [];
if ($communityAccess && $community && $canManageProfileLevels) {
$profileLevelUserSearchQuery = trim((string)($_GET['profile_level_user_query'] ?? ''));
if ($profileLevelUserSearchQuery !== '') {
foreach ($communityAccess->searchUsers($profileLevelUserSearchQuery, 12) as $searchRow) {
$targetSearchUserId = (int)($searchRow['id'] ?? 0);
$targetPoints = $community->computePoints($targetSearchUserId);
$searchRow['community_points'] = $targetPoints;
$searchRow['community_level'] = $community->membershipLevel($targetPoints);
$searchRow['roles'] = $communityAccess->getUserRoles($targetSearchUserId);
$profileLevelUserSearchResults[] = $searchRow;
}
}
}
$communityApplication = $communityAccess ? $communityAccess->getLatestApplication($userId) : null;
$communityCanApply = $communityAccess ? $communityAccess->canApplyForForumAdmin($userId, $communityPoints) : false;
$communityRestrictions = $communityAccess ? $communityAccess->getRestrictionState($userId) : [
@@ -991,6 +1031,8 @@ final class AccountPages
'communityLevelRightDefinitions',
'communityRoles',
'systemRoleAssignments',
'profileLevelUserSearchQuery',
'profileLevelUserSearchResults',
'communityApplication',
'communityCanApply',
'communityRestrictions',