Undefined Variable $userId In Backend View (Joomla 5.4) - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Undefined Variable $userId In Backend View (Joomla 5.4)

S

simplyGD

Extension 5 days ago

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

0
5 Answers
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 3 days ago #212552

Hi

You can now close this post by accepting the answer.

0
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 3 days ago #212555

Thanks for accepting the answer.

0
S
simplyGD
Accepted Answer
5 days ago #212233

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

0
S
simplyGD
Accepted Answer
5 days ago #212239

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

0
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 5 days ago #212248

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.

0