I was refactoring some code in an older component and I came across this warning:
Strict standards: Non-static method JUserHelper::getProfile() should not be called statically, assuming $this from incompatible context
$userProfile = JUserHelper::getProfile($userId);
While I do understand the technical nature of the warning, as getProfile
is not declared static
, JUserHelper
is abstract, so it cannot be instantiated.
Curiously all other methods in the class are define as static
. Looks like a bug in 2.5 to me as in 3.x the signature is different.
So what is the proper way to get the profile?
JUserHelper::getProfile()
, or would you be able to get by withJFactory::getUser()
instead?