Changeset 8621
- Timestamp:
- 07/15/2014 10:57:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-actions.php
r8479 r8621 20 20 function messages_action_conversation() { 21 21 22 if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) ) 22 // Bail if not viewing a single conversation 23 if ( ! bp_is_messages_component() || ! bp_is_current_action( 'view' ) ) { 23 24 return false; 25 } 24 26 25 $thread_id = (int)bp_action_variable( 0 ); 27 // Get the thread ID from the action variable 28 $thread_id = (int) bp_action_variable( 0 ); 26 29 27 if ( ! $thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access( $thread_id ) && !bp_current_user_can( 'bp_moderate' ) ) )30 if ( ! messages_is_valid_thread( $thread_id ) || ( ! messages_check_thread_access( $thread_id ) && ! bp_current_user_can( 'bp_moderate' ) ) ) { 28 31 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ) ); 32 } 29 33 30 34 // Check if a new reply has been submitted … … 34 38 check_admin_referer( 'messages_send_message', 'send_message_nonce' ); 35 39 40 $new_reply = messages_new_message( array( 41 'thread_id' => $thread_id, 42 'subject' => ! empty( $_POST['subject'] ) ? $_POST['subject'] : false, 43 'content' => $_POST['content'] 44 ) ); 45 36 46 // Send the reply 37 if ( messages_new_message( array( 'thread_id' => $thread_id, 'subject' => ! empty( $_POST['subject'] ) ? $_POST['subject'] : false, 'content' => $_POST['content'] )) ) {47 if ( ! empty( $new_reply ) ) { 38 48 bp_core_add_message( __( 'Your reply was sent successfully', 'buddypress' ) ); 39 49 } else { … … 58 68 function messages_action_delete_message() { 59 69 60 if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || !bp_is_action_variable( 'delete', 0 ) )70 if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'delete', 0 ) ) { 61 71 return false; 72 } 62 73 63 74 $thread_id = bp_action_variable( 1 ); … … 66 77 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) ); 67 78 } else { 68 if ( ! check_admin_referer( 'messages_delete_thread' ) )79 if ( ! check_admin_referer( 'messages_delete_thread' ) ) { 69 80 return false; 81 } 70 82 71 83 // Delete message … … 87 99 function messages_action_bulk_delete() { 88 100 89 if ( ! bp_is_messages_component() || !bp_is_action_variable( 'bulk-delete', 0 ) )101 if ( ! bp_is_messages_component() || ! bp_is_action_variable( 'bulk-delete', 0 ) ) { 90 102 return false; 103 } 91 104 92 105 $thread_ids = $_POST['thread_ids'];
Note: See TracChangeset
for help on using the changeset viewer.