WordPress.org

Ready to get started?Download WordPress

Forums

No Private Page parent shown to add private child to (4 posts)

  1. alarch
    Member
    Posted 5 years ago #

    I'm using Wp-sentry (excellent plugin!) to create members only (private) pages. However, when I come to add private child pages to parent private pages none of the private pages are displayed on the drop-down list (that defaults to "Main Page (no parent)") found under "Attributes" and "Parent:". I have contacted the author of WP-Sentry and he believes that this is a bug with 2.7. Is anyone aware of a workaround, to allow display and selection of all private as well as public pages in the drop-down list? Even if you don't have a solution I'd be grateful if you could point me in the direction of the files in the core where this list is collated.

    As it stands I'm having to make the parent pages public temporarily before adding the private child page, and then changing the parent back to private. Furthermore, the same tedious routine has to be repeated every time I edit the child or parent private page.

  2. MichaelH
    Member
    Posted 5 years ago #

    Bug reported at http://trac.wordpress.org/ticket/8592

    Use your forum login/password to leave a comment there if you are of the mind.

  3. alarch
    Member
    Posted 5 years ago #

    Thanks - the ticket you mention is very useful.

    A temporary fix until this issue is addressed properly involves amending line 2168 (within get_pages() function) in version 2.7 WordPress wp-includes/post.php to:

    $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND (post_status = 'publish' OR post_status = 'private')) $where ";

    However, although this does the job of displaying private posts in the drop-down list of parent pages, there may be unwanted effects elsewhere. get_pages() is called in four places:

    http://lab.yukei.net/wp-trunk/nav.html?wp-includes/post-template.php.source.html

    get_pages() is also called by wp_list_pages for instance (in post.php also). So, you may end up with private pages displaying to all comers in your menu bar or Pages widget.

    So, discretion is the order of the day I think.

  4. PeteHoliday
    Member
    Posted 5 years ago #

    However, although this does the job of displaying private posts in the drop-down list of parent pages, there may be unwanted effects elsewhere.

    Yes. You might be better off, if this is a temporary fix, to make a copy of the wp_dropdown_pages and get_pages wp_dropdown_pages and only call them from the page where the dropdown is created, otherwise you'll definitely have those private pages listed out in unwanted places.

Topic Closed

This topic has been closed to new replies.

About this Topic