Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/19/2019 05:47:56 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Slugs: add support for configuring the "Edit" slug.

This commit adds supporting functions and UI for allowing the edit slug to be modified. This omission was originally intentional, as the rewrite rules and pretty permalink support were not fully implemented. Now that they are in 2.6, there is no reason not to allow this slug to be modified.

Related changes include swapping out the new slug setting for the rewrite ID in a few places, and removing a single hardcoded reference to 'edit' that was also overlooked.

Props espellcaste for noticing. Fixes #3285. For 2.7, trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/settings.php

    r6954 r6967  
    385385                'sanitize_callback' => 'bbp_sanitize_slug',
    386386                'args'              => array( 'label_for'=>'_bbp_reply_slug' )
     387            ),
     388
     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' )
    387395            ),
    388396
     
    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
     
    13711379    // Slug Check
    13721380    bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' );
     1381}
     1382
     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' );
    13731396}
    13741397
     
    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' ),
Note: See TracChangeset for help on using the changeset viewer.