From e75f44dd15dcb419a52dcf965c4a3c92f0e3543b Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sun, 2 May 2021 02:44:29 +0100 Subject: [PATCH] Remove duplicate credits from credit string. Not yet tested. --- src/Classes/ServiceAPI/MyRadio_Creditable.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Classes/ServiceAPI/MyRadio_Creditable.php b/src/Classes/ServiceAPI/MyRadio_Creditable.php index 79352150d..487ddd59a 100644 --- a/src/Classes/ServiceAPI/MyRadio_Creditable.php +++ b/src/Classes/ServiceAPI/MyRadio_Creditable.php @@ -108,16 +108,19 @@ public function getPresenterString() $credit_types_in_byline[] = $type["value"]; } } - $str = ''; + $names = []; foreach ($this->getCredits() as $credit) { if (in_array($credit['type'], $credit_types_in_byline)) { - $str .= $credit['User']->getName().', '; + $names[] = $credit['User']->getName(); } else { continue; } } + $names = array_unique($names); + $str = implode(", ",$names); + - return empty($str) ? '' : substr($str, 0, -2); + return empty($names) ? '' : $str; } /**