From 84d37c5a8f2c4535a41c8aa8264752969d3f3a3d Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 17 Nov 2024 18:07:10 +0100 Subject: [PATCH] Allow OTS_Player to be passed as object to getPlayerLink --- system/functions.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/system/functions.php b/system/functions.php index f177d997..09f122fe 100644 --- a/system/functions.php +++ b/system/functions.php @@ -89,13 +89,18 @@ function getForumBoardLink($board_id, $page = NULL): string { function getPlayerLink($name, $generate = true, bool $colored = false): string { - $player = new OTS_Player(); - - if(is_numeric($name)) { - $player->load((int)$name); + if (is_object($name) and $name instanceof OTS_Player) { + $player = $name; } else { - $player->find($name); + $player = new OTS_Player(); + + if(is_numeric($name)) { + $player->load((int)$name); + } + else { + $player->find($name); + } } if (!$player->isLoaded()) {