Document that add_submenu_page() might return false if ! current_user_can(). see #17677.

git-svn-id: https://develop.svn.wordpress.org/trunk@18136 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-06-03 23:30:46 +00:00
parent e1e318b9ff
commit 4e3cdbfc61

View File

@ -963,7 +963,7 @@ function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
global $submenu;
@ -1027,7 +1027,7 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1048,7 +1048,7 @@ function add_management_page( $page_title, $menu_title, $capability, $menu_slug,
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1069,7 +1069,7 @@ function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1090,7 +1090,7 @@ function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1111,7 +1111,7 @@ function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
if ( current_user_can('edit_users') )
@ -1135,7 +1135,7 @@ function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1156,7 +1156,7 @@ function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug,
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1177,7 +1177,7 @@ function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1198,7 +1198,7 @@ function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1219,7 +1219,7 @@ function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function );
@ -1240,7 +1240,7 @@ function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
*
* @return string The resulting page's hook_suffix
* @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function );