Webrocker Posted July 21, 2015 Share Posted July 21, 2015 Hi, I just noticed that the following code // jury-portraits.php template file $jury_cats = $pages->find('template=jury_category,sort=sort'); // find users in each category $jury_portraits = array(); foreach($jury_cats as $cat){ $jury_portraits[] = array( 'cat' => $cat->name, 'title' => $cat->get('headline|title'), 'members' => $users->find('roles=awardjury,user_jury_category='.$cat.',sort=lastname') ); } // shortened for clarity foreach($jury_portraits as $jp){ // snip ... loops through the categories $jp['members']->each(function($jm ){ // snap ... do soemthing with title, image etc echo $jm->name; } } returns all users as intended, nicely grouped by my jury-categories. But now I "disabled" one user by unpublishing and hiding his page. I expected that the above would now return all users as expected, but without the unpublished one. But his infos were still visible; the $users->find() behaved exactly as with 'inlcude=all' or 'include=hidden' in the selector. Is there a way to explicitly state that I want to have only the published users? To me, the above translates to "give me all users who's role is "awardjury" and who's category is "foo"… but the "who are not unpublished" part is missing - and the only selector params I found are to allow all or hidden pages, not forbid them. ?? What am I missing? Cheers, Tom Link to comment Share on other sites More sharing options...
Soma Posted July 21, 2015 Share Posted July 21, 2015 I think since you can't unpublish users, Users find will find all anyway. $users->find("your selector here", $options = array("findAll" => false)); 2 Link to comment Share on other sites More sharing options...
Webrocker Posted July 21, 2015 Author Share Posted July 21, 2015 $users->find("your selector here", $options = array("findAll" => false)); Hi Soma, ah, thx for clearing This: ("can't unpublish users') was what I assumed/feared, why I actually _can_ unpublish users in the backend is apparently caused by me using own templates for those special users and not the system template *sigh ) thanks Tom UPDATE: Confirmed, with the ..., $options = array("findAll" => false) added, it works as expected and ignores hidden and or unpublished "users". Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now