Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2023 06:19:06 PM (4 years ago)
Author:
imath
Message:

Improve Components Member's single item navigation generation

  • Edit the BP_Component Class so that it globalize navigation items before registering it.
  • Introduce bp_get_component_navigations(), a new function that will be used to get Member's single navigation customizable slugs within the BuddyPress settings area.
  • Perform all remaining bp_loggedin_user_domain() replacements (55) in favor of the bp_loggedin_user_url() function which uses BP Rewrites to build URLs.
  • Improve bp_loggedin_user_link() by adding a new $chunks array of arguments to output escaped URL in templates.
  • Adapt some PHPUnit testcases.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes ​https://github.com/buddypress/buddypress/pull/78
See #4954

File:
1 edited

Legend:

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

    r13301 r13442  
    7878                // If friends component is active and the user has friends
    7979                if ( bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) {
     80                        $friends_slug = bp_nouveau_get_component_slug( 'friends' );
     81                        $path_chunks   = array(
     82                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
     83                                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ),
     84                        );
     85
    8086                        $nav_items['personal'] = array(
    8187                                'component' => 'members',
    8288                                'slug'      => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope
    8389                                'li_class'  => array(),
    84                                 'link'      => bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'friends' ) . '/my-friends/',
     90                                'link'      => bp_loggedin_user_url( $path_chunks ),
    8591                                'text'      => __( 'My Friends', 'buddypress' ),
    8692                                'count'     => bp_get_total_friend_count( bp_loggedin_user_id() ),
Note: See TracChangeset for help on using the changeset viewer.