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

git-svn-id: http://svn.automattic.com/wordpress/trunk@18136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-06-03 23:30:46 +00:00
parent 6f3fdf244e
commit 9a023b8378
1 changed files with 12 additions and 12 deletions

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 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. * @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 = '' ) { function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
global $submenu; 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
if ( current_user_can('edit_users') ) 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); 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 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. * @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 = '' ) { 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 ); return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function );