Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/23/2023 07:35:38 PM (22 months ago)
Author:
imath
Message:

Make BP_Core_Nav generate "BP Rewrites ready" navigation links

  • Remove all components $parent_url attributes when setting sub nav items.
  • Only use the bp_core_create_nav_link() $link attribute argument & the bp_core_create_subnav_link() $parent_url attribute argument if specified to preserve backward compatibility.
  • Migrates the Community search feature so that it uses BP Rewrites.
  • Perform some bp_loggedin_user_domain() in favor of bp_loggedin_user_url().
  • Update some PHPUnit tests.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-adminbar.php

    r13437 r13441  
    5757    }
    5858
     59    $manage_screens = bp_get_group_screens( 'manage' );
     60
    5961    // Build the Group Admin menus.
    6062    foreach ( $secondary_nav_items as $menu ) {
     
    6668         * the 'show_in_admin_bar' argument of your edit screen to true
    6769         */
    68         if ( $menu->show_in_admin_bar ) {
     70        if ( $menu->show_in_admin_bar && isset( $manage_screens[ $menu->slug ] ) ) {
    6971            /* translators: %s the group menu name */
    7072            $title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu->name );
     
    7678            }
    7779
    78             $wp_admin_bar->add_node( array(
    79                 'parent' => $bp->group_admin_menu_id,
    80                 'id'     => $menu->slug,
    81                 'title'  => $title,
    82                 'href'   => bp_get_groups_action_link( 'admin/' . $menu->slug )
    83             ) );
     80            $wp_admin_bar->add_node(
     81                array(
     82                    'parent' => $bp->group_admin_menu_id,
     83                    'id'     => $menu->slug,
     84                    'title'  => $title,
     85                    'href'   => bp_get_group_url(
     86                        $bp->groups->current_group,
     87                        array(
     88                            'single_item_action'           => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ),
     89                            'single_item_action_variables' => bp_rewrites_get_slug( 'groups', $manage_screens[ $menu->slug ]['rewrite_id'], $menu->slug ),
     90                        )
     91                    ),
     92                )
     93            );
    8494        }
    8595    }
Note: See TracChangeset for help on using the changeset viewer.