[buddypress-trac] [BuddyPress Trac] #8430: Adding a new subnav item in Nouveau messages breaks nouveau js

buddypress-trac noreply at wordpress.org
Tue Feb 2 15:09:23 UTC 2021


#8430: Adding a new subnav item in Nouveau messages breaks nouveau js
--------------------------+------------------------------------
 Reporter:  Venutius      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Contributions
Component:  Templates     |    Version:  7.1.0
 Severity:  normal        |   Keywords:
--------------------------+------------------------------------
 With Nouveau the provide messages functions changes so that the subnav
 items - compose, starred etc. load via js.

 The problem comes when one wishes to add a new subnav item to the messages
 screen, if you use the traditional method the js for the other subnav
 breaks - underscores reporting that 'i' is not defined.

 When I say the traditional method, I means as per the following:

 {{{
 class BP_Message_Archive_Component extends BP_Component {
     function setup_nav($main_nav = array(), $sub_nav = array()) {
         bp_core_new_subnav_item( array(
             'name'              => 'Archive',
             'slug'              => 'archive',
             'parent_url'        => trailingslashit( $user_domain .
 'messages' ),
             'parent_slug'       => 'messages',
             'screen_function'   => 'messages_profile_archive',
             'position'          => 25,
             'item_css_id'       => 'member-messages-archive'
             )
         );
     }

     function setup_admin_bar() {
          $wp_admin_nav[] = array(
                 'parent' => 'my-account-messages',
                 'id'     => 'my-account-messages-archive',
                 'title'  => 'Archive',
                 'href'   => trailingslashit( $item_link ) . 'archive');
          parent::setup_admin_bar( $wp_admin_nav );
     }
 }

 function messages_profile_archive() {
         add_action( 'bp_template_content',
 'messages_profile_archive_screen' );
         bp_core_load_template( 'members/single/plugins' );
 }

 function messages_profile_archive_screen() {
         bp_get_template_part('members/single/profile-messages-archive');
 }

 // The template profile-messages-archive.php simply contains
 <div><p>Hello</p></div>
 }}}

 This method works fine with BP Legacy, however with Nouveau if you select
 the messages archive link from the admin bar, it takes you to the correct
 page, the template message displays and you are placed in the
 profile>>messages>>archive page. However clicking on any of the other
 messages subnav items fails, giving a js error as mentioned above.

 Is there some secret sauce to preventing this error?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8430>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list