BBP_Topics_Admin::save_meta_boxes( int $topic_id )
Pass the topic attributes for processing
Description Description
Parameters Parameters
- $topic_id
-
(Required) Topic id
Return Return
(int) Parent id
Source Source
File: includes/admin/topics.php
public function save_meta_boxes( $topic_id ) { // Bail if doing an autosave if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $topic_id; } // Bail if not a post request if ( ! bbp_is_post_request() ) { return $topic_id; } // Check action exists if ( empty( $_POST['action'] ) ) { return $topic_id; } // Nonce check if ( empty( $_POST['bbp_topic_metabox'] ) || ! wp_verify_nonce( $_POST['bbp_topic_metabox'], 'bbp_topic_metabox_save' ) ) { return $topic_id; } // Bail if current user cannot edit this topic if ( ! current_user_can( 'edit_topic', $topic_id ) ) { return $topic_id; } // Get the forum ID $forum_id = ! empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0; // Get topic author data $anonymous_data = bbp_filter_anonymous_post_data(); $author_id = bbp_get_topic_author_id( $topic_id ); $is_edit = ( isset( $_POST['hidden_post_status'] ) && ( $_POST['hidden_post_status'] !== 'draft' ) ); // Formally update the topic bbp_update_topic( $topic_id, $forum_id, $anonymous_data, $author_id, $is_edit ); // Allow other fun things to happen do_action( 'bbp_topic_attributes_metabox_save', $topic_id, $forum_id ); do_action( 'bbp_author_metabox_save', $topic_id, $anonymous_data ); return $topic_id; }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |