Is it possible to add sender username to start of BP msg subject?

I would really be thankful for help on this, I want when users type a message subject, it should include their username at the beginning or end. The Subject should be like this: “Username: Are you coming tomorrow?”
I was reading this useful article: https://samelh.com/blog/2016/01/22/buddypress-how-to-add-custom-content-after-message-text-content/

  • Predrag Dubajic

    Hi Mwale,

    Hope you're doing well :slight_smile:

    I'm not BP expert but based on that linked article we should be able to do it by using a different hook and then changing the content a bit, so try with something like this in child theme functions.php and see if that does the trick:
    add_action('bp_get_the_thread_subject', function( $message ) {

    ob_start();
    
    	echo '<strong>' . bp_the_thread_message_sender_name() . ': </strong>';
    
      $html = ob_get_clean();
    
      return $html . $message;
    
    });

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.