MoritzLost Posted November 11, 2018 Share Posted November 11, 2018 I'm trying to build a bitwise filter for a database query for my textformatter module, and I stumbled over some page statuses I don't quite understand: /** * Page has pending draft changes (name: "draft"). * #pw-internal * */ const statusDraft = 64; /** * Page has version data available (name: "versions"). * #pw-internal * */ const statusVersions = 128; If I'm not mistaked, there's no way to create multiple draft of a page in the ProcessWire core without module, is that correct? I initially assumed was the status assigned to unpublished pages, but the unpublished status corresponds to id 2048. Is the only way to create drafts with the ProDrafts module? For my purposes, I just need to understand how I should treat those statuses. I'm trying to get all pages that are published and either hidden or not hidden (I want to make this configurable). Do I need to exclude pages that have the statusDraft, or statusVersions? Only one of them? Only in combination with other statuses? Or can I safely ignore those (so it's fine if the pages have the status or not)? I don't own the ProDrafts module, so I can't check the code to see how individual drafts are stored and how the draft ids correspond to the published id. Any insight into those statuses is appreciated. Thanks in advance! Link to comment Share on other sites More sharing options...
horst Posted November 12, 2018 Share Posted November 12, 2018 Hi Moritz, not totally sure, but I think for your textformatter, you only need to know the equivalent of $page->viewable(). Im on mobile, so no further links here. Link to comment Share on other sites More sharing options...
MoritzLost Posted November 12, 2018 Author Share Posted November 12, 2018 Hi horst, thanks for the reply! I'll use that check to make sure no pages are linked that shouldn't be visible. However, I would still like to filter out pages with statuses that will never be viewable. I'm querying the database directly to get a list of pages for performance reasons. Since I'm performing one costly regex per title, I would like to only get the pages that are actually published & viewable, so I still need to understand all status IDs to determine whether they're relevant for the bitmask ... I looked into what checks $page->viewable perfoms, but haven't been able to find a reference to the IDs for "draft" and "versions", so maybe they are not relevant after all? 1 Link to comment Share on other sites More sharing options...
horst Posted November 12, 2018 Share Posted November 12, 2018 4 hours ago, MoritzLost said: I looked into what checks $page->viewable perfoms, but haven't been able to find a reference to the IDs for "draft" and "versions", so maybe they are not relevant after all? I think this is a question for @ryan (?) 1 Link to comment Share on other sites More sharing options...
MoritzLost Posted November 18, 2018 Author Share Posted November 18, 2018 @horst Or for anyone who owns the module and can tell me what's going on there ^^ Link to comment Share on other sites More sharing options...
arjen Posted November 19, 2018 Share Posted November 19, 2018 Have you noticed those statuses are marked as internal? I guess this is for use of ProDrafts. I can check later tonight how this module uses these statuses. 3 Link to comment Share on other sites More sharing options...
arjen Posted November 19, 2018 Share Posted November 19, 2018 Yup, these are used in ProDrafts. See attached files. I guess you can use them as wel, but since they are marked internal I would not rely heavily and them and in general usage should be avoided. 2 Link to comment Share on other sites More sharing options...
MoritzLost Posted November 19, 2018 Author Share Posted November 19, 2018 Hey @arjen, thanks for the reply! I don't want to use them myself, I just need to make sure I don't included unpublished pages or drafts in my module (see link above). But I've added some additional checks for that purpose now, and I guess the draft module will surely add the correct status for unpublished drafts, so it should be ok. Anyway, thanks for your help! 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