I see in admin SP simple portfolio: Warning: Undefined variable $userId in /www/doc/www.projectevents.cz/www/administrator/components/com_spsimpleportfolio/views/items/tmpl/default.php on line 121
Undefined variable $userId in backend view (Joomla 5.4)
Accepted answer
Marked as the solutionHi
You can now close this post by accepting the answer.
Thanks for accepting the answer.
3 more replies
Actually this warning show just for administrator acccess not for superusers.
I found the cause of the warning:
Undefined variable $userId in /administrator/components/com_spsimpleportfolio/views/items/tmpl/default.php
The view template uses the variable $userId several times, but it was never initialized.
Adding the following line solved the issue on my installation:
$userId = (int) $user->id;
After this adjustment, the warning no longer appears for non–SuperUser backend accounts.
If possible, could you please include this initialization in a future update of the component?
It would help prevent the warning on Joomla 4/5 installations running PHP 8+.
Hi,
Thanks for reaching out and sorry for your issue. I'm glad to hear that you've resolved it. I'll inform our team about the situation.
-Regards.