Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2023 06:19:06 PM (19 months 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/activity/ajax.php

    r13433 r13442  
    44 *
    55 * @since 3.0.0
    6  * @version 10.0.0
     6 * @version 12.0.0
    77 */
    88
     
    115115
    116116            if ( 1 === $fav_count ) {
     117                $activity_slug          = bp_nouveau_get_component_slug( 'activity' );
     118                $custom_activity_slug   = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug );
     119                $activity_favorites_url = bp_loggedin_user_url(
     120                    array(
     121                        'single_item_component' => $custom_activity_slug,
     122                        'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ),
     123                    )
     124                );
     125
    117126                $response['directory_tab'] = '<li id="activity-favorites" data-bp-scope="favorites" data-bp-object="activity">
    118                     <a href="' . bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/">
     127                    <a href="' . esc_url( $activity_favorites_url ). '">
    119128                        ' . esc_html__( 'My Favorites', 'buddypress' ) . '
    120129                    </a>
Note: See TracChangeset for help on using the changeset viewer.