Changeset 2370
- Timestamp:
- 01/19/2010 08:38:20 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bp-activity/bp-activity-templatetags.php (modified) (1 diff)
-
bp-themes/bp-default/_inc/ajax.php (modified) (3 diffs)
-
bp-themes/bp-default/_inc/global.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-templatetags.php
r2361 r2370 473 473 /* Delete link */ 474 474 if ( is_site_admin() || $bp->loggedin_user->id == $comment->user_id ) 475 $content .= ' · <a href="' . wp_nonce_url( $bp->activity->id . '/delete/?cid=' . $comment->id, ' delete_activity_comment' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';475 $content .= ' · <a href="' . wp_nonce_url( $bp->activity->id . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>'; 476 476 477 477 $content .= '</div>'; -
trunk/bp-themes/bp-default/_inc/ajax.php
r2369 r2370 145 145 add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' ); 146 146 147 function bp_dtheme_delete_activity _comment() {147 function bp_dtheme_delete_activity() { 148 148 /* Check the nonce */ 149 check_admin_referer( ' delete_activity_comment' );149 check_admin_referer( 'bp_activity_delete_link' ); 150 150 151 151 if ( !is_user_logged_in() ) { … … 154 154 } 155 155 156 if ( empty( $_POST[' comment_id'] ) || !is_numeric( $_POST['comment_id'] ) || !bp_activity_delete_by_activity_id( $_POST['comment_id'] ) ) {157 echo '-1<div class="error"><p>' . __( 'There was a problem deleting that comment. Please try again.', 'buddypress' ) . '</p></div>';156 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete_by_activity_id( $_POST['id'] ) ) { 157 echo '-1<div class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>'; 158 158 return false; 159 159 } … … 161 161 return true; 162 162 } 163 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' ); 163 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity' ); 164 add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' ); 164 165 165 166 function bp_dtheme_activity_loop( $type = 'all', $filter = false, $query_string = false, $per_page = 20, $page = 1 ) { -
trunk/bp-themes/bp-default/_inc/global.js
r2367 r2370 180 180 if ( 'activity-favorites' == j( 'div.item-list-tabs li.selected').attr('id') ) 181 181 target.parent().parent().parent().slideUp(100); 182 }); 183 184 return false; 185 } 186 187 /* Delete activity stream items */ 188 if ( target.hasClass('delete-activity') ) { 189 var li = target.parents('div.activity ul li'); 190 var id = li.attr('id').substr( 9, li.attr('id').length ); 191 var link_href = target.attr('href'); 192 193 var nonce = link_href.split('_wpnonce='); 194 nonce = nonce[1]; 195 196 target.addClass('loading'); 197 198 j.post( ajaxurl, { 199 action: 'delete_activity', 200 'cookie': encodeURIComponent(document.cookie), 201 'id': id, 202 '_wpnonce': nonce 203 }, 204 function(response) { 205 target.removeClass('loading'); 206 207 if ( response[0] + response[1] == '-1' ) { 208 li.prepend( response.substr( 2, response.length ) ); 209 li.children('div#message').hide().fadeIn(200); 210 } else { 211 li.slideUp(200); 212 } 182 213 }); 183 214 … … 396 427 397 428 j.post( ajaxurl, { 398 action: 'delete_activity _comment',429 action: 'delete_activity', 399 430 'cookie': encodeURIComponent(document.cookie), 400 431 '_wpnonce': nonce, 401 ' comment_id': comment_id432 'id': comment_id 402 433 }, 403 434 function(response)
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)