Skip to:
Content

BuddyPress.org

Ticket #8281: 8281.patch

File 8281.patch, 1.7 KB (added by imath, 4 years ago)
  • src/bp-templates/bp-nouveau/includes/messages/ajax.php

    diff --git src/bp-templates/bp-nouveau/includes/messages/ajax.php src/bp-templates/bp-nouveau/includes/messages/ajax.php
    index d27365d03..ee624657a 100644
    function bp_nouveau_ajax_get_thread_messages() { 
    494494                        $thread->messages[ $i ]['star_nonce'] = wp_create_nonce( 'bp-messages-star-' . bp_get_the_thread_message_id() );
    495495                }
    496496
     497                /**
     498                 * Filter here to include your meta data to one or more messages of the thread.
     499                 *
     500                 * @since ?
     501                 *
     502                 * @param array $message_meta An associative array keyed using the meta_key.
     503                 * @param array $message The current message in the loop.
     504                 */
     505                $message_meta = (array) apply_filters( 'bp_nouveau_ajax_get_thread_message_meta', array(), $thread->messages[ $i ] );
     506
     507                if ( $message_meta ) {
     508                        $thread->messages[ $i ]['meta'] = $message_meta;
     509                }
     510
    497511                $extra_content = bp_nouveau_messages_catch_hook_content( array(
    498512                        'beforeMeta'    => 'bp_before_message_meta',
    499513                        'afterMeta'     => 'bp_after_message_meta',
    function bp_nouveau_ajax_get_thread_messages() { 
    513527        // Remove the bp_current_action() override.
    514528        $bp->current_action = $reset_action;
    515529
     530        /**
     531         * Filter here to include your meta data to the main message of the thread.
     532         *
     533         * @since ?
     534         *
     535         * @param array $thread_meta An associative array keyed using the meta_key.
     536         * @param array $thread The current message in the loop.
     537         */
     538        $thread_meta = (array) apply_filters( 'bp_nouveau_ajax_get_thread_meta', array(), $thread->thread );
     539
     540        if ( $thread_meta ) {
     541                $thread->thread['meta'] = $thread_meta;
     542        }
     543
    516544        wp_send_json_success( $thread );
    517545}
    518546