Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove forum prefix before users


  • robertherold
    Participant

    @robertherold

    Hi,

    Is it possible not to include the Forum prefix in front of /users/?
    For other forum content, I want it to be there, not just in front of /users/.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W
    Moderator

    @robin-w

    I think this should do it, but check that it works, and try it from topics/replies freshness etc.

    add_filter ('bbp_get_user_slug' , 'rew_get_user_slug' ) ;
    
    function rew_get_user_slug ($slug) {
    	$default = 'users' ;
    	// Filter & return
    	return apply_filters( 'rew_get_user_slug', get_option( '_bbp_user_slug', $default ) );
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    robertherold
    Participant

    @robertherold

    Sorry, I’m getting a 404 error when I want to view a profile.


    Robin W
    Moderator

    @robin-w

    hmmm… the code works fine on my test site.

    I can only suggest it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentyfifteen, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    Then come back


    robertherold
    Participant

    @robertherold

    Thank you for the answer.
    It only works if User Base is users and the code you wrote includes users in it.
    If I rewrite User Base to user and also to user in the code, it will no longer work with this custom user root.


    Robin W
    Moderator

    @robin-w

    The default does not need changing.

    How are you doing this

    ‘If I rewrite User Base to user ‘


    robertherold
    Participant

    @robertherold

    I thought if I changed it here:

    View post on imgur.com

    Then I need to change it here too:

    add_filter (‘bbp_get_user_slug’ , ‘rew_get_user_slug’ ) ;
    function rew_get_user_slug ($slug) {
    $default = ‘users‘ ;
    // Filter & return
    return apply_filters( ‘rew_get_user_slug’, get_option( ‘_bbp_user_slug’, $default ) );
    }


    Robin W
    Moderator

    @robin-w

    Doesn’t actually make a difference if you do both, but it only needs changing in forum user slugs.

    I’d suspect that you might need to refresh your browser or clear cache in your site if you are caching.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar