Hello :-)
On my Joomla-CLI-Script I would like to fetch all user-ids which belong to a specific group.
My script so far:
// $groups = groups that are set in global params
if(!empty($groups));
{
foreach($groups as $group) :
$groupmembers = JAccess::getUsersByGroup($group);
foreach($groupmembers as $groupmember) :
$user = JFactory::getUser($groupmember);
$userarray[] = array( "email" => $user->email,
"userid" => $user->id);
endforeach;
endforeach;
}
Now I'm getting this error: Trying to get property of non-object in /var/www/web1/htdocs/libraries/joomla/factory.php on line 246
When I edit factory.php and go to line 246, I'm getting this line:
elseif (is_string($id) || $instance->id !== $id)
So I guess my CLI does not create an instance - but how can I do that?