ID, '_aksrt_plate_id', true); $sticky = (int) get_post_meta($post->ID, '_aksrt_sticky', true); $locked = (int) get_post_meta($post->ID, '_aksrt_locked', true); $featured = (int) get_post_meta($post->ID, '_aksrt_featured', true); $review = (string) get_post_meta($post->ID, '_aksrt_review_status', true); if ($review === '') { $review = 'approved'; } $bbs_type = (string) (get_post_meta($post->ID, '_aksrt_bbs_type', true) ?: 'standard'); $visibility = (string) (get_post_meta($post->ID, '_aksrt_visibility', true) ?: 'public'); $allow_view = (string) (get_post_meta($post->ID, '_aksrt_allow_view', true) ?: 'public'); $pay_price = (float) get_post_meta($post->ID, '_aksrt_pay_price', true); $pay_credits= (int) get_post_meta($post->ID, '_aksrt_pay_credits', true); $plates = get_posts([ 'post_type' => 'aksrt_forum_plate', 'post_status' => 'publish', 'posts_per_page' => 200, 'orderby' => 'title', 'order' => 'ASC', ]); ?>
post_type !== 'aksrt_forum_topic' || !current_user_can('edit_post', $post_id)) { return; } $plate_id = isset($_POST['aksrt_plate_id']) ? max(0, (int) $_POST['aksrt_plate_id']) : 0; update_post_meta($post_id, '_aksrt_plate_id', $plate_id); $sticky = isset($_POST['aksrt_sticky']) ? max(0, min(3, (int) $_POST['aksrt_sticky'])) : 0; update_post_meta($post_id, '_aksrt_sticky', $sticky); update_post_meta($post_id, '_aksrt_locked', !empty($_POST['aksrt_locked']) ? 1 : 0); update_post_meta($post_id, '_aksrt_featured', !empty($_POST['aksrt_featured']) ? 1 : 0); $review = isset($_POST['aksrt_review_status']) ? sanitize_key((string) wp_unslash($_POST['aksrt_review_status'])) : 'approved'; if (!in_array($review, ['approved', 'pending', 'rejected'], true)) { $review = 'approved'; } update_post_meta($post_id, '_aksrt_review_status', $review); $bbs_type = isset($_POST['aksrt_bbs_type']) ? sanitize_key((string) wp_unslash($_POST['aksrt_bbs_type'])) : 'standard'; if (!in_array($bbs_type, ['standard', 'question'], true)) { $bbs_type = 'standard'; } update_post_meta($post_id, '_aksrt_bbs_type', $bbs_type); $visibility = isset($_POST['aksrt_visibility']) ? sanitize_key((string) wp_unslash($_POST['aksrt_visibility'])) : 'public'; update_post_meta($post_id, '_aksrt_visibility', $visibility); $allow_view = isset($_POST['aksrt_allow_view']) ? sanitize_key((string) wp_unslash($_POST['aksrt_allow_view'])) : 'public'; update_post_meta($post_id, '_aksrt_allow_view', $allow_view); update_post_meta($post_id, '_aksrt_pay_price', isset($_POST['aksrt_pay_price']) ? max(0, (float) wp_unslash($_POST['aksrt_pay_price'])) : 0); update_post_meta($post_id, '_aksrt_pay_credits', isset($_POST['aksrt_pay_credits']) ? max(0, (int) wp_unslash($_POST['aksrt_pay_credits'])) : 0); // Keep board taxonomy bridge roughly in sync when plate selected. if ($plate_id > 0 && taxonomy_exists('aksrt_forum_board')) { $slug = 'plate-' . $plate_id; $term = get_term_by('slug', $slug, 'aksrt_forum_board'); if (!$term) { $title = get_the_title($plate_id) ?: $slug; $created = wp_insert_term($title, 'aksrt_forum_board', ['slug' => $slug]); if (!is_wp_error($created) && !empty($created['term_id'])) { $term_id = (int) $created['term_id']; } else { $term_id = 0; } } else { $term_id = (int) $term->term_id; } if ($term_id > 0) { wp_set_object_terms($post_id, [$term_id], 'aksrt_forum_board', false); } } } }