Changeset 5259 for trunk/bp-themes/bp-default/_inc/ajax.php
- Timestamp:
- 10/24/2011 02:00:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/_inc/ajax.php
r5095 r5259 223 223 224 224 // Load the new activity item into the $activities_template global 225 bp_has_activities( 'display_comments=stream& include=' . $comment_id );225 bp_has_activities( 'display_comments=stream&hide_spam=false&include=' . $comment_id ); 226 226 227 227 // Swap the current comment with the activity item we just loaded … … 317 317 } 318 318 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' ); 319 320 /** 321 * AJAX spam an activity item or an activity comment 322 * 323 * @global object $bp BuddyPress global settings 324 * @since 1.6 325 */ 326 function bp_dtheme_spam_activity() { 327 global $bp; 328 329 // Check that user is logged in, Activity Streams are enabled, and Akismet is present. 330 if ( !is_user_logged_in() || !bp_is_active( 'activity' ) || empty( $bp->activity->akismet ) ) { 331 echo '-1'; 332 return false; 333 } 334 335 // Check an item ID was passed 336 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) ) { 337 echo '-1'; 338 return false; 339 } 340 341 // Is the current user allowed to spam items? 342 if ( !BP_Akismet::user_can_mark_spam() ) 343 return false; 344 345 // Load up the activity item 346 $activity = new BP_Activity_Activity( (int) $_POST['id'] ); 347 if ( empty( $activity->id ) ) { 348 echo '-1'; 349 return false; 350 } 351 352 // Check nonce 353 check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id ); 354 355 // Call an action before the spamming so plugins can modify things if they want to 356 do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity ); 357 358 // Mark as spam 359 $bp->activity->akismet->mark_as_spam( $activity ); 360 $activity->save(); 361 362 do_action( 'bp_activity_action_spam_activity', $activity->id, $activity->user_id ); 363 return true; 364 } 365 add_action( 'wp_ajax_spam_activity', 'bp_dtheme_spam_activity' ); 366 add_action( 'wp_ajax_spam_activity_comment', 'bp_dtheme_spam_activity' ); 319 367 320 368 /* AJAX mark an activity as a favorite */
Note: See TracChangeset
for help on using the changeset viewer.