Changeset 4842 for trunk/bp-messages/bp-messages-actions.php
- Timestamp:
- 07/24/2011 10:51:38 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-messages/bp-messages-actions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-actions.php
r4825 r4842 10 10 11 11 function messages_action_view_message() { 12 global $ bp, $thread_id;12 global $thread_id; 13 13 14 if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view')14 if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) ) 15 15 return false; 16 16 17 $thread_id = 0; 18 if ( !empty( $bp->action_variables[0] ) ) 19 $thread_id = $bp->action_variables[0]; 20 21 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) ) 22 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component ); 17 $thread_id = (int)bp_action_variable( 0 ); 18 19 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access( $thread_id ) && !is_super_admin() ) ) 20 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() ); 23 21 24 22 // Check if a new reply has been submitted … … 34 32 bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' ); 35 33 36 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component. '/view/' . $thread_id . '/' );34 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/' ); 37 35 } 38 36 … … 50 48 'name' => sprintf( __( 'From: %s', 'buddypress' ), BP_Messages_Thread::get_last_sender( $thread_id ) ), 51 49 'slug' => 'view', 52 'parent_url' => $bp->loggedin_user->domain . $bp->messages->slug . '/',53 'parent_slug' => $bp->messages->slug,50 'parent_url' => trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ), 51 'parent_slug' => bp_get_messages_slug(), 54 52 'screen_function' => true, 55 53 'position' => 40, 56 54 'user_has_access' => bp_is_my_profile(), 57 'link' => $bp->loggedin_user->domain . $bp->messages->slug. '/view/' . (int) $thread_id55 'link' => bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . (int) $thread_id 58 56 ) ); 59 57 … … 63 61 64 62 function messages_action_delete_message() { 65 global $ bp, $thread_id;63 global $thread_id; 66 64 67 if ( $bp->current_component != $bp->messages->slug || 'notices' == $bp->current_action || empty( $bp->action_variables[0] ) || 'delete' != $bp->action_variables[0])65 if ( !bp_is_messages_component() || bp_is_current_action( 'notices' ) || !bp_is_action_variable( 'delete', 0 ) ) 68 66 return false; 69 67 70 $thread_id = $bp->action_variables[1];71 72 if ( !$thread_id || !is_numeric( $thread_id) || !messages_check_thread_access($thread_id) ) {73 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action);68 $thread_id = bp_action_variable( 1 ); 69 70 if ( !$thread_id || !is_numeric( $thread_id ) || !messages_check_thread_access( $thread_id ) ) { 71 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 74 72 } else { 75 73 if ( !check_admin_referer( 'messages_delete_thread' ) ) … … 77 75 78 76 // Delete message 79 if ( !messages_delete_thread( $thread_id) ) {77 if ( !messages_delete_thread( $thread_id ) ) { 80 78 bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' ); 81 79 } else { 82 80 bp_core_add_message( __('Message deleted.', 'buddypress') ); 83 81 } 84 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);82 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 85 83 } 86 84 } … … 88 86 89 87 function messages_action_bulk_delete() { 90 global $ bp, $thread_ids;88 global $thread_ids; 91 89 92 if ( $bp->current_component != $bp->messages->slug || empty( $bp->action_variables[0] ) || 'bulk-delete' != $bp->action_variables[0])90 if ( !bp_is_messages_component() || !bp_is_action_variable( 'bulk-delete', 0 ) ) 93 91 return false; 94 92 95 93 $thread_ids = $_POST['thread_ids']; 96 94 97 if ( !$thread_ids || !messages_check_thread_access( $thread_ids) ) {98 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action);95 if ( !$thread_ids || !messages_check_thread_access( $thread_ids ) ) { 96 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 99 97 } else { 100 98 if ( !check_admin_referer( 'messages_delete_thread' ) ) … … 106 104 bp_core_add_message( __('Messages deleted.', 'buddypress') ); 107 105 108 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);106 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 109 107 } 110 108 }
Note: See TracChangeset
for help on using the changeset viewer.