Skip to:
Content

BuddyPress.org

Changeset 12937


Ignore:
Timestamp:
04/29/2021 05:41:39 PM (4 years ago)
Author:
imath
Message:

BP Nouveau: add filters to include messages metadata in Ajax responses

Props vapvarun

Fixes #8281

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php

    r12373 r12937  
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 8.0.0
    77 */
    88
     
    495495        }
    496496
     497        /**
     498         * Filter here to include your meta data to one or more messages of the thread.
     499         *
     500         * @since 8.0.0
     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',
     
    513527    // Remove the bp_current_action() override.
    514528    $bp->current_action = $reset_action;
     529
     530    /**
     531     * Filter here to include your meta data to the main message of the thread.
     532     *
     533     * @since 8.0.0
     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    }
    515543
    516544    wp_send_json_success( $thread );
Note: See TracChangeset for help on using the changeset viewer.