bbp_spam_reply( int $reply_id )

Marks a reply as spam

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

1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
function bbp_spam_reply( $reply_id = 0 ) {
 
    // Get reply
    $reply = bbp_get_reply( $reply_id );
    if ( empty( $reply ) )
        return $reply;
 
    // Bail if already spam
    if ( bbp_get_spam_status_id() === $reply->post_status )
        return false;
 
    // Execute pre spam code
    do_action( 'bbp_spam_reply', $reply_id );
 
    // Add the original post status as post meta for future restoration
    add_post_meta( $reply_id, '_bbp_spam_meta_status', $reply->post_status );
 
    // Set post status to spam
    $reply->post_status = bbp_get_spam_status_id();
 
    // No revisions
    remove_action( 'pre_post_update', 'wp_save_post_revision' );
 
    // Update the reply
    $reply_id = wp_update_post( $reply );
 
    // Execute post spam code
    do_action( 'bbp_spammed_reply', $reply_id );
 
    // Return reply_id
    return $reply_id;
}

Changelog

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.