bbp_unspam_reply( int $reply_id )
Unspams a reply
Description
Parameters
- $reply_id
-
(Required) Reply id
Return
(mixed) False or WP_Error on failure, reply id on success
Source
File: bp-forums/replies/functions.php
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 | function bbp_unspam_reply( $reply_id = 0 ) { // Get reply $reply = bbp_get_reply( $reply_id ); if ( empty ( $reply ) ) return $reply ; // Bail if already not spam if ( bbp_get_spam_status_id() !== $reply ->post_status ) return false; // Execute pre unspam code do_action( 'bbp_unspam_reply' , $reply_id ); // Get pre spam status $reply ->post_status = get_post_meta( $reply_id , '_bbp_spam_meta_status' , true ); // If no previous status, default to publish if ( empty ( $reply ->post_status ) ) { $reply ->post_status = bbp_get_public_status_id(); } // Delete pre spam meta delete_post_meta( $reply_id , '_bbp_spam_meta_status' ); // No revisions remove_action( 'pre_post_update' , 'wp_save_post_revision' ); // Update the reply $reply_id = wp_update_post( $reply ); // Execute post unspam code do_action( 'bbp_unspammed_reply' , $reply_id ); // Return reply_id return $reply_id ; } |
Changelog
Version | Description |
---|---|
bbPress (r2740) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.