Opened 5 years ago
Last modified 2 years ago
#6939 new enhancement
wp_list_pages() should also lists private pages if the user has capability 'read_private_pages'
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Template | Version: | 2.5.1 |
| Severity: | normal | Keywords: | has-patch featured gsoc needs-testing |
| Cc: | steph@…, sirzooro, WordPress@…, wojtek.szkutnik@… |
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 (18)
imwebgefunden
— 5 years ago
comment:1
chodo
— 5 years ago
This is a very useful patch!
I think it should be included in Wordpress.
Works like a charm for me.
comment:3
Coolkevman
— 5 years ago
Don't know if this help, but I can confirm that this bug is still present in WordPress 2.6.
comment:4
rovo89
— 5 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.
comment:5
Denis-de-Bernardy
— 4 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
comment:6
Denis-de-Bernardy
— 4 years ago
- Keywords needs-patch added; neesd-patch removed
comment:7
sillybean
— 4 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.
comment:10
sirzooro
— 3 years ago
- Cc sirzooro added
comment:11
voyagerfan5761
— 3 years ago
- Cc WordPress@… added
comment:12
Denis-de-Bernardy
— 3 years ago
- Keywords bug-hunt added
comment:13
Denis-de-Bernardy
— 3 years ago
- Keywords featured added; close bug-hunt removed
wojtek.szkutnik
— 3 years ago
comment:14
wojtek.szkutnik
— 3 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch gsoc needs-testing added; needs-patch wp_list_pages read_private_pages removed
Patch for wp-includes/post-template.php