echo format_to_edit(mb_code_trick_reverse(mb_get_reply_content(mb_get_reply_id(), 'raw')));
?>
</textarea>
		</p>

		<p>
			<input type="submit" value="<?php 
esc_attr_e('Submit', 'message-board');
?>
" />
		</p>

		<p>
			<label>
				<input type="checkbox" name="mb_topic_subscribe" value="<?php 
echo mb_is_user_subscribed_topic(mb_get_reply_author_id(), mb_get_reply_topic_id()) ? 1 : 0;
?>
" /> 
				<?php 
_e('Notify me of follow-up posts via email', 'message-board');
?>
			</label>
		</p>

		<input type="hidden" name="mb_reply_id" value="<?php 
mb_reply_id();
?>
" />

		<?php 
wp_nonce_field('mb_edit_reply_action', 'mb_edit_reply_nonce', false);
Esempio n. 2
0
/**
 * Generates the reply URL based on its position (`menu_order` field).
 *
 * @since  1.0.0
 * @access public
 * @param  int     $reply_id
 * @return string
 */
function mb_generate_reply_url($reply_id = 0)
{
    $reply_id = mb_get_reply_id($reply_id);
    /* If reply is not published, return empty string. */
    if (mb_get_publish_post_status() !== mb_get_reply_status($reply_id)) {
        return '';
    }
    $topic_id = mb_get_reply_topic_id($reply_id);
    /* If no topic ID, return empty string. */
    if (0 >= $topic_id) {
        return '';
    }
    /* Set up our variables. */
    $topic_url = get_permalink($topic_id);
    $per_page = mb_get_replies_per_page();
    $reply_position = mb_get_reply_position($reply_id);
    $reply_hash = "#post-{$reply_id}";
    $reply_page = ceil($reply_position / $per_page);
    /* If viewing page 1, just add the reply hash. */
    if (1 >= $reply_page) {
        $reply_url = user_trailingslashit($topic_url) . $reply_hash;
    } else {
        global $wp_rewrite;
        if ($wp_rewrite->using_permalinks()) {
            $reply_url = trailingslashit($topic_url) . trailingslashit($wp_rewrite->pagination_base) . user_trailingslashit($reply_page) . $reply_hash;
        } else {
            $reply_url = add_query_arg('paged', $reply_page, $topic_url) . $reply_hash;
        }
    }
    return $reply_url;
}
Esempio n. 3
0
 /**
  * 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 '&mdash;';
         } 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 '&mdash;';
         } 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'));
     }
 }
Esempio n. 4
0
/**
 * Displays the reply's topic ID.
 *
 * @since  1.0.0
 * @access public
 * @param  int     $reply_id
 * @return void
 */
function mb_reply_topic_id($reply_id = 0)
{
    echo mb_get_reply_topic_id($reply_id);
}
Esempio n. 5
0
/**
 * 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 
}