Making WordPress.org

Changeset 12895


Ignore:
Timestamp:
09/18/2023 10:14:23 PM (8 months ago)
Author:
iandunn
Message:

Support Forums: Add edit/account rewrite rule for i18n forums

It was removed from main-network/site-support.php in r20930-dotorg. This is so that it also runs on the Rosetta forums.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r12860 r12895  
    2424        add_action( 'wp_print_footer_scripts',         array( $this, 'replace_quicktags_blockquote_button' ) );
    2525        add_filter( 'bbp_show_user_profile',           array( $this, 'allow_mods_to_view_inactive_users' ), 10, 2 );
     26        add_action( 'init',                            array( $this, 'add_rewrite_rules' ) );
     27
    2628
    2729        // Add bbPress support to the WordPress.org SEO plugin.
     
    250252
    251253        return $filter_value;
     254    }
     255
     256    /**
     257     * Add rewrite rules.
     258     *
     259     * This function needs to live in this file, so that it's ran no matter what theme is dynamically activated by
     260     * the `template` / `stylesheet` callbacks above.
     261     */
     262    function add_rewrite_rules() {
     263        if ( ! function_exists( 'bbp_get_user_slug' ) ) {
     264            return;
     265        }
     266
     267        // e.g., https://wordpress.org/support/users/foo/edit/account/
     268        add_rewrite_rule(
     269            bbp_get_user_slug() . '/([^/]+)/' . bbp_get_edit_slug() . '/account/?$',
     270            'index.php?' . bbp_get_user_rewrite_id() . '=$matches[1]&edit_account=1',
     271            'top'
     272        );
    252273    }
    253274
Note: See TracChangeset for help on using the changeset viewer.