#6939 closed enhancement (duplicate)
wp_list_pages() should also lists private pages if the user has capability 'read_private_pages'
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.5.1 |
Component: | Template | Keywords: | has-patch featured gsoc needs-testing |
Focuses: | Cc: |
Description
If the user has the capability "read_private_pages" wp_list_pages() don't lists private pages in no way. I've noticed this problem by some comments on my "Role Manager" Plugin page.
Two patches are attached to this ticket.
wp_list_pages() gets a new option "include_private_pages". The default value is 1 for lists private pages too if the user has the capability "read_private_pages".
If private pages should not be listed also if the user has the cap "read_private_pages" the syntax is as an example:
wp_list_pages('title_li=<h2>Pages</h2>&include_private_pages=0');
The second patch is for get_pages() - with the same option and default value.
And of course: if a user don't has the cap "read_private_pages" private pages are listed in no case :)
Attachments (3)
Change History (23)
#1
@
15 years ago
This is a very useful patch!
I think it should be included in Wordpress.
Works like a charm for me.
#3
@
15 years ago
Don't know if this help, but I can confirm that this bug is still present in WordPress 2.6.
#4
@
15 years ago
- Keywords has-patch added
I agree that this is a very useful patch and should be included in the next release. That is the one thing I have to change in the core after each update, although I use:
... WHERE (post_type = 'page' AND " . get_private_posts_cap_sql('page') . ") ...
The get_private_posts_cap_sql
function does basically the same as in the patch here, but is already included in Wordpress and additionally lists the user's own private pages, even if they have no permission to read private posts.
#5
@
14 years ago
- Keywords neesd-patch close added; has-patch removed
- Milestone changed from 2.9 to Future Release
- Type changed from defect (bug) to enhancement
suggesting wontfix, personally. private pages don't belong in that menu. or then:
- we should at least add an option to show them, off by default, for performance reasons
- we may gain advantage to grab all pages, private or not, and use the walker to remove the private ones
#7
@
14 years ago
Respectfully disagreeing; private pages absolutely do belong in this menu. Where else would they go? Most sites have a single navigation menu. It makes sense to include the private pages there when needed rather than requiring a separate menu for them.
#14
@
13 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch gsoc needs-testing added; needs-patch wp_list_pages read_private_pages removed
#16
follow-up:
↓ 17
@
9 years ago
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #8592.
#17
in reply to:
↑ 16
@
8 years ago
Replying to nacin:
Duplicate of #8592.
Is this a duplicate of that ticket or just related?
This ticket relates to wp_list_pages().
That ticket relates to wp_dropdown_pages().
Both functions use get_pages() - I guess in that respect they are duplicates, but should they be considered separately (or in tandem) as wp_dropdown_pages() is used for page->parent management in core and may have more related issues, whereas wp_list_pages() is primarily a front-end function... or am I assuming too much there?
#18
@
8 years ago
I don't quite understand why this ticket is closed? Has there been a regression?
I am using WordPress 4.1.1
A plugin I am using uses wp_list_pages (according to @husobj who is the author) to do its thing and when I use it, private pages don't get displayed even though I am logged in (as the admin).
#19
follow-up:
↓ 20
@
8 years ago
@husobj, @marjanvenema: The ticket was marked as a duplicate of #8592, which just means discussion should happen over on the other ticket.
To answer @husobj's question: You're basically spot on. The reason why it's a duplicate is because the change (if it happens) is going to happen in get_pages()
, which both functions use.
#20
in reply to:
↑ 19
@
8 years ago
Replying to DrewAPicture:
To answer @husobj's question: You're basically spot on. The reason why it's a duplicate is because the change (if it happens) is going to happen in
get_pages()
, which both functions use.
Thanks for clarifying :)
Patch for wp-includes/post-template.php