Skip to:
Content
Pages
Categories
Search
Top
Bottom

Location of PHP file that contains “Add Friend” button


  • sixthgalaxy
    Participant

    @sixthgalaxy

    Can you please let me know the location of the buddypress file- php/javascript- which shows the “Add Friend” button in the membership page?

    Thank you.

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

  • shanebp
    Moderator

    @shanebp

    http://hookr.io/functions/bp_add_friend_button/

    buddypress\bp-friends\bp-friends-template.php ~Line 338


    sixthgalaxy
    Participant

    @sixthgalaxy

    Thank you @shanebp for your help.

    Can you please let me know how to change the text “Add Friend” button text to something else? I have found “Add Friend” text in bp-templates/bp-legacy/buddypress-functions.php file,but when I change the text in that location it does not take effect. It only takes effect once I click on it and then click on “Cancel Friendship Request”. When I refresh the member page, it again shows “Add Friend” text.

    Thank you.


    shanebp
    Moderator

    @shanebp

    Try this in bp-custom.php

    function sg_gettext( $translated, $original_text, $domain ) {
    
        if ( 'buddypress' !== $domain )  
               return $translated;
    
        switch ( $original_text ) {
            case 'Add Friend':
                return 'Something Else';
    
            default:
                return $translated;
        }
    }
    add_filter( 'gettext', 'sg_gettext', 20, 3 );

    sixthgalaxy
    Participant

    @sixthgalaxy

    It works @shanebp 🙂
    Thank you so much for your kind help.

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