From 472bde99a4b8458f84999cad19a3badcbf885aac Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 17 Dec 2022 00:39:06 -0500 Subject: [PATCH] Retrieve contact records for the page visitor in Contact\Contacts module --- src/Module/Contact/Contacts.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Module/Contact/Contacts.php b/src/Module/Contact/Contacts.php index 33fe2f60d..0ed91c927 100644 --- a/src/Module/Contact/Contacts.php +++ b/src/Module/Contact/Contacts.php @@ -143,7 +143,18 @@ class Contacts extends BaseModule $tabs = self::getContactFilterTabs('contact/' . $cid, $type, true); - $contacts = array_map([Module\Contact::class, 'getContactTemplateVars'], $friends); + // Contact list is obtained from the visited contact, but the contact display is visitor dependent + $contacts = array_map( + function ($contact) { + $contact = Model\Contact::selectFirst( + [], + ['uri-id' => $contact['uri-id'], 'uid' => [0, $this->userSession->getLocalUserId()]], + ['order' => ['uid' => 'DESC']] + ); + return Module\Contact::getContactTemplateVars($contact); + }, + $friends + ); $tpl = Renderer::getMarkupTemplate('profile/contacts.tpl'); $o .= Renderer::replaceMacros($tpl, [