Skip to:
Content

bbPress.org

Ticket #3285: 3285.patch

File 3285.patch, 5.7 KB (added by johnjamesjacoby, 5 years ago)
  • src/bbpress.php

     
    889889
    890890                // Tertiary Slugs
    891891                $feed_slug          = 'feed';
    892                 $edit_slug          = 'edit';
     892                $edit_slug          = bbp_get_edit_slug();
    893893                $paged_slug         = bbp_get_paged_slug();
    894894                $user_favs_slug     = bbp_get_user_favorites_slug();
    895895                $user_subs_slug     = bbp_get_user_subscriptions_slug();
  • src/includes/admin/settings.php

     
    386386                                'args'              => array( 'label_for'=>'_bbp_reply_slug' )
    387387                        ),
    388388
     389                        // Edit slug setting
     390                        '_bbp_edit_slug' => array(
     391                                'title'             => esc_html__( 'Edit', 'bbpress' ),
     392                                'callback'          => 'bbp_admin_setting_callback_edit_slug',
     393                                'sanitize_callback' => 'bbp_sanitize_slug',
     394                                'args'              => array( 'label_for'=>'_bbp_edit_slug' )
     395                        ),
     396
    389397                        // Search slug setting
    390398                        '_bbp_search_slug' => array(
    391399                                'title'             => esc_html__( 'Search', 'bbpress' ),
     
    12761284function bbp_admin_setting_callback_single_slug_section() {
    12771285?>
    12781286
    1279         <p><?php printf( esc_html__( 'Custom slugs for single forums, topics, replies, tags, views, and search.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p>
     1287        <p><?php printf( esc_html__( 'Custom slugs for single forums, topics, replies, tags, views, edit, and search.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p>
    12801288
    12811289<?php
    12821290}
     
    13721380        bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' );
    13731381}
    13741382
     1383/**
     1384 * Edit slug setting field
     1385 *
     1386 * @since 2.6.2 bbPress (r6965)
     1387 */
     1388function bbp_admin_setting_callback_edit_slug() {
     1389?>
     1390
     1391        <input name="_bbp_edit_slug" id="_bbp_edit_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_edit_slug', 'edit', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_slug' ); ?> />
     1392
     1393<?php
     1394        // Slug Check
     1395        bbp_form_slug_conflict_check( '_bbp_edit_slug', 'edit' );
     1396}
     1397
    13751398/** BuddyPress ****************************************************************/
    13761399
    13771400/**
     
    20242047                        // Reply slug
    20252048                        '_bbp_reply_slug'         => array( 'name' => esc_html__( 'Reply slug',  'bbpress' ), 'default' => 'reply',  'context' => 'bbPress' ),
    20262049
     2050                        // Edit slug
     2051                        '_bbp_edit_slug'          => array( 'name' => esc_html__( 'Edit slug',   'bbpress' ), 'default' => 'edit',   'context' => 'bbPress' ),
     2052
    20272053                        // User profile slug
    20282054                        '_bbp_user_slug'          => array( 'name' => esc_html__( 'User base',   'bbpress' ), 'default' => 'users',  'context' => 'bbPress' ),
    20292055
  • src/includes/core/options.php

     
    973973        return apply_filters( 'bbp_get_search_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_search_slug', $default ) );
    974974}
    975975
     976/**
     977 * Return the edit slug
     978 *
     979 * @since 2.6.2 bbPress (r6965)
     980 *
     981 * @param string $default Optional. Default value 'edit'
     982 * @return string
     983 */
     984function bbp_get_edit_slug( $default = 'edit' ) {
     985
     986        // Filter & return
     987        return apply_filters( 'bbp_get_edit_slug', get_option( '_bbp_edit_slug', $default ) );
     988}
     989
    976990/** Legacy ********************************************************************/
    977991
    978992/**
  • src/includes/extend/buddypress/groups.php

     
    929929                                        }
    930930
    931931                                        // Topic edit
    932                                         if ( bp_action_variable( $offset + 2 ) === bbp_get_edit_rewrite_id() ) :
     932                                        if ( bp_action_variable( $offset + 2 ) === bbp_get_edit_slug() ) :
    933933
    934934                                                // Unset the super sticky link on edit topic template
    935935                                                add_filter( 'bbp_get_topic_types', array( $this, 'unset_super_sticky' ), 10, 1 );
     
    10021002                                                echo '<h2>' . $title . '</h2>';
    10031003                                        }
    10041004
    1005                                         if ( bp_action_variable( $offset + 2 ) === bbp_get_edit_rewrite_id() ) :
     1005                                        if ( bp_action_variable( $offset + 2 ) === bbp_get_edit_slug() ) :
    10061006
    10071007                                                // Get the main query object
    10081008                                                $wp_query = bbp_get_wp_query();
  • src/includes/replies/template.php

     
    19051905                // Pretty permalinks, previously used `bbp_use_pretty_urls()`
    19061906                // https://bbpress.trac.wordpress.org/ticket/3054
    19071907                if ( false === strpos( $reply_link, '?' ) ) {
    1908                         $url = trailingslashit( $reply_link ) . bbp_get_edit_rewrite_id();
     1908                        $url = trailingslashit( $reply_link ) . bbp_get_edit_slug();
    19091909                        $url = user_trailingslashit( $url );
    19101910
    19111911                // Unpretty permalinks
  • src/includes/topics/template.php

     
    24602460                // Pretty permalinks, previously used `bbp_use_pretty_urls()`
    24612461                // https://bbpress.trac.wordpress.org/ticket/3054
    24622462                if ( false === strpos( $topic_link, '?' ) ) {
    2463                         $url = trailingslashit( $topic_link ) . bbp_get_edit_rewrite_id();
     2463                        $url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
    24642464                        $url = user_trailingslashit( $url );
    24652465
    24662466                // Unpretty permalinks
     
    35833583
    35843584                        // Pretty or ugly URL
    35853585                        $retval = bbp_use_pretty_urls()
    3586                                 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_rewrite_id() )
     3586                                ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_slug() )
    35873587                                : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link() );
    35883588
    35893589                // No link
  • src/includes/users/template.php

     
    635635
    636636                // Pretty permalinks
    637637                if ( bbp_use_pretty_urls() ) {
    638                         $url = trailingslashit( $profile_url ) . 'edit';
     638                        $url = trailingslashit( $profile_url ) . bbp_get_edit_slug();
    639639                        $url = user_trailingslashit( $url );
    640640
    641641                // Unpretty permalinks