jrtderonde

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

13 posts in this topic

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

But does this answer the question why "unpublished pages are still shown"? I'm uncertain

Share this post


Link to post
Share on other sites

I looked at this example and tested if it still included the unpublished pages, unfortunately it did. 

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?

1 person likes this

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. 

1 person likes this

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 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
    • By muzzer
      I just had a duh! moment and thought I should share as it may be useful to others, especially PW beginners. I know a lot of you will go "yeah well duh...." and yeah, well I feel like a bit of an idiot but anyways....
      I had a page outputting a table detailing data from about 200 records (PW pages). For each record it searched for child pages of a certain template, probably averaging 3 child pages per record and added some data from those pages to each row of the table. Simple stuff.
      The page was averaging about 12 seconds to load. Anyway, today I got frustrated enough to try to work out why it was so slow. Turns out I realised that the child pages I was searching for were all direct children, so I changed my search method from
      $pages->get(....)->find(.....) to
      $pages->get(.....)->children(.....) and blow me down the page load has gone from 12 seconds to a tad over 1 second. Turns out each child page had many child pages of their own (thousand of pages in total) and all these were being searched with the find() method. Stupid mistake, but I think right from the beginning of my learning of PW the find() method was ingrained.
      So hopefully this helps some newbies and others like me. Check out
      http://cheatsheet.processwire.com/page/built-in-methods-reference/page-find-selector/
      and 
      http://cheatsheet.processwire.com/page/built-in-methods-reference/page-children-selector/
      for more info on these methods and others.
       
       
    • By alexcapes
      <?$work_pages = new PageArray();?> <?$project_1 = $pages->get("parent=/work/projects, limit=1, sort=sort"); $work_pages->add($project_1); // Code for Project 1 goes here $project_2 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort"); $work_pages->add($project_2); // Code for Project 2 goes here $project_3 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort"); $work_pages->add($project_3); // Code for Project 3 goes here // etc I have the above code which gets project pages then adds the project to an array to exclude from the next selector.
      I'm sure this was working fine but seems to have started including unpublished pages - if I unpublish or hide pages they still show up. I've done some troubleshooting and have excluded any caching issues - the code is definitely pulling in unpublished pages.
      Working on Processwire 2.8.35. 
       
    • By kuba2
      Hello
      Real Beginner here. I am trying to loop the children of a product ( Keramik ) I have. They should look as an image with text underneath ( Example with bicycle tires ). I create for each product an own child page .
      I can't get my head around this...
       
      Thanks for all the help.
       
      Jakob
       
      I would like to have 3 Images with text on each row

       
      My structure:
       

       
      Each child has a Title, img and description
       

    • By alexcapes
      I have a PageTable field (editions) that I need to access the top page even if the page is unpublished:
      $page->editions[0]->id This throws up an error when the top page is unpublished, however works fine when it's published.
      I know I can't access the pages as children because the PageTable order differs from the child order, and I need the top page as it is in the PageTable field.
      Any ideas how I may be able to do this?