Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help changing contact in profile!!


  • jthakore1
    Participant

    @jthakore1

    Hi

    I am having some difficulty changing friend to contact on only the profile page, I have changed it on the sub menu under activity and have changed it on the sub menu under friends which used to say friendship.

    However, I am now stuck on the main tab on the profile which states friends, how can I change this, is it the case that I have to change it in the php files like I done before ?

    Thanks in advanced

    Kind regards

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    It’s best to make your changes in the language file.

    If you only want to change a label or two, you can use functions. The tricky part is knowing which filter hooks to use: gettext or gettext_with_context.

    In your case, you need both:

    function example_gettext_with_context( $translated, $text, $context, $domain ) {
    
        if ( 'buddypress' !== $domain )
            return $translated;
    
         switch ( $text ) {
    
            case 'Friends':
                return 'Contacts';
                
            default:
                return $translated;
        }
    
    }
    add_filter( 'gettext_with_context', 'example_gettext_with_context', 11, 4 );
    
    function example_gettext( $translated, $original_text, $domain ) {
    
        if ( 'buddypress' !== $domain )  
            return $translated;
    
        switch ( $original_text ) {
    			
           case 'Friends <span class="%s">%s</span>';
                return 'Contacts <span class="%s">%s</span>';
    
            default:
                return $translated;
        }
    }
    add_filter( 'gettext', 'example_gettext', 10, 3 );
Viewing 1 replies (of 1 total)
  • The topic ‘Help changing contact in profile!!’ is closed to new replies.
Skip to toolbar