mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
show rainbow ID in userdetails page
This commit is contained in:
@@ -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())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
Filament::registerNavigationGroups([
|
||||
'User',
|
||||
'Torrent',
|
||||
'Other',
|
||||
'System',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -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('<img src="%s" title="%s" class="preview" style="vertical-align: sub;max-height: 16px;max-width: 16px;margin-left: 2pt"/>', $medal['image_large'], $medal['name']);
|
||||
$medalHtml .= sprintf('<img src="%s" title="%s" class="preview" style="max-height: 16px;max-width: 16px;margin-left: 2pt"/>', $medal['image_large'], $medal['name']);
|
||||
}
|
||||
|
||||
$href = getSchemeAndHttpHost() . "/userdetails.php?id=$id";
|
||||
|
||||
@@ -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(
|
||||
'<div><strong>[%s]</strong>(%s: %s)</div>',
|
||||
$rainbowID->metaKeyText, nexus_trans('label.deadline'), $rainbowID->deadline
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($props)) {
|
||||
tr_small($lang_userdetails['row_user_props'], sprintf('<div style="display: inline">%s</div>', implode(' | ', $props)), 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user