XF 2.1 \XF::finder('XF:Thread') and fetch threads like GUEST ->with('Forum.Node.Permissions|)

Scandal

Well-known member
Hello all!
Well, I want to fetch some threads via the well known finder \XF::finder('XF:Thread').
If I wanted to fetch threads based on the permission of current visitor, I would use this:
PHP:
$visitor = \XF::visitor();

// [...]
$threads = \XF::finder('XF:Thread')->with('Forum.Node.Permissions|' . $visitor->permission_combination_id);

But, what about if I want statically to fetch threads like a guest? I mean, threads that only forum guests (not logged in) can see.

I want to use that code on a cron job, so I don't want to take into account permissions based on logged in visitor. Only guests.

Any idea of what to apply on the Finder?
 
PHP:
$visitor = \XF::em()->getRepository('XF:User')->getGuestUser();

// [...]
$threads = \XF::finder('XF:Thread')->with('Forum.Node.Permissions|' . $visitor->permission_combination_id);
 
Top Bottom