diff options
author | Minteck <contact@minteck.org> | 2023-01-28 20:31:04 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-01-28 20:31:04 +0100 |
commit | 089d94ff3a34ef022015bf28db0427497acc67ea (patch) | |
tree | 2b7db486ba3cd7ebdd728599bb5af99eafe9bde4 /includes/banner.inc | |
parent | 9b2f05228357a34a3c0f2950782835dfeb35086e (diff) | |
download | pluralconnect-089d94ff3a34ef022015bf28db0427497acc67ea.tar.gz pluralconnect-089d94ff3a34ef022015bf28db0427497acc67ea.tar.bz2 pluralconnect-089d94ff3a34ef022015bf28db0427497acc67ea.zip |
Updated 7 files and renamed 2 files (automated)
Diffstat (limited to 'includes/banner.inc')
-rw-r--r-- | includes/banner.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/includes/banner.inc b/includes/banner.inc index cbae0b2..341b4e7 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -59,6 +59,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "regression" => null, "median" => null, "marefriends" => [], + "sexfriends" => [], "sisters" => [], "caretakers" => [] ]); @@ -235,6 +236,29 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + $sexfriends = null; + + if ($isLoggedIn) { + $sexfriends = []; + foreach ($metadata["sexfriends"] as $marefriend) { + $mfSystem = explode("/", $marefriend)[0]; + $mfMemberID = explode("/", $marefriend)[1]; + $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfMemberID) { + return $item["id"] === $mfMemberID; + }); + sort($mfMember); + $mfMember = $mfMember[0]; + + $sexfriends[] = [ + "id" => $marefriend, + "link" => "/" . ($mfMember["name"]), + "icon" => getAsset($mfSystem, $mfMemberID, "heads"), + "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), + "full_name" => $mfMember["display_name"] ?? $mfMember["name"] + ]; + } + } + $sisters = []; foreach ($metadata["sisters"] as $marefriend) { $mfSystem = explode("/", $marefriend)[0]; @@ -488,6 +512,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'system' => $systemData, 'relations' => [ 'marefriends' => $marefriends ?? [], + 'sexfriends' => $sexfriends ?? null, 'sisters' => $sisters ?? [], 'caretakers' => $caretakers ?? [] ] |