UserGroupsHelper error

67 views
Skip to first unread message

Glenn Arkell

unread,
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.
Glenn


Michael Babker

unread,
Feb 18, 2019, 12:13:38 PM2/18/19
to joomla-...@googlegroups.com
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 joomla-dev-cm...@googlegroups.com.
To post to this group, send email to joomla-...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-cms.
For more options, visit https://groups.google.com/d/optout.

Glenn Arkell

unread,
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
Forward
0 new messages