Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/24/2018 05:13:57 AM (8 years ago)
Author:
imath
Message:

BP Nouveau Messages UI: Improve the Backbone router using pushState

In order to be consistent with conditional template tags such as bp_is_messages_compose_screen(), the routes of the Backbone router have been updated to match Messages component canonical URLs

Props sbrajesh, djpaul

See #7840 (Trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php

    r12106 r12115  
    115115                        'more' => __( '(and %d others)', 'buddypress' ),
    116116                ),
     117                'rootUrl' => trailingslashit( str_replace( home_url(), '', bp_displayed_user_domain() ) . bp_get_messages_slug() ),
    117118        );
    118119
     
    179180                if ( 'notices' === $secondary_nav_item->slug ) {
    180181                        bp_core_remove_subnav_item( bp_get_messages_slug(), $secondary_nav_item->slug, 'members' );
    181                 } else {
    182                         $params = array( 'link' => '#' . $secondary_nav_item->slug );
    183 
    184                         // Make sure Admins won't write a messages from the user's account.
    185                         if ( 'compose' === $secondary_nav_item->slug ) {
    186                                 $params['user_has_access'] = bp_is_my_profile();
    187                         }
    188 
    189                         $bp->members->nav->edit_nav( $params, $secondary_nav_item->slug, bp_get_messages_slug() );
     182                } elseif ( 'compose' === $secondary_nav_item->slug ) {
     183                        $bp->members->nav->edit_nav( array(
     184                                'user_has_access' => bp_is_my_profile()
     185                        ), $secondary_nav_item->slug, bp_get_messages_slug() );
    190186                }
    191187        }
     
    205201                $nav_id = str_replace( 'my-account-messages-', '', $nav['id'] );
    206202
    207                 if ( 'my-account-messages' !== $nav_id ) {
    208                         if ( 'notices' === $nav_id ) {
    209                                 $admin_nav[ $nav_iterator ]['href'] = esc_url( add_query_arg( array( 'page' => 'bp-notices' ), bp_get_admin_url( 'users.php' ) ) );
    210                         } else {
    211                                 $admin_nav[ $nav_iterator ]['href'] = $user_messages_link . '#' . trim( $nav_id );
    212                         }
     203                if ( 'notices' === $nav_id ) {
     204                        $admin_nav[ $nav_iterator ]['href'] = esc_url( add_query_arg( array(
     205                                'page' => 'bp-notices'
     206                        ), bp_get_admin_url( 'users.php' ) ) );
    213207                }
    214208        }
Note: See TracChangeset for help on using the changeset viewer.