Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2023 06:18:23 AM (2 years ago)
Author:
imath
Message:

Stop using BP Legacy URL parser in favor of the new BP Rewrites API

  • Deprecate bp_core_set_uri_globals(). This function is moved inside the BP Classic compatibility plugin.
  • Introduce the new bp_register_nav action to hook to when globalizing Members single item navigations from the BP_Component class.
  • Improve bp_get_component_navigations() so that Avatar/Cover images navigation items are moved inside the Profile sub nav if the Extended profile component is active.
  • Register Avatar/Cover images Ajax actions so that these actions trigger our new URL Parser inside Ajax context.
  • Improve the BP_Core_Nav::add_nav() method so that any BP action variable slugs can be customized.
  • Improve Members & Groups component canonical redirections.
  • Handle slugs customization persistency using directory pages post metas.
  • Introduce a new repair tool to reset all slugs to BuddyPress default one.
  • Adapt some PHPUnit tests to better handle our new URL parser.

Props Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

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

    r13137 r13468  
    9696 */
    9797function bp_admin_repair_list() {
    98     $repair_list = array();
     98    $repair_list = array(
     99        -1 => array(
     100            'bp-reset-slugs',
     101            __( 'Reset all BuddyPress slugs to default ones', 'buddypress' ),
     102            'bp_admin_reset_slugs',
     103        ),
     104    );
    99105
    100106    // Members:
     
    177183     */
    178184    return (array) apply_filters( 'bp_repair_list', $repair_list );
     185}
     186
     187/**
     188 * Reset all BuddyPress slug to default ones.
     189 *
     190 * @since 12.0.0
     191 */
     192function bp_admin_reset_slugs() {
     193    /* translators: %s: the result of the action performed by the repair tool */
     194    $statement = __( 'Removing all custom slugs and resetting default ones… %s', 'buddypress' );
     195
     196    $bp_pages = bp_core_get_directory_page_ids( 'all' );
     197    foreach ( $bp_pages as $page_id ) {
     198        delete_post_meta( $page_id, '_bp_component_slugs' );
     199    }
     200
     201    // Delete BP Pages cache and rewrite rules.
     202    wp_cache_delete( 'directory_pages', 'bp_pages' );
     203    bp_delete_rewrite_rules();
     204
     205    return array( 0, sprintf( $statement, __( 'Complete!', 'buddypress' ) ) );
    179206}
    180207
Note: See TracChangeset for help on using the changeset viewer.