BBP_Replies_Admin::save_meta_boxes( int $reply_id )
Pass the reply attributes for processing
Description Description
Parameters Parameters
- $reply_id
-
(Required) Reply id
Return Return
(int) Parent id
Source Source
File: includes/admin/replies.php
public function save_meta_boxes( $reply_id ) {
// Bail if doing an autosave
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $reply_id;
}
// Bail if not a post request
if ( ! bbp_is_post_request() ) {
return $reply_id;
}
// Check action exists
if ( empty( $_POST['action'] ) ) {
return $reply_id;
}
// Nonce check
if ( empty( $_POST['bbp_reply_metabox'] ) || ! wp_verify_nonce( $_POST['bbp_reply_metabox'], 'bbp_reply_metabox_save' ) ) {
return $reply_id;
}
// Bail if current user cannot edit this reply
if ( ! current_user_can( 'edit_reply', $reply_id ) ) {
return $reply_id;
}
// Get the reply meta post values
$topic_id = ! empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0;
$forum_id = ! empty( $_POST['bbp_forum_id'] ) ? (int) $_POST['bbp_forum_id'] : bbp_get_topic_forum_id( $topic_id );
$reply_to = ! empty( $_POST['bbp_reply_to'] ) ? (int) $_POST['bbp_reply_to'] : 0;
// Get reply author data
$anonymous_data = bbp_filter_anonymous_post_data();
$author_id = bbp_get_reply_author_id( $reply_id );
$is_edit = ( isset( $_POST['hidden_post_status'] ) && ( $_POST['hidden_post_status'] !== 'draft' ) );
// Formally update the reply
bbp_update_reply( $reply_id, $topic_id, $forum_id, $anonymous_data, $author_id, $is_edit, $reply_to );
// Allow other fun things to happen
do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $topic_id, $forum_id, $reply_to );
do_action( 'bbp_author_metabox_save', $reply_id, $anonymous_data );
return $reply_id;
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |