Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change slug without touching core files?


  • @mcuk
    Participant

    @mcuk

    Hi all,

    From what I have read on numerous forum threads and in the codex, the simple code below for changing slugs is now obsolete:

    define ( 'BP_FRIENDS_SLUG', 'peeps' ); Deprecated

    Changing Internal Configuration Settings

    Is there a way (or a way on the way) to enable the changing of slugs? The person in this thread below had to change the core files (which has its obvious downsides).
    https://buddypress.org/support/topic/change-group-member-slug/

    So is altering the core files to change slugs (in my case the ‘Friends’ slug), the only way to currently change slugs without creating your own pages and loading the screens desired onto them?

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

  • danbp
    Participant

    @danbp

    @mcuk,

    1. a slug is a human friendly URL. (as of your topic title)
    2. a tab name or a menu item is just a name, on which applies an URL. (as of your given example)

    This means that your tab or menu can be written Cow-Boy and his URL can can be completely different, for example your-site/members/mcuk/amigos/

    For consistancy and SEO logic, most prefer the same wording for both.
    Related to “friends”, open bp-friends/bp-friends-loader.php and see how it works.

    You will discover that

    // Define a slug, if necessary
       if ( !defined( 'BP_FRIENDS_SLUG' ) )
    	define( 'BP_FRIENDS_SLUG', $this->id );

    is not deprecated.

    In other words, to change the slug, you can use from within bp-custom.php
    define ( ‘BP_FRIENDS_SLUG’, ‘whatever’ ); whatever should be exclusively alpha numeric, lower case, without any special character or ponctuation.

    To modify tabs and menu items, simply use the language file.

    Customizing Labels, Messages, and URLs


    @mcuk
    Participant

    @mcuk

    Hi @danbp,

    Sorry I think i may have confused my explanation or something and got lost in translation :s.

    Yeah I’m aware of the difference between the slugs used in the URL/permalinks and the menu/tab names. I’ve already updated the names etc in the PO files useing Poedit. But for one reason or another the: define ( ‘BP_FRIENDS_SLUG’, ‘whatever’ ); isn’t working…


    @mcuk
    Participant

    @mcuk

    I tell a lie…it works on the ‘friends activity loop’ (not sure what the name is, the activity loop filtered to show updates from your friends), but it also makes the ‘my friends’ tab and page disappear (the section showing WHO i am friends with).


    danbp
    Participant

    @danbp

    No such an error on my side.
    Activate a Twenty something theme and see if it remains.


    @mcuk
    Participant

    @mcuk

    So what appears to be happening is that the Buddybar adopts the slug changes immediately (I’ve just removed the display:none CSS for the main nav tabs on Buddybar to check because I don’t use it).

    But the top menu (created via the Menus in WP Dashboard) is where the tabs are disappearing due to the slug changes. Tried with define ( 'BP_MESSAGES_SLUG', 'notes' ); to confirm it wasn’t an isolated effect. All is fine there now though, they just need replacing into the menu via the WP Dash once the slug has been changed and then they appear again.

    Are the slugs of subnav tabs changed using the define code too? I haven’t come across it.

    Out of interest, have I misunderstood this link where it says the various defines at the bottom are deprecated, or is it just in need of updating? :

    Changing Internal Configuration Settings


    danbp
    Participant

    @danbp

    @mcuk,

    default menu items (nav or sub-nav) are all written somewhere, by you or the language file. Custom menus are rarely automatically updated. Most are also theme dependant.

    Some Codex pages needs heavy revision. Feel free to do so. Volunteers are welcome, as it’s a never ending task.

    Participate and Contribute


    @mcuk
    Participant

    @mcuk

    Yeah I bet it is a big task. All you guys are doing a great job at it nevertheless so congrats!

    If I get sufficient knowledge to contribute I will. Right now in these early days of using it i am nowhere near qualified! (Simultaneously learning/hacking away at php :s).

    I guess by asking the various questions that I have been and/or putting the code on the forum etc. the snippets of knowledge I gain is shared with anyone else looking to do similar.


    danbp
    Participant

    @danbp

    I’m waiting for the imminent upcoming BuddyPress Survey to know the percentage of user searching on forums and on Codex. 2014 was a bit disapointing about that…


    @mcuk
    Participant

    @mcuk

    That’s quite an interesting document, especially the infographic. Would never have know it existed.

    Personally I have found using the forum is more user friendly and written at a more understandable level than the Codex. It’s also up to date and returns far more results for a given search when compared to the Codex.

    But knowing that BP is volunteer run is a very valid reason for things being outdated etc. It’s great that there’s a resource base for it in the first place. I’m sure many people like me who are new to BP wouldn’t get half as far in a given time frame without it!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change slug without touching core files?’ is closed to new replies.
Skip to toolbar