bp_legacy_theme_spam_activity

AJAX spam an activity item or comment.

Description

bp_legacy_theme_spam_activity(); 

Usage

  1. if ( !function_exists( 'bp_legacy_theme_spam_activity' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-templates/bp-legacy/buddypress-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_legacy_theme_spam_activity(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-templates/bp-legacy/buddypress-functions.php  
  1. function bp_legacy_theme_spam_activity() { 
  2. $bp =buddypress); 
  3.  
  4. // Bail if not a POST action. 
  5. if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 
  6. return; 
  7.  
  8. // Check that user is logged in, Activity Streams are enabled, and Akismet is present. 
  9. if ( ! is_user_logged_in() || ! bp_is_active( 'activity' ) || empty( $bp->activity->akismet ) ) 
  10. exit( '-1' ); 
  11.  
  12. // Check an item ID was passed. 
  13. if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) ) 
  14. exit( '-1' ); 
  15.  
  16. // Is the current user allowed to spam items? 
  17. exit( '-1' ); 
  18.  
  19. // Load up the activity item. 
  20. $activity = new BP_Activity_Activity( (int) $_POST['id'] ); 
  21. if ( empty( $activity->component ) ) 
  22. exit( '-1' ); 
  23.  
  24. // Check nonce. 
  25. check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id ); 
  26.  
  27. /** This action is documented in bp-activity/bp-activity-actions.php */ 
  28. do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity ); 
  29.  
  30. // Mark as spam. 
  31. bp_activity_mark_as_spam( $activity ); 
  32. $activity->save(); 
  33.  
  34. /** This action is documented in bp-activity/bp-activity-actions.php */ 
  35. do_action( 'bp_activity_action_spam_activity', $activity->id, $activity->user_id ); 
  36. exit;