Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/28/2018 05:34:41 PM (8 years ago)
Author:
imath
Message:

Messages: catch Legacy hooks to customize the Active conversation box.

In order to preserve in the BP Nouveau Messages UI the level of PHP customization that developers are used to get in Legacy using do_action hooks, The content generated for the following hooks will be caught during Ajax requests and added as new properties of their JSON replies:

  • bp_before_message_meta
  • bp_after_message_meta
  • bp_messages_inbox_list_item
  • bp_messages_thread_options

About the bp_messages_inbox_list_item hook: as the Messages UI of BP Nouveau, unlike Legacy, is not using a table tag to display the list of messages received/starred/sent. All extra actions about messages into these loop views are done within the Active conversation box (eg: star/unstar). To inject the content of this specific hook, we are adding a table element under the message content preview as the expected output is a td tag.

See #7851 (Trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    r12133 r12141  
    176176    <# if ( undefined !== data.content ) { #>
    177177
    178         <h2 class="message-title preview-thread-title"><?php esc_html_e( 'Active conversation:', 'buddypress' ); ?><span class="messages-title"> <# print( data.subject ); #></span></h2>
     178        <h2 class="message-title preview-thread-title"><?php esc_html_e( 'Active conversation:', 'buddypress' ); ?><span class="messages-title">{{{data.subject}}}</span></h2>
    179179        <div class="preview-content">
    180180            <header class="preview-pane-header">
     
    216216                        <span class="bp-screen-reader-text"><?php esc_html_e( 'View full conversation and reply.', 'buddypress' ); ?></span>
    217217                    </a>
     218
     219                    <# if ( data.threadOptions ) { #>
     220                        <span class="bp-messages-hook thread-options">
     221                            {{{data.threadOptions}}}
     222                        </span>
     223                    <# } #>
    218224                </div>
    219225            </header>
    220226
    221227            <div class='preview-message'>
    222                 <# print( data.content ) #>
     228                {{{data.content}}}
    223229            </div>
     230
     231            <# if ( data.inboxListItem ) { #>
     232                <table class="bp-messages-hook inbox-list-item">
     233                    <tbody>
     234                        <tr>{{{data.inboxListItem}}}</tr>
     235                    </tbody>
     236                </table>
     237            <# } #>
    224238        </div>
    225239    <# } #>
     
    227241
    228242<script type="text/html" id="tmpl-bp-messages-single-header">
    229     <h2 id="message-subject" class="message-title single-thread-title"><# print( data.subject ); #></h2>
     243    <h2 id="message-subject" class="message-title single-thread-title">{{{data.subject}}}</h2>
    230244    <header class="single-message-thread-header">
    231245        <# if ( undefined !== data.recipients ) { #>
     
    243257
    244258        <div class="actions">
    245 
    246259            <button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    247260                <span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    248261            </button>
    249 
    250             <?php bp_nouveau_messages_hook( 'after', 'thread_header_actions' ); ?>
    251262        </div>
    252263    </header>
     
    255266<script type="text/html" id="tmpl-bp-messages-single-list">
    256267    <div class="message-metadata">
    257         <?php bp_nouveau_messages_hook( 'before', 'meta' ); ?>
     268        <# if ( data.beforeMeta ) { #>
     269            <div class="bp-messages-hook before-message-meta">{{{data.beforeMeta}}}</div>
     270        <# } #>
    258271
    259272        <a href="{{data.sender_link}}" class="user-link">
     
    278291        </div>
    279292
    280         <?php bp_nouveau_messages_hook( 'after', 'meta' ); ?>
    281 
     293        <# if ( data.afterMeta ) { #>
     294            <div class="bp-messages-hook after-message-meta">{{{data.afterMeta}}}</div>
     295        <# } #>
    282296    </div>
    283297
     
    311325            <div class="message-metadata">
    312326
    313                 <?php bp_nouveau_messages_hook( 'before', 'meta' ); ?>
     327                <?php bp_nouveau_messages_hook( 'before', 'reply_meta' ); ?>
    314328
    315329                <div class="avatar-box">
     
    319333                </div>
    320334
    321                 <?php bp_nouveau_messages_hook( 'after', 'meta' ); ?>
     335                <?php bp_nouveau_messages_hook( 'after', 'reply_meta' ); ?>
    322336
    323337            </div><!-- .message-metadata -->
Note: See TracChangeset for help on using the changeset viewer.