Skip to:
Content
Pages
Categories
Search
Top
Bottom

Friend Request Email Subject Filter


  • lolotrgeek
    Participant

    @lolotrgeek

    Hi, I want to change the subject of the email buddypress sends after a friend request.

    Here’s what I have, it is not working:

    function newSubject($initiator_name )  
    {	
    	$subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'New subject %s', 'buddypress' ), $initiator_name ) ) );
    
    		return $subject;
    }
    
    add_filter( 'friends_notification_new_request', 'newSubject', 10, 1);

    What am I doing wrong? (reference)

    Thanks!

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

  • shanebp
    Moderator

    @shanebp

    In the same function that you reference, you’ll find this filter hook:

    $subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );

    So something like:

    function lolo_subject( $subject, $initiator_name ) {
    
        $subject =  $initiator_name . ' wants to be friends';
        return $subject;
    } 
    add_filter( 'friends_notification_new_request_subject', 'lolo_subject', 15, 2 );

    lolotrgeek
    Participant

    @lolotrgeek

    That worked, I knew it was something easy that I was missing.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Friend Request Email Subject Filter’ is closed to new replies.
Skip to toolbar