diff --git a/app/Models/UserMeta.php b/app/Models/UserMeta.php index 3f232d1d..37da3c7a 100644 --- a/app/Models/UserMeta.php +++ b/app/Models/UserMeta.php @@ -17,14 +17,18 @@ class UserMeta extends NexusModel protected $appends = ['meta_key_text']; + protected $casts = [ + 'deadline' => 'datetime', + ]; + public function getMetaKeyTextAttribute() { return nexus_trans('label.user_meta.meta_keys.' . $this->meta_key) ?? ''; } - public static function consumeBenefit($uid, $metaKey) + public function isValid(): bool { - + return $this->status == self::STATUS_NORMAL && ($this->getRawOriginal('deadline') === null || ($this->deadline && $this->deadline->gte(now()))); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 18a6889e..5504b4b6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider Filament::registerNavigationGroups([ 'User', 'Torrent', + 'Other', 'System', ]); }); diff --git a/include/functions.php b/include/functions.php index 30df5f63..df465d77 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3736,7 +3736,7 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f //medal $medalHtml = ''; foreach ($arr['wearing_medals'] as $medal) { - $medalHtml .= sprintf('', $medal['image_large'], $medal['name']); + $medalHtml .= sprintf('', $medal['image_large'], $medal['name']); } $href = getSchemeAndHttpHost() . "/userdetails.php?id=$id"; diff --git a/public/userdetails.php b/public/userdetails.php index 8dece202..c423ea42 100644 --- a/public/userdetails.php +++ b/public/userdetails.php @@ -352,6 +352,18 @@ jQuery('#{$triggerId}').on("click", function () { JS; \Nexus\Nexus::js($consumeChangeUsernameJs, 'footer', false); } + +$metaKey = \App\Models\UserMeta::META_KEY_PERSONALIZED_USERNAME; +if ($metas->has($metaKey)) { + $rainbowID = $metas->get($metaKey)->first(); + if ($rainbowID->isValid()) { + $props[] = sprintf( + '
[%s](%s: %s)
', + $rainbowID->metaKeyText, nexus_trans('label.deadline'), $rainbowID->deadline + ); + } +} + if (!empty($props)) { tr_small($lang_userdetails['row_user_props'], sprintf('
%s
', implode(' | ', $props)), 1); }