bbp_approve_reply( int $reply_id )
Approves a reply
Description Description
Parameters Parameters
- $reply_id
-
(Required) Reply id
Return Return
(mixed) False or WP_Error on failure, reply id on success
Source Source
File: includes/replies/functions.php
function bbp_approve_reply( $reply_id = 0 ) {
// Get reply
$reply = bbp_get_reply( $reply_id );
if ( empty( $reply ) ) {
return $reply;
}
// Get new status
$status = bbp_get_public_status_id();
// Bail if already approved
if ( $status === $reply->post_status ) {
return false;
}
// Execute pre pending code
do_action( 'bbp_approve_reply', $reply_id );
// Set publish status
$reply->post_status = $status;
// No revisions
remove_action( 'pre_post_update', 'wp_save_post_revision' );
// Update reply
$reply_id = wp_update_post( $reply );
// Execute post pending code
do_action( 'bbp_approved_reply', $reply_id );
// Return reply_id
return $reply_id;
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.6.0 | Introduced. |