Set up some contacts and enable users to edit their own contact details in the frontend.
Log in to frontend and go to contacts list page.
Contacts are displayed as a table with edit link for the contact details of the logged in user.
This does happen but there are PHP warnings displayed (if so configured)
PHP warnings displayed:
Warning: Undefined variable $item in C:\xampp-8-0\htdocs\joomla-4\components\com_contact\tmpl\category\default_items.php on line 85
Warning: Attempt to read property "created_by" on null in C:\xampp-8-0\htdocs\joomla-4\components\com_contact\tmpl\category\default_items.php on line 85
Joomla version: Joomla! 4.2.7 Stable [ Uaminifu ] 31-January-2023 15:00 GMT
Web server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.0.25
PHP version: 8.0.25
Database version: mysql 10.4.27-MariaDB
The problem is that when the table header is created the decision as to whether to create the edit column heading (line 85) is the same as the decision whether to show an edit link in each table row (line 186) which depend on whether the current row is the the current user's details.
The test && $item->created_by === $userId)
should be removed from line 85.
Patched file attached.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-02-08 22:34:01 |
Closed_By | ⇒ | chmst |
Thank you! Would you like to make a PR for that, as you have already identified the error?