mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07: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 $appends = ['meta_key_text'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'deadline' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
public function getMetaKeyTextAttribute()
|
public function getMetaKeyTextAttribute()
|
||||||
{
|
{
|
||||||
return nexus_trans('label.user_meta.meta_keys.' . $this->meta_key) ?? '';
|
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([
|
Filament::registerNavigationGroups([
|
||||||
'User',
|
'User',
|
||||||
'Torrent',
|
'Torrent',
|
||||||
|
'Other',
|
||||||
'System',
|
'System',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3736,7 +3736,7 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f
|
|||||||
//medal
|
//medal
|
||||||
$medalHtml = '';
|
$medalHtml = '';
|
||||||
foreach ($arr['wearing_medals'] as $medal) {
|
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";
|
$href = getSchemeAndHttpHost() . "/userdetails.php?id=$id";
|
||||||
|
|||||||
@@ -352,6 +352,18 @@ jQuery('#{$triggerId}').on("click", function () {
|
|||||||
JS;
|
JS;
|
||||||
\Nexus\Nexus::js($consumeChangeUsernameJs, 'footer', false);
|
\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)) {
|
if (!empty($props)) {
|
||||||
tr_small($lang_userdetails['row_user_props'], sprintf('<div style="display: inline">%s</div>', implode(' | ', $props)), 1);
|
tr_small($lang_userdetails['row_user_props'], sprintf('<div style="display: inline">%s</div>', implode(' | ', $props)), 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user