FlorianA Posted February 24, 2018 Share Posted February 24, 2018 It's easy to select all users who have a certain role. E. g.: users('roles=foo|bar') selects all users who have at least one of the roles "foo" or "bar". But I failed doing the opposite: selecting all users who don't have role "foo" or don't have role "bar". I even don't manage the case with only one role. Any ideas? Link to comment Share on other sites More sharing options...
adrian Posted February 24, 2018 Share Posted February 24, 2018 Working for me - what's your code? I know you say it's not working even for one role, but remember if for negative selection you want AND and not OR for multiple roles. Link to comment Share on other sites More sharing options...
FlorianA Posted February 25, 2018 Author Share Posted February 25, 2018 23 hours ago, adrian said: Working for me - what's your code? For one role I've tried these four cases, none of them filtered out any user with role "foo": !roles=foo roles!=foo !roles.name=foo roles.name!=foo Link to comment Share on other sites More sharing options...
adrian Posted February 25, 2018 Share Posted February 25, 2018 @FlorianA - the roles!=foo works for me What version of PW are you running? I wonder if something was fixed in dev (assuming you are running master). Link to comment Share on other sites More sharing options...
Christophe Posted February 25, 2018 Share Posted February 25, 2018 (edited) Hi @FlorianA, Could you post more details related to your piece of code? I have the impression that it's a little (missing) detail that's making it not working. Edited February 25, 2018 by Christophe Link to comment Share on other sites More sharing options...
adrian Posted February 25, 2018 Share Posted February 25, 2018 To avoid anything from your template file that might be contributing, can you try this in the Tracy Console panel: d(users('roles!=foo, roles!=bar')->each("name")); Link to comment Share on other sites More sharing options...
FlorianA Posted February 26, 2018 Author Share Posted February 26, 2018 21 hours ago, adrian said: To avoid anything from your template file that might be contributing, can you try this in the Tracy Console panel: Tracy Console? ... <google> ... Tracy Debugger ... Wow! What a wonderful tool! I should have discoverd that earlier. I think it would deserve a place on https://processwire.com/docs/tutorials/ Anyway, my problem persists even when trying the command above. My PW version is 3.0.61 1 Link to comment Share on other sites More sharing options...
adrian Posted February 26, 2018 Share Posted February 26, 2018 Glad you made friends with Tracy > My PW version is 3.0.61 That might be the problem. I would definitely recommend upgrading to the latest dev version. Many of us are using it on production sites and it will likely become 3.1 stable this week or next. 3 Link to comment Share on other sites More sharing options...
FlorianA Posted February 27, 2018 Author Share Posted February 27, 2018 It does work with dev version 3.0.93 Thanks a lot for your assistance, @adrian 1 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