[wp-trac] [WordPress Trac] #19429: Prevent the my-account node from being removed

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 3 05:21:42 UTC 2011


#19429: Prevent the my-account node from being removed
---------------------------------------+------------------
 Reporter:  nacin                      |       Owner:
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:  3.3
Component:  Admin Bar                  |     Version:  3.3
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch needs-refresh  |
---------------------------------------+------------------

Comment (by nacin):

 Code from koopersmith push it onto the end of the the root element. (We
 raced, he won.) Holding off until the code in #19416 is in.
 {{{
                 // Ensure we have a logout node.
                 $root = $this->_get_node( 'root' );
                 $node = $this->get_node( 'logout' );

                 while ( $node && $node->parent ) {
                     if ( $found_root = ( 'root' == $node->parent ) )
                         break;
                     $node = $this->get_node( $node->parent );
                 }

                 if ( empty( $found_root ) ) {
                     $this->add_node( array(
                         'parent' => 'root',
                         'id'     => 'logout',
                         'title'  => __( 'Log Out' ),
                         'href'   => wp_logout_url(),
                     ) );
                     $root->children[] = $this->get_node( 'logout' );
                 }
 }}}

 Further thoughts.

 1, we'll still want [attachment:19429.diff], otherwise a plugin from 3.2
 can do some damage pretty easily.

 2, since the priorities will be changing, #19425, a remove_filter() that
 worked in 3.2 for wp_admin_bar_my_account_menu() will not work in 3.3. So
 we're covered there as well.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19429#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list