diff --git src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php
index c5ddaddf9..71f6e520c 100644
|
|
|
272 | 272 | |
273 | 273 | </div> |
274 | 274 | |
275 | | <?php bp_nouveau_messages_hook( 'before', 'content' ); ?> |
| 275 | <# if ( data.beforeContent ) { #> |
| 276 | <div class="before-message-content">{{{data.beforeContent}}}</div> |
| 277 | <# } #> |
276 | 278 | |
277 | | <div class="message-content"><# print( data.content ) #></div> |
| 279 | <div class="message-content">{{{data.content}}}</div> |
278 | 280 | |
279 | | <?php bp_nouveau_messages_hook( 'after', 'content' ); ?> |
| 281 | <# if ( data.afterContent ) { #> |
| 282 | <div class="after-message-content">{{{data.afterContent}}}</div> |
| 283 | <# } #> |
280 | 284 | |
281 | 285 | </script> |
282 | 286 | |
diff --git src/bp-templates/bp-nouveau/includes/messages/ajax.php src/bp-templates/bp-nouveau/includes/messages/ajax.php
index 16c80a7c8..d833f3573 100644
|
|
function bp_nouveau_ajax_messages_send_reply() { |
182 | 182 | $reply['is_starred'] = array_search( 'unstar', explode( '/', $star_link ) ); |
183 | 183 | } |
184 | 184 | |
| 185 | $extra_content = bp_nouveau_messages_catch_hook_content( array( |
| 186 | 'beforeContent' => 'bp_before_message_content', |
| 187 | 'afterContent' => 'bp_after_message_content', |
| 188 | ) ); |
| 189 | |
| 190 | if ( array_filter( $extra_content ) ) { |
| 191 | $reply = array_merge( $reply, $extra_content ); |
| 192 | } |
| 193 | |
185 | 194 | // Clean up the loop. |
186 | 195 | bp_thread_messages(); |
187 | 196 | |
… |
… |
function bp_nouveau_ajax_get_thread_messages() { |
422 | 431 | $thread->messages[ $i ]['star_nonce'] = wp_create_nonce( 'bp-messages-star-' . bp_get_the_thread_message_id() ); |
423 | 432 | } |
424 | 433 | |
| 434 | $extra_content = bp_nouveau_messages_catch_hook_content( array( |
| 435 | 'beforeContent' => 'bp_before_message_content', |
| 436 | 'afterContent' => 'bp_after_message_content', |
| 437 | ) ); |
| 438 | |
| 439 | if ( array_filter( $extra_content ) ) { |
| 440 | $thread->messages[ $i ] = array_merge( $thread->messages[ $i ], $extra_content ); |
| 441 | } |
| 442 | |
425 | 443 | $i += 1; |
426 | 444 | endwhile; |
427 | 445 | |
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
index 191a85381..1784cedb2 100644
|
|
function bp_nouveau_messages_notification_filters() { |
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | } |
| 447 | |
| 448 | /** |
| 449 | * Fires Messages Legacy hooks to catch the content and add them |
| 450 | * as extra keys to the JSON Messages UI reply. |
| 451 | * |
| 452 | * @since 3.0.1 |
| 453 | * |
| 454 | * @param array $hooks The list of hooks to fire. |
| 455 | * @return array An associative containing the caught content. |
| 456 | */ |
| 457 | function bp_nouveau_messages_catch_hook_content( $hooks = array() ) { |
| 458 | $content = array(); |
| 459 | |
| 460 | ob_start(); |
| 461 | foreach ( $hooks as $js_key => $hook ) { |
| 462 | if ( ! has_action( $hook ) ) { |
| 463 | continue; |
| 464 | } |
| 465 | |
| 466 | // Fire the hook. |
| 467 | do_action( $hook ); |
| 468 | |
| 469 | // Catch the content. |
| 470 | $content[ $js_key ] = ob_get_contents(); |
| 471 | |
| 472 | // Clean the buffer. |
| 473 | ob_clean(); |
| 474 | } |
| 475 | ob_end_clean(); |
| 476 | |
| 477 | return $content; |
| 478 | } |