Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/12/2023 10:12:37 PM (23 months ago)
Author:
imath
Message:

Administration: add a new settings tab to manage slugs customization

Compared to [13442], change the logic of Components user navigation
generation by introducing a BP_Component::register_nav() method to
globalize the nav items early (ie: the registration step) and make them
available for the new settings tab to manage slugs customization.

After a second thought, the BP_Component::setup_nav() should remain the
navigation generation step instead of playing the registration role. This
will maximize backward compatibility & third party plugins wishing their
slugs to be customizable will need to "opt-in" for BP Rewrites using the
BP_Component::register_nav() method.

This first version of the URLs settings tab does not handle slugs
customization yet, its first usage is to make sure all BP Components user
navigation slugs were registered & to put the Accordion UI in place.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-admin.php

    r13431 r13450  
    143143     */
    144144    private function includes() {
    145         require( $this->admin_dir . 'bp-core-admin-actions.php'    );
    146         require( $this->admin_dir . 'bp-core-admin-settings.php'   );
    147         require( $this->admin_dir . 'bp-core-admin-functions.php'  );
    148         require( $this->admin_dir . 'bp-core-admin-components.php' );
    149         require( $this->admin_dir . 'bp-core-admin-tools.php'      );
    150         require( $this->admin_dir . 'bp-core-admin-optouts.php'    );
     145        require $this->admin_dir . 'bp-core-admin-actions.php';
     146        require $this->admin_dir . 'bp-core-admin-settings.php';
     147        require $this->admin_dir . 'bp-core-admin-functions.php';
     148        require $this->admin_dir . 'bp-core-admin-components.php';
     149        require $this->admin_dir . 'bp-core-admin-rewrites.php';
     150        require $this->admin_dir . 'bp-core-admin-tools.php';
     151        require $this->admin_dir . 'bp-core-admin-optouts.php';
    151152    }
    152153
     
    274275        $this->submenu_pages['settings']['bp-components'] = $bp_components_page;
    275276        $hooks[]                                          = $bp_components_page;
     277
     278        $bp_rewrite_settings_page = add_submenu_page(
     279            $this->settings_page,
     280            __( 'BuddyPress URLs', 'buddypress' ),
     281            __( 'BuddyPress URLs', 'buddypress' ),
     282            $this->capability,
     283            'bp-rewrites',
     284            'bp_core_admin_rewrites_settings'
     285        );
     286
     287        $this->submenu_pages['settings']['bp-rewrites'] = $bp_rewrite_settings_page;
     288        $hooks[]                                        = $bp_rewrite_settings_page;
    276289
    277290        $bp_settings_page = add_submenu_page(
     
    375388        foreach( $hooks as $hook ) {
    376389            add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
     390
     391            if ( 'settings_page_bp-rewrites' === $hook ) {
     392                add_action( "load-{$hook}", 'bp_core_admin_rewrites_load' );
     393            }
    377394        }
    378395
     
    614631
    615632        // Settings pages.
    616         remove_submenu_page( $this->settings_page, 'bp-settings'      );
    617         remove_submenu_page( $this->settings_page, 'bp-credits'       );
     633        remove_submenu_page( $this->settings_page, 'bp-rewrites' );
     634        remove_submenu_page( $this->settings_page, 'bp-settings' );
     635        remove_submenu_page( $this->settings_page, 'bp-credits'  );
    618636
    619637        // Network Admin Tools.
     
    13971415                ),
    13981416            ),
     1417
     1418            // 12.0
     1419            'bp-rewrites-ui' => array(
     1420                'file' => "{$url}rewrites-ui.js",
     1421                'dependencies' => array(),
     1422                'footer'       => true,
     1423            ),
    13991424        ) );
    14001425
Note: See TracChangeset for help on using the changeset viewer.