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-actions.php

    r6342 r6545  
    1515if ( !defined( 'ABSPATH' ) ) exit;
    1616
    17 function messages_action_view_message() {
    18     global $thread_id, $bp;
     17function messages_action_conversation() {
     18    global $thread_id;
    1919
    2020    if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) )
     
    3333
    3434        // Send the reply
    35         if ( messages_new_message( array( 'thread_id' => $thread_id, 'subject' => ! empty( $_POST['subject'] ) ? $_POST['subject'] : false, 'content' => $_POST['content'] ) ) )
     35        if ( messages_new_message( array( 'thread_id' => $thread_id, 'subject' => ! empty( $_POST['subject'] ) ? $_POST['subject'] : false, 'content' => $_POST['content'] ) ) ) {
    3636            bp_core_add_message( __( 'Your reply was sent successfully', 'buddypress' ) );
    37         else
     37        } else {
    3838            bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' );
     39        }
    3940
    4041        bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/' );
     
    4445    messages_mark_thread_read( $thread_id );
    4546
    46     // Decrease the unread count in the nav before it's rendered
    47     $name = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() );
    48 
    49     $bp->bp_nav[$bp->messages->slug]['name'] = $name;
    50 
    51     do_action( 'messages_action_view_message' );
    52 
    53     bp_core_new_subnav_item( array(
    54         'name'            => sprintf( __( 'From: %s', 'buddypress' ), BP_Messages_Thread::get_last_sender( $thread_id ) ),
    55         'slug'            => 'view',
    56         'parent_url'      => trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ),
    57         'parent_slug'     => bp_get_messages_slug(),
    58         'screen_function' => true,
    59         'position'        => 40,
    60         'user_has_access' => bp_is_my_profile(),
    61         'link'            => trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . (int) $thread_id )
    62     ) );
    63 
    64     bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) );
     47    do_action( 'messages_action_conversation' );
    6548}
    66 add_action( 'bp_actions', 'messages_action_view_message' );
     49add_action( 'bp_actions', 'messages_action_conversation' );
    6750
    6851function messages_action_delete_message() {
Note: See TracChangeset for help on using the changeset viewer.