/** * Handles the output for custom columns. * * @since 1.0.0 * @access public * @param string $column * @param int $post_id */ public function manage_columns($column, $post_id) { /* Forum column. */ if ('forum' === $column) { $forum_id = mb_get_reply_forum_id($post_id); if (0 === $forum_id || mb_is_reply_orphan($post_id)) { echo '—'; } else { $post_type = get_post_type($post_id); $url = add_query_arg(array('post_type' => $post_type, 'mb_forum' => $forum_id), admin_url('edit.php')); printf('<a href="%s">%s</a>', $url, mb_get_forum_title($forum_id)); } /* Topic column. */ } elseif ('topic' === $column) { $topic_id = mb_get_reply_topic_id($post_id); if (0 === $topic_id || mb_is_reply_orphan($post_id)) { echo '—'; } else { $post_type = get_post_type($post_id); $url = add_query_arg(array('post_type' => $post_type, 'post_parent' => $topic_id), admin_url('edit.php')); printf('<a href="%s">%s</a>', $url, mb_get_topic_title($topic_id)); } /* Datetime column. */ } elseif ('datetime' === $column) { the_time(get_option('date_format')); echo '<br />'; the_time(get_option('time_format')); } }
/** * Displays the reply's forum ID. * * @since 1.0.0 * @access public * @param int $reply_id * @return void */ function mb_reply_forum_id($reply_id = 0) { echo mb_get_reply_forum_id($reply_id); }
/** * Reply info meta box. Displays relevant information about the reply. This box doesn't have editable * content in it. * * @since 1.0.0 * @access public * @param object $post * @return void */ function mb_reply_info_meta_box($post) { $reply_id = mb_get_reply_id($post->ID); $topic_id = mb_get_reply_topic_id($reply_id); $forum_id = mb_get_reply_forum_id($reply_id); $topic_object = get_post_type_object(mb_get_topic_post_type()); $forum_object = get_post_type_object(mb_get_forum_post_type()); ?> <p><?php printf(__('Topic: %s', 'message-board'), mb_get_topic_link($topic_id)); ?> </p> <p><?php printf(__('Forum: %s', 'message-board'), mb_get_forum_link($forum_id)); ?> </p> <?php }