Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/30/2012 11:42:31 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Messages:

  • Separate conversation screen logic into dedicated screen function.
  • Remove goofy extra sub-nav item when viewing a conversation.
  • Manually hook conversation screen into bp_screens() as there is no associated menu item callback.
  • Fixes debug notices in theme compat, and brings message conversations up to par with other components and functionality.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-screens.php

    r6342 r6545  
    8787}
    8888
     89function messages_screen_conversation() {
     90
     91    // Bail if not viewing a single message
     92    if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) )
     93        return false;
     94
     95    $thread_id = (int) bp_action_variable( 0 );
     96
     97    if ( empty( $thread_id ) || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access( $thread_id ) && !bp_current_user_can( 'bp_moderate' ) ) )
     98        bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ) );
     99
     100    // Load up BuddyPress one time
     101    $bp = buddypress();
     102
     103    // Decrease the unread count in the nav before it's rendered
     104    $bp->bp_nav[$bp->messages->slug]['name'] = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() );
     105
     106    do_action( 'messages_screen_conversation' );
     107
     108    bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) );
     109}
     110add_action( 'bp_screens', 'messages_screen_conversation' );
     111
    89112function messages_screen_notices() {
    90113    global $notice_id;
Note: See TracChangeset for help on using the changeset viewer.