Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing "Friends" to "Connections" ?


  • ideasdesigninc
    Participant

    @ideasdesigninc

    Hello. I’m currently running WordPress v4.0 on an Apache based server under a subdomain, and have the most recent version of BuddyPress installed (v2.1.1).

    How would I go about changing all references to “Friends” on all of the Member Profile pages to “Connections” ? And would it be possible for me to also change the “/activity/friends/” friendly URL to “/activity/connections/” ? If so, how?

    Thanks!
    – Yvan

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

  • ideasdesigninc
    Participant

    @ideasdesigninc

    UPDATE: I’ve figured out how to change the “/activity/friends/” friendly URL to “/activity/connections/”. I’ve simply uploaded a bp-custom.php file to my “/wp-content/plugins/” folder and added the following line to it:

    define ( ‘BP_FRIENDS_SLUG’, ‘connections’ );

    I now just need to figure out how to change “Friends” to “Connections”. I’ve searched through these forums, but all of the instructions I’ve been able to find so far seem to pertain to 1.x versions of BuddyPress, and involve the modifying of language files (which doesn’t seem to apply to version 2.1.1 of BuddyPress). Can anyone here give me some pointers on how I’d do this in BuddyPress v2.1.1 ?

    Thanks!
    – Yvan


    shanebp
    Moderator

    @shanebp

    Try this in bp-custom.php

    function ideas_change_buddypress_text( $translated, $original_text, $domain ) {
    
        if ( 'buddypress' !== $domain )  
            return $translated; 
    
        switch ( $original_text ) {
        
            case 'Friends <span>%d</span>':
                return 'Connections <span>%d</span>';
    
            case 'Friends':
                return 'Connections';
                			
            default:
                return $translated;
        }
    }
    add_filter( 'gettext', 'ideas_change_buddypress_text', 10, 3 );

    ideasdesigninc
    Participant

    @ideasdesigninc

    Thanks for your reply Shane, but adding that function to my bp-custom.php file didn’t change anything at all. Any other suggestions?

    – Yvan


    shanebp
    Moderator

    @shanebp

    It’s a matter of finding the exact syntax.
    This works in the function I provided.

            case 'Friends <span class="%s">%s</span>':
                return 'Connections <span class="%s">%s</span>';

    A gettext filter is a reasonable approach if there are one or two labels that need to be changed.
    But there are so many different places where ‘Friend’ or some variation is used that in your case you should definitely use a .mo file.
    Read:

    Customizing Labels, Messages, and URLs

    Often there is confusion re the Sources Keywords section of PoEdit, so after you read the above, take a look at http://www.cssigniter.com/ignite/wordpress-poedit-translation-secrets/
    especially the section titled ‘Keywords lists, WordPress functions, whaaaaaa?’.


    ideasdesigninc
    Participant

    @ideasdesigninc

    Thank you so much! Creating and uploading my own language files seemed to to the trick. However — it’s unclear as to whether or not the “Sources Keywords” stuff is even relevant in my situation. Wouldn’t the WordPress functions already exist in the BuddyPress language file that I’ve copied and modified? If I’ve done something wrong (by ignoring these Sources Keywords stuff) — how can I test/verify that?

    Thanks,
    – Yvan


    shanebp
    Moderator

    @shanebp

    If all the strings you want to translate are appearing in poedit, then you are fine.

    The ‘functions’ are related to gettext, not WP or BP functions.
    WP / BP uses those functions.

    Here’s more reading:
    http://code.tutsplus.com/tutorials/translating-your-theme–wp-25014

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing "Friends" to "Connections" ?’ is closed to new replies.
Skip to toolbar