bp_get_message_thread_avatar( array|string $args = '' )

Return the avatar for the last sender in the current message thread.

Description

See also

Parameters

$args

(Optional) Arguments are listed here with an explanation of their defaults. For more information about the arguments, see bp_core_fetch_avatar().

  • 'type'
    (string) Default: 'thumb'.
  • 'width'
    (int|bool) Default: false.
  • 'height'
    (int|bool) Default: false.
  • 'class'
    (string) Default: 'avatar'.
  • 'id'
    (string|bool) Default: false.
  • 'alt'
    (string) Default: 'Profile picture of [display name]'.

Default value: ''

Return

(string) User avatar string.

Source

File: bp-messages/bp-messages-template.php

729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
function bp_get_message_thread_avatar( $args = '' ) {
    global $messages_template;
 
    $fullname = bp_core_get_user_displayname( $messages_template->thread->last_sender_id );
    $alt      = sprintf( __( 'Profile photo of %s', 'buddyboss' ), $fullname );
 
    $r = bp_parse_args( $args, array(
        'type'   => 'thumb',
        'width'  => false,
        'height' => false,
        'class'  => 'avatar',
        'id'     => false,
        'alt'    => $alt
    ) );
 
    /**
     * Filters the avatar for the last sender in the current message thread.
     *
     * @since BuddyPress 1.0.0
     * @since BuddyPress 2.6.0 Added the `$r` parameter.
     *
     * @param string $value User avatar string.
     * @param array  $r     Array of parsed arguments.
     */
    return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array(
        'item_id' => $messages_template->thread->last_sender_id,
        'type'    => $r['type'],
        'alt'     => $r['alt'],
        'css_id'  => $r['id'],
        'class'   => $r['class'],
        'width'   => $r['width'],
        'height'  => $r['height'],
    ) ), $r );
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.