<!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>[19429] trunk/wp-includes: Admin Bar: Secondary is so pass?\195?\169.</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://core.trac.wordpress.org/changeset/19429">19429</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2011-11-23 21:46:47 +0000 (Wed, 23 Nov 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Admin Bar: Secondary is so pass?\195?\169. Groups are the new black. fixes <a href="http://core.trac.wordpress.org/ticket/19136">#19136</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
<li><a href="#trunkwpincludesclasswpadminbarphp">trunk/wp-includes/class-wp-admin-bar.php</a></li>
<li><a href="#trunkwpincludescssadminbarrtldevcss">trunk/wp-includes/css/admin-bar-rtl.dev.css</a></li>
<li><a href="#trunkwpincludescssadminbardevcss">trunk/wp-includes/css/admin-bar.dev.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/admin-bar.php (19428 => 19429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php        2011-11-23 21:29:33 UTC (rev 19428)
+++ trunk/wp-includes/admin-bar.php        2011-11-23 21:46:47 UTC (rev 19429)
</span><span class="lines">@@ -90,8 +90,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Add WordPress.org link
</span><span class="cx">         $wp_admin_bar-&gt;add_menu( array(
</span><del>-                'parent'    =&gt; 'wp-logo',
-                'secondary' =&gt; true,
</del><ins>+                'parent'    =&gt; 'wp-logo-external',
</ins><span class="cx">                 'id'        =&gt; 'wporg',
</span><span class="cx">                 'title'     =&gt; __('WordPress.org'),
</span><span class="cx">                 'href'      =&gt; __('http://wordpress.org'),
</span><span class="lines">@@ -99,8 +98,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Add codex link
</span><span class="cx">         $wp_admin_bar-&gt;add_menu( array(
</span><del>-                'parent'    =&gt; 'wp-logo',
-                'secondary' =&gt; true,
</del><ins>+                'parent'    =&gt; 'wp-logo-external',
</ins><span class="cx">                 'id'        =&gt; 'documentation',
</span><span class="cx">                 'title'     =&gt; __('Documentation'),
</span><span class="cx">                 'href'      =&gt; __('http://codex.wordpress.org'),
</span><span class="lines">@@ -108,8 +106,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Add forums link
</span><span class="cx">         $wp_admin_bar-&gt;add_menu( array(
</span><del>-                'parent'    =&gt; 'wp-logo',
-                'secondary' =&gt; true,
</del><ins>+                'parent'    =&gt; 'wp-logo-external',
</ins><span class="cx">                 'id'        =&gt; 'support-forums',
</span><span class="cx">                 'title'     =&gt; __('Support Forums'),
</span><span class="cx">                 'href'      =&gt; __('http://wordpress.org/support/'),
</span><span class="lines">@@ -117,8 +114,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Add feedback link
</span><span class="cx">         $wp_admin_bar-&gt;add_menu( array(
</span><del>-                'parent'    =&gt; 'wp-logo',
-                'secondary' =&gt; true,
</del><ins>+                'parent'    =&gt; 'wp-logo-external',
</ins><span class="cx">                 'id'        =&gt; 'feedback',
</span><span class="cx">                 'title'     =&gt; __('Feedback'),
</span><span class="cx">                 'href'      =&gt; __('http://wordpress.org/support/forum/requests-and-feedback'),
</span><span class="lines">@@ -143,7 +139,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $wp_admin_bar-&gt;add_menu( array(
</span><span class="cx">                         'id'        =&gt; 'my-account',
</span><del>-                        'secondary' =&gt; true,
</del><ins>+                        'parent'    =&gt; 'top-secondary',
</ins><span class="cx">                         'title'     =&gt; $howdy . $avatar,
</span><span class="cx">                         'href'      =&gt; $profile_url,
</span><span class="cx">                         'meta'      =&gt; array(
</span><span class="lines">@@ -165,7 +161,6 @@
</span><span class="cx">                         'title'  =&gt; $user_info,
</span><span class="cx">                         'href'   =&gt; $profile_url,
</span><span class="cx">                         'meta'   =&gt; array(
</span><del>-                                'class' =&gt; 'user-info user-info-item',
</del><span class="cx">                                 'tabindex' =&gt; -1
</span><span class="cx">                         ),
</span><span class="cx">                 ) );
</span><span class="lines">@@ -174,18 +169,12 @@
</span><span class="cx">                         'id'     =&gt; 'edit-profile',
</span><span class="cx">                         'title'  =&gt; __( 'Edit My Profile' ),
</span><span class="cx">                         'href' =&gt; $profile_url,
</span><del>-                        'meta'   =&gt; array(
-                                'class' =&gt; 'user-info-item',
-                        ),
</del><span class="cx">                 ) );
</span><span class="cx">                 $wp_admin_bar-&gt;add_menu( array(
</span><span class="cx">                         'parent' =&gt; 'my-account',
</span><span class="cx">                         'id'     =&gt; 'logout',
</span><span class="cx">                         'title'  =&gt; __( 'Log Out' ),
</span><span class="cx">                         'href'   =&gt; wp_logout_url(),
</span><del>-                        'meta'   =&gt; array(
-                                'class' =&gt; 'user-info-item',
-                        ),
</del><span class="cx">                 ) );
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -276,8 +265,13 @@
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         if ( is_super_admin() ) {
</span><ins>+                $wp_admin_bar-&gt;add_group( array(
+                        'parent' =&gt; 'my-sites',
+                        'id'     =&gt; 'my-sites-super-admin',
+                ) );
+
</ins><span class="cx">                 $wp_admin_bar-&gt;add_menu( array(
</span><del>-                        'parent' =&gt; 'my-sites',
</del><ins>+                        'parent' =&gt; 'my-sites-super-admin',
</ins><span class="cx">                         'id'     =&gt; 'network-admin',
</span><span class="cx">                         'title'  =&gt; __('Network Admin'),
</span><span class="cx">                         'href'   =&gt; network_admin_url(),
</span><span class="lines">@@ -309,7 +303,15 @@
</span><span class="cx">                 ) );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // Add blog links
</del><ins>+        // Add site links
+        $wp_admin_bar-&gt;add_group( array(
+                'parent' =&gt; 'my-sites',
+                'id'     =&gt; 'my-sites-list',
+                'meta'   =&gt; array(
+                        'class' =&gt; is_super_admin() ? 'ab-sub-secondary' : '',
+                ),
+        ) );
+
</ins><span class="cx">         $blue_wp_logo_url = includes_url('images/wpmini-blue.png');
</span><span class="cx"> 
</span><span class="cx">         foreach ( (array) $wp_admin_bar-&gt;user-&gt;blogs as $blog ) {
</span><span class="lines">@@ -321,8 +323,7 @@
</span><span class="cx">                 $menu_id  = 'blog-' . $blog-&gt;userblog_id;
</span><span class="cx"> 
</span><span class="cx">                 $wp_admin_bar-&gt;add_menu( array(
</span><del>-                        'parent'    =&gt; 'my-sites',
-                        'secondary' =&gt; is_super_admin(),
</del><ins>+                        'parent'    =&gt; 'my-sites-list',
</ins><span class="cx">                         'id'        =&gt; $menu_id,
</span><span class="cx">                         'title'     =&gt; $blavatar . $blogname,
</span><span class="cx">                         'href'      =&gt; get_admin_url( $blog-&gt;userblog_id ),
</span><span class="lines">@@ -480,7 +481,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) )
</span><del>-                $actions[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'new-user', true );
</del><ins>+                $actions[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'new-user', 'new-secondary-object' );
</ins><span class="cx"> 
</span><span class="cx">         if ( ! $actions )
</span><span class="cx">                 return;
</span><span class="lines">@@ -493,11 +494,10 @@
</span><span class="cx"> 
</span><span class="cx">         foreach ( $actions as $link =&gt; $action ) {
</span><span class="cx">                 list( $title, $id ) = $action;
</span><del>-                $secondary = ! empty( $action[2] );
</del><ins>+                $parent = empty( $action[2] ) ? 'new-content' : $action[2];
</ins><span class="cx"> 
</span><span class="cx">                 $wp_admin_bar-&gt;add_menu( array(
</span><del>-                        'parent'    =&gt; 'new-content',
-                        'secondary' =&gt; $secondary,
</del><ins>+                        'parent'    =&gt; $parent,
</ins><span class="cx">                         'id'        =&gt; $id,
</span><span class="cx">                         'title'     =&gt; $title,
</span><span class="cx">                         'href'      =&gt; admin_url( $link )
</span><span class="lines">@@ -599,6 +599,36 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Add secondary menus.
+ *
+ * @since 3.3.0
+ */
+function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) {
+        $wp_admin_bar-&gt;add_group( array(
+                'id'     =&gt; 'top-secondary',
+                'meta'   =&gt; array(
+                        'class' =&gt; 'ab-top-secondary',
+                ),
+        ) );
+
+        $wp_admin_bar-&gt;add_group( array(
+                'parent' =&gt; 'wp-logo',
+                'id'     =&gt; 'wp-logo-external',
+                'meta'   =&gt; array(
+                        'class' =&gt; 'ab-sub-secondary',
+                ),
+        ) );
+
+        $wp_admin_bar-&gt;add_group( array(
+                'parent' =&gt; 'new-content',
+                'id'     =&gt; 'new-secondary-object',
+                'meta'   =&gt; array(
+                        'class' =&gt; 'ab-sub-secondary',
+                ),
+        ) );
+}
+
+/**
</ins><span class="cx">  * Style and scripts for the admin bar.
</span><span class="cx">  *
</span><span class="cx">  * @since 3.1.0
</span></span></pre></div>
<a id="trunkwpincludesclasswpadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-admin-bar.php (19428 => 19429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-admin-bar.php        2011-11-23 21:29:33 UTC (rev 19428)
+++ trunk/wp-includes/class-wp-admin-bar.php        2011-11-23 21:46:47 UTC (rev 19429)
</span><span class="lines">@@ -12,10 +12,10 @@
</span><span class="cx">                         $this-&gt;proto = 'https://';
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;user = new stdClass;
</span><del>-                $this-&gt;root = new stdClass;
-                $this-&gt;root-&gt;children  = (object) array(
-                        'primary'   =&gt; array(),
-                        'secondary' =&gt; array(),
</del><ins>+                $this-&gt;root = (object) array(
+                        'id'       =&gt; 'root',
+                        'group'    =&gt; false,
+                        'children' =&gt; array(),
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 if ( is_user_logged_in() ) {
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">          * - title      - string    - The title of the node.
</span><span class="cx">          * - parent     - string    - The ID of the parent node. Optional.
</span><span class="cx">          * - href       - string    - The link for the item. Optional.
</span><del>-         * - secondary  - boolean   - If the item should be part of a secondary menu. Optional. Default false.
</del><ins>+         * - group      - boolean   - If the node is a group. Optional. Default false.
</ins><span class="cx">          * - meta       - array     - Meta data including the following keys: html, class, onclick, target, title.
</span><span class="cx">          */
</span><span class="cx">         public function add_node( $args ) {
</span><span class="lines">@@ -77,21 +77,22 @@
</span><span class="cx">                         $args = array_merge( array( 'parent' =&gt; func_get_arg(0) ), func_get_arg(2) );
</span><span class="cx"> 
</span><span class="cx">                 // Ensure we have a valid title.
</span><del>-                if ( empty( $args['title'] ) )
-                        return false;
</del><ins>+                if ( empty( $args['id'] ) ) {
+                        if ( empty( $args['title'] ) )
+                                return;
</ins><span class="cx"> 
</span><del>-                if ( empty( $args['id'] ) ) {
</del><span class="cx">                         _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
</span><ins>+                        // Deprecated: Generate an ID from the title.
</ins><span class="cx">                         $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $defaults = array(
</span><del>-                        'id'        =&gt; false,
-                        'title'     =&gt; false,
-                        'parent'    =&gt; false,
-                        'href'      =&gt; false,
-                        'secondary' =&gt; false,
-                        'meta'      =&gt; array(),
</del><ins>+                        'id'     =&gt; false,
+                        'title'  =&gt; false,
+                        'parent' =&gt; false,
+                        'href'   =&gt; false,
+                        'group'  =&gt; false,
+                        'meta'   =&gt; array(),
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 // If the node already exists, keep any data that isn't provided.
</span><span class="lines">@@ -99,14 +100,25 @@
</span><span class="cx">                         $defaults = (array) $this-&gt;nodes[ $args['id'] ];
</span><span class="cx"> 
</span><span class="cx">                 $args = wp_parse_args( $args, $defaults );
</span><del>-                $args['children'] = (object) array(
-                        'primary'   =&gt; array(),
-                        'secondary' =&gt; array(),
-                );
</del><ins>+                $args['children'] = array();
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;nodes[ $args['id'] ] = (object) $args;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /**
+         * Add a group to a menu node.
+         *
+         * @param array $args - The arguments for each node.
+         * - id         - string    - The ID of the item.
+         * - parent     - string    - The ID of the parent node. Optional. Default root.
+         * - meta       - array     - Meta data including the following keys: class, onclick, target, title.
+         */
+        public function add_group( $args ) {
+                $args['group'] = true;
+
+                $this-&gt;add_node( $args );
+        }
+
</ins><span class="cx">         public function remove_node( $id ) {
</span><span class="cx">                 unset( $this-&gt;nodes[ $id ] );
</span><span class="cx">         }
</span><span class="lines">@@ -136,10 +148,27 @@
</span><span class="cx">                                 $parent = $this-&gt;nodes[ $node-&gt;parent ];
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if ( $node-&gt;secondary )
-                                $parent-&gt;children-&gt;secondary[] = $node;
-                        else
-                                $parent-&gt;children-&gt;primary[] = $node;
</del><ins>+
+                        // Ensure that our tree is of the form &quot;item -&gt; group -&gt; item -&gt; group -&gt; ...&quot;
+                        if ( ! $parent-&gt;group &amp;&amp; ! $node-&gt;group ) { // Both are items.
+                                // The default group is added here to allow groups that are
+                                // added before standard menu items to render first.
+                                if ( ! isset( $parent-&gt;children['default'] ) ) {
+                                        $parent-&gt;children['default'] = (object) array(
+                                                'id'       =&gt; &quot;{$parent-&gt;id}-default&quot;,
+                                                'parent'   =&gt; $parent-&gt;id,
+                                                'group'    =&gt; true,
+                                                'children' =&gt; array(),
+                                        );
+                                }
+                                $parent = $parent-&gt;children['default'];
+                        }
+
+                        // Update the parent ID (it might have changed).
+                        $node-&gt;parent = $parent-&gt;id;
+
+                        // Add the node to the tree.
+                        $parent-&gt;children[] = $node;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // Add browser classes.
</span><span class="lines">@@ -159,33 +188,64 @@
</span><span class="cx">                 ?&gt;
</span><span class="cx">                 &lt;div id=&quot;wpadminbar&quot; class=&quot;&lt;?php echo $class; ?&gt;&quot;&gt;
</span><span class="cx">                         &lt;div class=&quot;quicklinks&quot;&gt;
</span><del>-                                &lt;ul class=&quot;ab-top-menu&quot;&gt;&lt;?php
-
-                                        foreach ( $this-&gt;root-&gt;children-&gt;primary as $node ) {
-                                                $this-&gt;recursive_render( $node );
-                                        }
-
-                                ?&gt;&lt;/ul&gt;
-                                &lt;ul class=&quot;ab-top-menu ab-top-secondary&quot;&gt;&lt;?php
-
-                                        foreach ( $this-&gt;root-&gt;children-&gt;secondary as $node ) {
-                                                $this-&gt;recursive_render( $node );
-                                        }
-
-                                ?&gt;&lt;/ul&gt;
</del><ins>+                                &lt;?php foreach ( $this-&gt;root-&gt;children as $group ) {
+                                        $this-&gt;render_group( $group, 'ab-top-menu' );
+                                } ?&gt;
</ins><span class="cx">                         &lt;/div&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;?php
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function recursive_render( $node ) {
-                if ( ! $node-&gt;children-&gt;primary &amp;&amp; $node-&gt;children-&gt;secondary ) {
-                        $node-&gt;children-&gt;primary = $node-&gt;children-&gt;secondary;
-                        $node-&gt;children-&gt;secondary = array();
</del><ins>+        private function render_group( $node, $class = '' ) {
+                if ( ! $node-&gt;group )
+                        return;
+
+                // Check for groups within groups.
+                $groups = array();
+                foreach ( $node-&gt;children as $child ) {
+                        if ( $child-&gt;group ) {
+                                $groups[] = $child;
+                        } else {
+                                if ( ! isset( $default ) ) {
+                                        // Create a default proxy item to be used in the case of nested groups.
+                                        $default  = (object) wp_parse_args( array( 'children' =&gt; array() ), (array) $node );
+                                        $groups[] = $default;
+                                }
+                                $default-&gt;children[] = $child;
+                        }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $is_parent = (bool) $node-&gt;children-&gt;primary;
</del><ins>+                $is_single_group = count( $groups ) === 1;
+
+
+                // If we don't have any subgroups, render the group.
+                if ( $is_single_group &amp;&amp; ! empty( $node-&gt;children ) ):
+
+                        if ( ! empty( $node-&gt;meta['class'] ) )
+                                $class .= ' ' . $node-&gt;meta['class'];
+
+                        ?&gt;&lt;ul id=&quot;&lt;?php echo esc_attr( &quot;wp-admin-bar-{$node-&gt;id}&quot; ); ?&gt;&quot; class=&quot;&lt;?php echo esc_attr( $class ); ?&gt;&quot;&gt;&lt;?php
+                                foreach ( $node-&gt;children as $item ) {
+                                        $this-&gt;render_item( $item );
+                                }
+                        ?&gt;&lt;/ul&gt;&lt;?php
+
+                // Wrap the subgroups in a div and render each individual subgroup.
+                elseif ( ! $is_single_group ):
+                        ?&gt;&lt;div id=&quot;&lt;?php echo esc_attr( &quot;wp-admin-bar-{$node-&gt;id}-container&quot; ); ?&gt;&quot; class=&quot;ab-group-container&quot;&gt;&lt;?php
+                                foreach ( $groups as $group ) {
+                                        $this-&gt;render_group( $group, $class );
+                                }
+                        ?&gt;&lt;/div&gt;&lt;?php
+                endif;
+        }
+
+        private function render_item( $node ) {
+                if ( $node-&gt;group )
+                        return;
+
+                $is_parent = (bool) $node-&gt;children;
</ins><span class="cx">                 $has_link  = (bool) $node-&gt;href;
</span><span class="cx"> 
</span><span class="cx">                 $menuclass = $is_parent ? 'menupop' : '';
</span><span class="lines">@@ -222,23 +282,9 @@
</span><span class="cx"> 
</span><span class="cx">                         if ( $is_parent ) :
</span><span class="cx">                                 ?&gt;&lt;div class=&quot;ab-sub-wrapper&quot;&gt;&lt;?php
</span><del>-
-                                        // Render primary submenu
-                                        ?&gt;&lt;ul class=&quot;ab-submenu&quot;&gt;&lt;?php
-                                        foreach ( $node-&gt;children-&gt;primary as $child_node ) {
-                                                $this-&gt;recursive_render( $child_node );
</del><ins>+                                        foreach ( $node-&gt;children as $group ) {
+                                                $this-&gt;render_group( $group, 'ab-submenu' );
</ins><span class="cx">                                         }
</span><del>-                                        ?&gt;&lt;/ul&gt;&lt;?php
-
-                                        // Render secondary submenu
-                                        if ( ! empty( $node-&gt;children-&gt;secondary ) ):
-                                                ?&gt;&lt;ul class=&quot;ab-submenu ab-sub-secondary&quot;&gt;&lt;?php
-                                                foreach ( $node-&gt;children-&gt;secondary as $child_node ) {
-                                                        $this-&gt;recursive_render( $child_node );
-                                                }
-                                                ?&gt;&lt;/ul&gt;&lt;?php
-                                        endif;
-
</del><span class="cx">                                 ?&gt;&lt;/div&gt;&lt;?php
</span><span class="cx">                         endif;
</span><span class="cx"> 
</span><span class="lines">@@ -247,7 +293,10 @@
</span><span class="cx"> 
</span><span class="cx">                         ?&gt;
</span><span class="cx">                 &lt;/li&gt;&lt;?php
</span><ins>+        }
</ins><span class="cx"> 
</span><ins>+        function recursive_render( $node ) {
+                $this-&gt;render_item( $node );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function add_menus() {
</span><span class="lines">@@ -271,6 +320,8 @@
</span><span class="cx">                 if ( ! is_admin() )
</span><span class="cx">                         add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 100 );
</span><span class="cx"> 
</span><ins>+                add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 );
+
</ins><span class="cx">                 do_action( 'add_admin_bar_menus' );
</span><span class="cx">         }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludescssadminbarrtldevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/admin-bar-rtl.dev.css (19428 => 19429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/admin-bar-rtl.dev.css        2011-11-23 21:29:33 UTC (rev 19428)
+++ trunk/wp-includes/css/admin-bar-rtl.dev.css        2011-11-23 21:46:47 UTC (rev 19429)
</span><span class="lines">@@ -107,17 +107,17 @@
</span><span class="cx"> /**
</span><span class="cx">  * My Account
</span><span class="cx">  */
</span><del>-#wpadminbar #wp-admin-bar-my-account.with-avatar .user-info-item {
</del><ins>+#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-my-account-default &gt; li {
</ins><span class="cx">         margin-right: 88px;
</span><span class="cx">         margin-left: 16px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info-item &gt; a {
</del><ins>+#wp-admin-bar-my-account-default &gt; li &gt; .ab-item {
</ins><span class="cx">         padding-left: 0;
</span><span class="cx">         padding-right: 8px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wp-admin-bar-my-account .user-info .avatar {
</del><ins>+#wp-admin-bar-user-info .avatar {
</ins><span class="cx">         left: auto;
</span><span class="cx">         right: -72px;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludescssadminbardevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/admin-bar.dev.css (19428 => 19429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/admin-bar.dev.css        2011-11-23 21:29:33 UTC (rev 19428)
+++ trunk/wp-includes/css/admin-bar.dev.css        2011-11-23 21:46:47 UTC (rev 19429)
</span><span class="lines">@@ -135,8 +135,13 @@
</span><span class="cx">         margin: 0 -1px 0 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#wpadminbar .ab-sub-wrapper &gt; .ab-submenu:first-child {
+        border-top: none;
+}
+
</ins><span class="cx"> #wpadminbar .ab-submenu {
</span><span class="cx">         padding: 6px 0;
</span><ins>+        border-top: 1px solid #dfdfdf;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #wpadminbar .selected .shortlink-input {
</span><span class="lines">@@ -247,10 +252,8 @@
</span><span class="cx">         position: relative;
</span><span class="cx">         right: auto;
</span><span class="cx">         margin: 0;
</span><del>-        border: 0;
</del><span class="cx"> 
</span><span class="cx">         background: #eee;
</span><del>-        border-top: 1px solid #dfdfdf;
</del><span class="cx"> 
</span><span class="cx">         -moz-box-shadow: none;
</span><span class="cx">         -webkit-box-shadow: none;
</span><span class="lines">@@ -310,52 +313,52 @@
</span><span class="cx">         min-width: 270px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info-item {
</del><ins>+#wpadminbar #wp-admin-bar-my-account-default &gt; li {
</ins><span class="cx">         margin-left: 16px;
</span><span class="cx">         margin-right: 16px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account.with-avatar .user-info-item {
</del><ins>+#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-my-account-default &gt; li {
</ins><span class="cx">         margin-left: 88px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info-item &gt; a {
</del><ins>+#wp-admin-bar-my-account-default &gt; li &gt; .ab-item {
</ins><span class="cx">         padding-left: 8px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info {
</del><ins>+#wpadminbar #wp-admin-bar-user-info {
</ins><span class="cx">         margin-top: 6px;
</span><span class="cx">         margin-bottom: 15px;
</span><span class="cx">         height: auto;
</span><span class="cx">         background: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wp-admin-bar-my-account .user-info .avatar {
</del><ins>+#wp-admin-bar-user-info .avatar {
</ins><span class="cx">         position: absolute;
</span><span class="cx">         left: -72px;
</span><span class="cx">         top: 4px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info a {
</del><ins>+#wpadminbar #wp-admin-bar-user-info a {
</ins><span class="cx">         height: auto;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info span {
</del><ins>+#wpadminbar #wp-admin-bar-user-info span {
</ins><span class="cx">         background: none;
</span><span class="cx">         padding: 0;
</span><span class="cx">         height: 18px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info .display-name,
-#wpadminbar #wp-admin-bar-my-account .user-info .username {
</del><ins>+#wpadminbar #wp-admin-bar-user-info .display-name,
+#wpadminbar #wp-admin-bar-user-info .username {
</ins><span class="cx">         text-shadow: none;
</span><span class="cx">         display: block;
</span><span class="cx"> }
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info .display-name {
</del><ins>+#wpadminbar #wp-admin-bar-user-info .display-name {
</ins><span class="cx">         color: #333;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#wpadminbar #wp-admin-bar-my-account .user-info .username {
</del><ins>+#wpadminbar #wp-admin-bar-user-info .username {
</ins><span class="cx">         color: #999;
</span><span class="cx">         font-size: 11px;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>