Query two Entities

I would like to query two entities at the same time. Lets say I want to get all the entities "images" where (User Object) user->status = 'active'.

I use to do this like the following:

https://elgg.org/discussion/view/2705400/list-photos-entities-based-on-users-metadata

but this way has been deprecated.