J4 and the JUserHelper::removeUserFromGroup method

pastvne

Bruce Decker
I realize this is really a Joomla question but I've, so far, been unable to get an answer on Joomla's doc site or forums. I have some eval code that was working in J3:

Code:
$cspResult = JUserHelper::removeUserFromGroup($thisUserId, $thisGroupId);

And I see this Fabrik 3 forum post from Troester: https://www.fabrikar.com/forums/ind...lement-with-validation-php.51554/#post-269224

This now throws this error (which seems to be unrelated) if I call that method:

An error has occurred with a eval'd field - please inform the web-site owner. Debug: Caught exception on eval of : Joomla\CMS\Factory::getUser() is deprecated. Load the user from the dependency injection container or via Joomla\CMS\Factory::getApplication()->getIdentity().

It is odd, because I'm not calling the getUser method but if comment out the call to the removeUserFromGroup method, the error goes away.

Anyone in this forum know where I might look to learn more about where this method went in J4?

Best,
Bruce
 
Last edited:
I believe you received an answer on the JUserHelper on the joomla developers forum. If that wasn't you then head on over there and you will find your answer.
 
Thank you both. It appears that the answer I got on the J! forum works in PHP. Troester is also correct that turning off Joomla debug prevents the deprecation message. I thought in my testing that if I removed the call to the removeUserFromGroup that it no longer threw the deprecation warning, and that threw me off. However, I did turn off Joomla debug and the message no longer appears, even if I called removeUserFromGroup. For my purposes, I'm content to move forward and I surely appreciate your help!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top