Minor improvements (#1398)

* Minor improvements

* Update viewtopic.php

* Update functions.php

* Update functions.php

* Update usercp_register.tpl

* Update register.php

* Update register.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-02-10 22:22:26 +07:00 committed by GitHub
commit 7c703164d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 35 additions and 26 deletions

View file

@ -2172,7 +2172,14 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID)
DB()->query("UPDATE " . BB_USERS . " SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . TIMENOW . ", user_newest_pm_id = $pm_id WHERE user_id = $user_id");
}
function profile_url($data, $target_blank = false)
/**
* Generates link to profile
*
* @param array $data
* @param bool $target_blank
* @return string
*/
function profile_url(array $data, bool $target_blank = false): string
{
global $bb_cfg, $lang, $datastore;
@ -2181,33 +2188,33 @@ function profile_url($data, $target_blank = false)
$ranks = $datastore->get('ranks');
}
$username = !empty($data['username']) ? $data['username'] : $lang['GUEST'];
$user_id = !empty($data['user_id']) ? (int)$data['user_id'] : GUEST_UID;
$user_rank = !empty($data['user_rank']) ? $data['user_rank'] : 0;
$title = '';
$style = 'colorUser';
if (isset($ranks[$user_rank])) {
$title = $ranks[$user_rank]['rank_title'];
$style = $ranks[$user_rank]['rank_style'];
if ($bb_cfg['color_nick']) {
$style = $ranks[$user_rank]['rank_style'];
}
}
if (empty($title)) {
$title = $lang['USER'];
$title = match ($user_id) {
GUEST_UID => $lang['GUEST'],
BOT_UID => $username,
default => $lang['USER'],
};
}
if (empty($style)) {
$style = 'colorUser';
}
if (!$bb_cfg['color_nick']) {
$style = '';
}
$username = !empty($data['username']) ? $data['username'] : $lang['GUEST'];
$user_id = (!empty($data['user_id']) && $username != $lang['GUEST']) ? $data['user_id'] : GUEST_UID;
$profile = '<span title="' . $title . '" class="' . $style . '">' . $username . '</span>';
if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) {
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) {
$target_blank = $target_blank ? ' target="_blank" ' : '';
$profile = '<a ' . $target_blank . ' href="' . make_url(PROFILE_URL . $user_id) . '">' . $profile . '</a>';
if (getBanInfo((int)$user_id)) {
if (getBanInfo($user_id)) {
return '<s>' . $profile . '</s>';
}
}