?>
">

	<fieldset>
		<legend><?php 
_e('Edit Forum', 'message-board');
?>
</legend>

		<p>
			<label for="mb_forum_title"><?php 
_e('Forum Title:', 'message-board');
?>
</label>
			<input type="text" id="mb_forum_title" name="mb_forum_title" value="<?php 
echo esc_attr(mb_get_forum_title());
?>
" />
		</p>

		<p>
			<label for="mb_post_parent"><?php 
_e('Parent Forum:', 'message-board');
?>
</label>
			<?php 
mb_dropdown_forums(array('name' => 'mb_post_parent', 'id' => 'mb_post_parent', 'show_option_none' => __('(no parent)', 'message-board'), 'option_none_value' => 0, 'selected' => mb_get_forum_parent_id()));
?>
		</p>

		<p>
 /**
  * Displays admin notices for the edit forum screen.
  *
  * @since  1.0.0
  * @access public
  * @return void
  */
 public function admin_notices()
 {
     $allowed_notices = array(mb_get_open_post_status(), mb_get_close_post_status(), mb_get_archive_post_status());
     /* If we have an allowed notice. */
     if (isset($_GET['mb_forum_notice']) && in_array($_GET['mb_forum_notice'], $allowed_notices) && isset($_GET['forum_id'])) {
         $notice = $_GET['mb_forum_notice'];
         $forum_id = mb_get_forum_id(absint($_GET['forum_id']));
         if (mb_get_close_post_status() === $notice) {
             $text = sprintf(__('The forum "%s" was successfully closed.', 'message-board'), mb_get_forum_title($forum_id));
         } elseif (mb_get_open_post_status() === $notice) {
             $text = sprintf(__('The forum "%s" was successfully opened.', 'message-board'), mb_get_forum_title($forum_id));
         } elseif (mb_get_archive_post_status() === $notice) {
             $text = sprintf(__('The forum "%s" was successfully archived.', 'message-board'), mb_get_forum_title($forum_id));
         }
         if (!empty($text)) {
             printf('<div class="updated"><p>%s</p></div>', $text);
         }
     }
 }
示例#3
0
function mb_get_edit_page_title()
{
    $title = '';
    if (mb_is_forum_edit()) {
        $title = sprintf(mb_get_forum_label('mb_form_edit_item'), mb_get_forum_title());
    } elseif (mb_is_topic_edit()) {
        $title = sprintf(mb_get_topic_label('mb_form_edit_item'), mb_get_topic_title());
    } elseif (mb_is_reply_edit()) {
        $title = sprintf(mb_get_reply_label('mb_form_edit_item'), mb_get_reply_title());
    } elseif (mb_is_user_edit()) {
        $title = __('Edit User', 'message-board');
    }
    return apply_filters('mb_get_edit_title', $title);
}
 /**
  * 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)
 {
     /* Post status column. */
     if ('status' === $column) {
         $post_type = mb_get_topic_post_type();
         $status = get_post_status_object(mb_get_topic_status($post_id));
         if (mb_get_publish_post_status() === $status->name) {
             wp_update_post(array('ID' => $post_id, 'post_status' => mb_get_open_post_status()));
         }
         $url = add_query_arg(array('post_status' => $status->name, 'post_type' => $post_type), admin_url('edit.php'));
         printf('<a href="%s">%s</a>', $url, $status->label);
         /* Topic forum column. */
     } elseif ('forum' === $column) {
         $post_type = mb_get_topic_post_type();
         $forum_id = mb_get_topic_forum_id($post_id);
         $url = add_query_arg(array('post_type' => $post_type, 'post_parent' => $forum_id), admin_url('edit.php'));
         printf('<a href="%s">%s</a>', $url, mb_get_forum_title($forum_id));
         /* Replies column. */
     } elseif ('replies' === $column) {
         $reply_count = mb_get_topic_reply_count($post_id);
         $reply_count = !empty($reply_count) ? absint($reply_count) : number_format_i18n(0);
         if (0 < $reply_count && current_user_can('edit_replies')) {
             printf('<a href="%s">%s</a>', add_query_arg(array('post_type' => mb_get_reply_post_type(), 'post_parent' => $post_id), admin_url('edit.php')), $reply_count);
         } else {
             echo $reply_count;
         }
         /* Voices column. */
     } elseif ('voices' === $column) {
         $voice_count = mb_get_topic_voice_count($post_id);
         echo !empty($voice_count) ? absint($voice_count) : number_format_i18n(0);
         /* Datetime column. */
     } elseif ('datetime' === $column) {
         the_time(get_option('date_format'));
         echo '<br />';
         the_time(get_option('time_format'));
     }
 }
 /**
  * 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'));
     }
 }
示例#6
0
/**
 * Returns the forum link.
 *
 * @since  1.0.0
 * @access public
 * @param  int     $forum_id
 * @return string
 */
function mb_get_forum_link($forum_id = 0)
{
    $forum_id = mb_get_forum_id($forum_id);
    $forum_title = mb_get_forum_title($forum_id);
    $forum_url = mb_get_forum_url($forum_id);
    $forum_link = $forum_url ? '<a class="mb-forum-link" href="%s">%s</a>' : '<span class="mb-forum-link">%2$s</span>';
    return apply_filters('mb_get_forum_link', sprintf($forum_link, $forum_url, $forum_title), $forum_id);
}