UserGroupsHelper error

Skip to first unread message

Glenn Arkell

Feb 17, 2019, 9:57:12 PM2/17/19
to Joomla! CMS Development
Hi Guys,
I'm trying to use UserGroupsHelper with the following code:

$ugr = UserGroupsHelper::get(2);

but get this error:

Using $this when not in object context
# Function Location
1 () JROOT\libraries\src\Helper\UserGroupsHelper.php:125

Is this a bug or am I doing something wrong?  Cheers.

Michael Babker

Feb 18, 2019, 12:13:38 PM2/18/19
You need an instance of the class, you are calling the method statically.

UserGroupsHelper::getInstance()->get(2) or (new UserGroupsHelper)->get(2) will work correctly.

You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Glenn Arkell

Feb 18, 2019, 4:20:56 PM2/18/19
to Joomla! CMS Development
Thanks Michael, you're a gem.  Cheers.
Reply all
Reply to author
0 new messages