Changeset 6545
- Timestamp:
- 11/30/2012 11:42:31 PM (13 years ago)
- Location:
- trunk/bp-messages
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-actions.php
r6342 r6545 15 15 if ( !defined( 'ABSPATH' ) ) exit; 16 16 17 function messages_action_ view_message() {18 global $thread_id , $bp;17 function messages_action_conversation() { 18 global $thread_id; 19 19 20 20 if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) ) … … 33 33 34 34 // 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'] ) ) ) { 36 36 bp_core_add_message( __( 'Your reply was sent successfully', 'buddypress' ) ); 37 else37 } else { 38 38 bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' ); 39 } 39 40 40 41 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/' ); … … 44 45 messages_mark_thread_read( $thread_id ); 45 46 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' ); 65 48 } 66 add_action( 'bp_actions', 'messages_action_ view_message' );49 add_action( 'bp_actions', 'messages_action_conversation' ); 67 50 68 51 function messages_action_delete_message() { -
trunk/bp-messages/bp-messages-screens.php
r6342 r6545 87 87 } 88 88 89 function 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 } 110 add_action( 'bp_screens', 'messages_screen_conversation' ); 111 89 112 function messages_screen_notices() { 90 113 global $notice_id;
Note: See TracChangeset
for help on using the changeset viewer.