bbp_unspam_reply

Unspams a reply.

Description

bbp_unspam_reply( (int) $reply_id = 0 ); 

Parameters (1)

0. $reply_id — Optional. (int)
The reply id.

Usage

  1. if ( !function_exists( 'bbp_unspam_reply' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/replies/functions.php'; 
  3.  
  4. // The reply id. 
  5. $reply_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_unspam_reply($reply_id); 
  9.  

Defined (1)

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

/includes/replies/functions.php  
  1. function bbp_unspam_reply( $reply_id = 0 ) { 
  2.  
  3. // Get reply 
  4. $reply = bbp_get_reply( $reply_id ); 
  5. if ( empty( $reply ) ) 
  6. return $reply; 
  7.  
  8. // Bail if already not spam 
  9. if ( bbp_get_spam_status_id() !== $reply->post_status ) 
  10. return false; 
  11.  
  12. // Execute pre unspam code 
  13. do_action( 'bbp_unspam_reply', $reply_id ); 
  14.  
  15. // Get pre spam status 
  16. $reply->post_status = get_post_meta( $reply_id, '_bbp_spam_meta_status', true ); 
  17.  
  18. // If no previous status, default to publish 
  19. if ( empty( $reply->post_status ) ) { 
  20. $reply->post_status = bbp_get_public_status_id(); 
  21.  
  22. // Delete pre spam meta 
  23. delete_post_meta( $reply_id, '_bbp_spam_meta_status' ); 
  24.  
  25. // No revisions 
  26. remove_action( 'pre_post_update', 'wp_save_post_revision' ); 
  27.  
  28. // Update the reply 
  29. $reply_id = wp_update_post( $reply ); 
  30.  
  31. // Execute post unspam code 
  32. do_action( 'bbp_unspammed_reply', $reply_id ); 
  33.  
  34. // Return reply_id 
  35. return $reply_id;