Can not use Factory::getUsersByGroup on Joomla CLI-Script

34 views
Skip to first unread message

Timotheus Titus

unread,
Jun 30, 2015, 4:29:20 AM6/30/15
to joomla-de...@googlegroups.com
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?

Michael Babker

unread,
Jun 30, 2015, 8:22:28 AM6/30/15
to joomla-de...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages