<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[17864] trunk: Rename submenus to not clash with top level menus.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17864">17864</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2011-05-11 20:09:28 +0000 (Wed, 11 May 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename submenus to not clash with top level menus. Introduce all_items CPT string, defaulting to menu_name. fixes <a href="http://trac.wordpress.org/ticket/17378">#17378</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (17863 => 17864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2011-05-11 19:04:28 UTC (rev 17863)
+++ trunk/wp-admin/menu.php        2011-05-11 20:09:28 UTC (rev 17864)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">
</span><span class="cx"> $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' );
</span><span class="cx">
</span><del>-$submenu[ 'index.php' ][0] = array( __('Dashboard'), 'read', 'index.php' );
</del><ins>+$submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
</ins><span class="cx">
</span><span class="cx"> if ( is_multisite() ) {
</span><span class="cx">         $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
</span><span class="cx">
</span><span class="cx"> $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
</span><del>-        $submenu['edit.php'][5] = array( __('Posts'), 'edit_posts', 'edit.php' );
</del><ins>+        $submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' );
</ins><span class="cx">         /* translators: add new post */
</span><span class="cx">         $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );
</span><span class="cx">
</span><span class="lines">@@ -91,13 +91,13 @@
</span><span class="cx">         $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
</span><span class="cx">
</span><span class="cx"> $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
</span><del>-        $submenu['link-manager.php'][5] = array( __('Links'), 'manage_links', 'link-manager.php' );
</del><ins>+        $submenu['link-manager.php'][5] = array( __('All Links'), 'manage_links', 'link-manager.php' );
</ins><span class="cx">         /* translators: add new links */
</span><span class="cx">         $submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );
</span><span class="cx">         $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
</span><span class="cx">
</span><span class="cx"> $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' );
</span><del>-        $submenu['edit.php?post_type=page'][5] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page' );
</del><ins>+        $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
</ins><span class="cx">         /* translators: add new page */
</span><span class="cx">         $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
</span><span class="cx">         $i = 15;
</span><span class="lines">@@ -114,6 +114,8 @@
</span><span class="cx"> $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' );
</span><span class="cx"> unset($awaiting_mod);
</span><span class="cx">
</span><ins>+$submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );
+
</ins><span class="cx"> $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
</span><span class="cx">
</span><span class="cx"> foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) {
</span><span class="lines">@@ -137,7 +139,7 @@
</span><span class="cx">                 $ptype_menu_position++;
</span><span class="cx">
</span><span class="cx">         $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
</span><del>-        $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
</del><ins>+        $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
</ins><span class="cx">         $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" );
</span><span class="cx">
</span><span class="cx">         $i = 15;
</span><span class="lines">@@ -180,7 +182,7 @@
</span><span class="cx">         $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' );
</span><span class="cx">                 if ( ! is_multisite() ) {
</span><span class="cx">                         /* translators: add new plugin */
</span><del>-                        $submenu['plugins.php'][5] = array( __('Plugins'), 'activate_plugins', 'plugins.php' );
</del><ins>+                        $submenu['plugins.php'][5] = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
</ins><span class="cx">                         $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );
</span><span class="cx">                         $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
</span><span class="cx">                 }
</span><span class="lines">@@ -194,7 +196,7 @@
</span><span class="cx">
</span><span class="cx"> if ( current_user_can('list_users') ) {
</span><span class="cx">         $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
</span><del>-        $submenu['users.php'][5] = array(__('Users'), 'list_users', 'users.php');
</del><ins>+        $submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');
</ins><span class="cx">         if ( current_user_can('create_users') )
</span><span class="cx">                 $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
</span><span class="cx">         else
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (17863 => 17864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2011-05-11 19:04:28 UTC (rev 17863)
+++ trunk/wp-includes/post.php        2011-05-11 20:09:28 UTC (rev 17864)
</span><span class="lines">@@ -1166,6 +1166,7 @@
</span><span class="cx">                 'not_found' => array( __('No posts found.'), __('No pages found.') ),
</span><span class="cx">                 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
</span><span class="cx">                 'parent_item_colon' => array( null, __('Parent Page:') ),
</span><ins>+                'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) )
</ins><span class="cx">         );
</span><span class="cx">         $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
</span><span class="cx">         return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
</span><span class="lines">@@ -1188,6 +1189,9 @@
</span><span class="cx">         if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) )
</span><span class="cx">                 $object->labels['menu_name'] = $object->labels['name'];
</span><span class="cx">
</span><ins>+        if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) )
+                $object->labels['all_items'] = $object->labels['menu_name'];
+
</ins><span class="cx">         foreach ( $nohier_vs_hier_defaults as $key => $value )
</span><span class="cx">                         $defaults[$key] = $object->hierarchical ? $value[1] : $value[0];
</span><span class="cx">
</span><span class="lines">@@ -1207,7 +1211,7 @@
</span><span class="cx">                 // Submenus only.
</span><span class="cx">                 if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true )
</span><span class="cx">                         continue;
</span><del>-                add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
</del><ins>+                add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_menu', '_add_post_type_submenus' );
</span></span></pre>
</div>
</div>
</body>
</html>