jrtderonde

$page->children() unpublished pages are still shown ...

Recommended Posts

Hey,

I completely built this platform with ProcessWire (http://djmag.live/). It works fine except for the fact that some pages are still show, even when I change their state to "unpublished". They are still showing when they are returned through $object->children("template=_foo") or $pages->find("template=_foo").

 

Does anybody know what the problem might be? 

Share this post


Link to post
Share on other sites

Does that happen for all users or only when you're logged in as superuser?

Share this post


Link to post
Share on other sites

Maybe you have some more information? Code. Where is the code. What are those pages and how are they created? What is their status in DB? 

I can't think of anything that would cause this.

Share this post


Link to post
Share on other sites
$streams = $page->child("template=_streams")->children("template=_stream");

This is the chain that I use to get the pages.

Share this post


Link to post
Share on other sites

Hi,

$page->child already select the first child of the current page. I think there is no need to add any selector to it.

Gideon

Share this post


Link to post
Share on other sites

Since the informations are really spare, any chance to have a look at that? Or a db dump?

  • Like 1

Share this post


Link to post
Share on other sites

I've tested in PW 3.0.42 and it works as expected. Unpublished pages are not returned, whether I am logged in as a superuser or not. Seems there's something else going on in your install. 

  • Like 1

Share this post


Link to post
Share on other sites

I had a similiar problem. My mistake was that I only unpublished the parent, not the actual pages that I queried for with get/find.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By awesomolocity
      Alright. So I'm converting a site I already have to Processwire (really enjoying it so far!). I wanted to convert the previous tables that I had data in to Processwire pages. But I'm wondering what the optimal way to structure pages would be.
       
      So basically, I have three main tables.
      Users (and all accompanying information)
      Items (and all accompanying information)
      Aquariums (each user only has 1 aquarium. Currently, user_id is a FK)
      Fish (type of item. Aquariums may have multiple fish)
      Aqua_settings (Things like lightness, temperature, etc)
       
      So in my current setup, there are a lot of Foreign Keys. I could accomplish essentially the same thing by using the Page Reference field.
      Alternatively, I could make fish and aqua_settings both be children of Aquarium. I could differentiate by doing $aquarium->children('template=aqua_settings'); or something.
       
      So my question is...should I be using the Page Reference field or structuring the pages as children? (Or are both equally fine depending on how I want to go about doing things)
    • By csaba
      Hello,
      Pleased to meet you,my name is Csaba and I'm from Hungary.
      I've just installed processwire to more places.
      I created new parent and children pages.
      The children page links are not displayed on the right side of the parent pages.
      The sample About page is ok, Child page example 1 and Child page example 2 links are visible and live.
      But my child pages are not displayed on the parent pages.
      Please help!
       
    • By Sipho
      I wish to access a template's allowed templates for it's children from the API. This one:

      I am pretty sure this is possible, but I can't seem to find it anywhere in the documentation. If this is not possible, is there some way of assigning properties to templates? So like fields that already have a value on all pages using that template.
    • By Peter Knight
      I have a new challenge - outputting the grandchild pages of 3 children (simple enough) but confine the display of each grandchild under it's parent heading.
      Will try explain...
      My tree looks like this:
      Foods  (where I want to mirror the structure below in a table)

         - Fruit (Child of Foods and Level 2 Parent)
         - -  Apple 
         - -  Banana
         - -  Orange

         - Vegetable (Child of Foods and Level 2 Parent)
         - -  Carrot
         - -  Potato
         - -  Cauliflower
         - Meats (Child of Foods and Level 2 Parent)
         - -  Beef
         - -  Pork
         - -  Chicken
      Lets say "Foods" is the parent.
      Fruit, Veg and Meat are children.
      Apple, Bananna etc are grand children
       
       
      I have the Foods template working to an extent but it's doing the following. IE it's 
      Fruit
      - -  Apple
      - -  Banana
      - -  Orange
      - -  Carrot
      - -  Potato
      - -  Cauliflower 
      - -  Beef
      - -  Pork
      - -  Chicken

      Vegetable
      - -  Apple
      - -  Bananna
      - -  Orange
      - -  Carrot
      - -  Potato
      - -  Cauliflower 
      - -  Beef
      - -  Pork
      - -  Chicken

      Meats
      - -  Apple
      - -  Bananna
      - -  Orange
      - -  Carrot
      - -  Potato
      - -  Cauliflower 
      - -  Beef
      - -  Pork
      - -  Chicken
       
      This is my effort so far.
      <?php // the children of this page $products = $page->children(); foreach ($products as $prod){ // Create a table for each child page echo" <div> <div class='prod-ov-wrapper'> <div class='prod-ov-text'> {$prod->title} <table class='uk-table uk-table-divider' border=1> <thead> <tr> <th>Part No.</th> <th>Length</th> <th>Break Force</th> <th>Width</th> <th>Colour</th> </tr> </thead> <tbody> "; // populate the table with details of the children of each child $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo" <tr> <td>{$prodDetail->prod_partNo}</td> <td>{$prodDetail->prod_length}</td> <td>{$prodDetail->prod_breakForce}</td> <td>{$prodDetail->prod_width}</td> <td>{$prodDetail->title}</td> </tr> ";} echo" </tbody> </table> </div> </div> </div> ";} ?>  
      I've tried a couple of things over the last few hours and just can't quite understand the API call I need at 
      $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo"  
      is there a way to do this? I suspect I am close but need to add another variable in there?
       
       
       
       
       
       
       
       
       
       
       
    • By AndZyk

      The Fotomediale is a annual festival of photography for children's and youth photography in Freiburg, Germany. This small website provides information about the festival and its workshops. Because of the topic, this site is very picture heavy. Almost every page contains it own set of images displayed in the background. The images cycle through automatically, but you can also use the buttons on the edges (or if you want arrow keys on your keyboard ). If you want to see the images, you can collapse both the navigation and content area.
      The transitions between pages were made with Ajax and pushState, but you can also access them directly via their URL. To handle the large image backgrounds, all of the images are lazy loaded using lazysizes. The registration form was created using the API.
      www.fotomediale.de
      Modules used:
      ProCache Markup Sitemap XML Email Obfuscation (EMO) Tracy Debugger Regards, Andreas