Skip to:
Content
Pages
Categories
Search
Top
Bottom

Only receiver of message


  • Debora1976
    Participant

    @debora1976

    Hi,

    In the messages outbox the sender aswell as the receiver are in the <?php bp_message_thread_to(); ?>
    Is it possible to only show the receiver of the message?

    Kind regards,
    Debby

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

  • Venutius
    Moderator

    @venutius

    You can with BP Legacy, there’s a filer bp_message_thread_to which provides an array of all the sent to id’s, you can loop through these and unset it where it is the same as the current user id.

    Not sure if that would work for BP Nouveau.


    Debora1976
    Participant

    @debora1976

    Oke, thanks.
    Could you tell me, what I need to change here than?

    <td class=”thread-from”>
    <?php bp_message_thread_avatar( array( ‘width’ => 25, ‘height’ => 25 ) ); ?>
    <span class=”to”><?php _e( ‘To:’, ‘buddypress’ ); ?></span> <?php bp_message_thread_to(); ?>

    <span class=”activity”><?php bp_message_thread_last_post_date(); ?></span>
    </td>


    Venutius
    Moderator

    @venutius

    You can add this to your functions.php:

    function bpex_revise_message_to( $recipients ) {
    	
    	$href = bp_core_get_user_domain( get_current_user_id() );
    	$explode = explode( ', ', $recipients );
    	foreach ( $explode as $index => $to_link ) {
    
    	    if ( strpos( $to_link, $href ) !== false ) {
    			unset($explode[$index]);
    		}
    	    }
    
    	$recipients = implode( ', ', $explode );
    
    	return $recipients;
    	
    }
    
    add_filter('bp_message_thread_to', 'bpex_revise_message_to' );

    This does not work with BP Nouveau though.


    Debora1976
    Participant

    @debora1976

    Thank you so much!

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