From fca1abbafe5656047db9d47bfb6974af60180463 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 17 Dec 2022 00:37:40 -0500 Subject: [PATCH] Retrieve contact records for the page visitor in Profile\Contacts module --- src/Module/Profile/Contacts.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Module/Profile/Contacts.php b/src/Module/Profile/Contacts.php index 81ccd500d..f8cfe37ef 100644 --- a/src/Module/Profile/Contacts.php +++ b/src/Module/Profile/Contacts.php @@ -113,9 +113,17 @@ class Contacts extends Module\BaseProfile $params = ['order' => ['name' => false], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]]; + // Contact list is obtained from the visited profile user, but the contact display is visitor dependent $contacts = array_map( - [Module\Contact::class, 'getContactTemplateVars'], - Model\Contact::selectToArray([], $condition, $params) + function ($contact) { + $contact = Model\Contact::selectFirst( + [], + ['uri-id' => $contact['uri-id'], 'uid' => [0, $this->userSession->getLocalUserId()]], + ['order' => ['uid' => 'DESC']] + ); + return Module\Contact::getContactTemplateVars($contact); + }, + Model\Contact::selectToArray(['uri-id'], $condition, $params) ); $desc = '';