cpx3 Posted January 13, 2023 Share Posted January 13, 2023 Hi to all, I have a very annoying problem: The selector $p = $pages->get("template=data-newsletter-subscribers,email=$strMail"); will always find and update pages that are trashed, even if there exists a none trashed version. What am I doing wrong? Thanks in advance, Bernhard Link to comment Share on other sites More sharing options...
zoeck Posted January 13, 2023 Share Posted January 13, 2023 ? Link to comment Share on other sites More sharing options...
szabesz Posted January 13, 2023 Share Posted January 13, 2023 6 hours ago, cpx3 said: $p = $pages->get("template=data-newsletter-subscribers,email=$strMail"); 5 hours ago, cpx3 said: What am I doing wrong? Hello, Probably, it is the find() or a "similar method" (which also begins with the word find) is the one which you should use, not get(), see: https://processwire.com/api/ref/pages/ $pages->get() : Returns the first page matching the given selector with no exclusions. Meaning with get() you get one page only without checking any kind of status nor access control. Link to comment Share on other sites More sharing options...
adrian Posted January 16, 2023 Share Posted January 16, 2023 findOne() Link to comment Share on other sites More sharing options...
cpx3 Posted January 17, 2023 Author Share Posted January 17, 2023 Thanks! :) 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