Undefined variable $userId in backend view (Joomla 5.4) - Forum | JoomShaper
Solved Extensions

Undefined variable $userId in backend view (Joomla 5.4)

Asked by simplyGD 9 months ago Last activity 9 months ago

Accepted answer

Marked as the solution
Mehtaz Afsana Borsha Staff

Hi

You can now close this post by accepting the answer.

Mehtaz Afsana Borsha Staff

Thanks for accepting the answer.

3 more replies

simplyGD Asked this

Actually this warning show just for administrator acccess not for superusers.

simplyGD Asked this

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+.

Mehtaz Afsana Borsha Staff

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.

Log in to reply.