bp_get_the_thread_message_css_class()

Generate the CSS classes for messages within a single thread.

Description

Return

(string)

Source

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

1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
function bp_get_the_thread_message_css_class() {
    global $thread_template;
 
    $classes = array();
 
    // Zebra-striping.
    $classes[] = bp_get_the_thread_message_alt_class();
 
    // ID of the sender.
    $classes[] = 'sent-by-' . intval( $thread_template->message->sender_id );
 
    // Whether the sender is the same as the logged-in user.
    if ( bp_loggedin_user_id() == $thread_template->message->sender_id ) {
        $classes[] = 'sent-by-me';
    }
 
    /**
     * Filters the CSS classes for messages within a single thread.
     *
     * @since BuddyPress 2.1.0
     *
     * @param array $classes Array of classes to add to the HTML class attribute.
     */
    $classes = apply_filters( 'bp_get_the_thread_message_css_class', $classes );
 
    return implode( ' ', $classes );
}

Changelog

Changelog
Version Description
BuddyPress 2.1.0 Introduced.

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.