function bbps_add_support_forum_features() { //only display all this stuff if the support forum option has been selected. if (bbps_is_support_forum(bbp_get_forum_id())) { $can_edit = bbps_get_update_capabilities(); if ($can_edit) { $topic_id = bbp_get_topic_id(); $status = bbps_get_topic_status($topic_id); $forum_id = bbp_get_forum_id(); $user_id = get_current_user_id(); ?> <div class="row"> <div class="col-md-6"> <div id="bbps_support_forum_options" class="well"> <?php //get out the option to tell us who is allowed to view and update the drop down list. if ($can_edit == true) { ?> <?php bbps_generate_status_options($topic_id, $status); } else { ?> This topic is: <?php echo $status; } ?> </div> <?php //has the user enabled the move topic feature? if (get_option('_bbps_enable_topic_move') == 1 && (current_user_can('administrator') || current_user_can('bbp_moderator'))) { ?> <div id="bbps_support_forum_move" class="span6 well"> <form id="bbps-topic-move" name="bbps_support_topic_move" action="" method="post"> <label for="bbp_forum_id">Move topic to: </label><?php bbp_dropdown(); ?> <input type="submit" value="Move" name="bbps_topic_move_submit" /> <input type="hidden" value="bbps_move_topic" name="bbps_action"/> <input type="hidden" value="<?php echo $topic_id; ?> " name="bbps_topic_id" /> <input type="hidden" value="<?php echo $forum_id; ?> " name="bbp_old_forum_id" /> </form> </div> <?php } ?> </div> </div> <!-- row --><?php } } }
<?php do_action('bbp_theme_after_forum_visibility_status'); ?> <?php do_action('bbp_theme_before_forum_form_parent'); ?> <p> <label for="bbp_forum_parent_id"><?php _e('Parent Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('select_id' => 'bbp_forum_parent_id', 'show_none' => __('(No Parent)', 'bbpress'), 'selected' => bbp_get_form_forum_parent(), 'exclude' => bbp_get_forum_id())); ?> </p> <?php do_action('bbp_theme_after_forum_form_parent'); ?> <?php do_action('bbp_theme_before_forum_form_submit_wrapper'); ?> <div class="bbp-submit-wrapper"> <?php do_action('bbp_theme_before_forum_form_submit_button');
<?php if (!bbp_is_single_forum()) { ?> <?php do_action('bbp_theme_before_topic_form_forum'); ?> <p> <label for="bbp_forum_id"><?php esc_html_e('Forum:', 'monsoon'); ?> </label><br /> <?php bbp_dropdown(array('show_none' => esc_html__('(No Forum)', 'monsoon'), 'selected' => bbp_get_form_topic_forum())); ?> </p> <?php do_action('bbp_theme_after_topic_form_forum'); ?> <?php } ?> <?php if (current_user_can('moderate')) { ?>
/** * Reply metabox * * The metabox that holds all of the additional reply information * * @since 2.0.0 bbPress (r2464) * * @uses bbp_get_topic_post_type() To get the topic post type * @uses do_action() Calls 'bbp_reply_metabox' */ function bbp_reply_metabox() { // Post ID $post_id = get_the_ID(); $status = get_post_status($post_id); // Get some meta $reply_topic_id = bbp_get_reply_topic_id($post_id); $reply_forum_id = bbp_get_reply_forum_id($post_id); $topic_forum_id = bbp_get_topic_forum_id($reply_topic_id); /** Status ****************************************************************/ ?> <p> <strong class="label"><?php esc_html_e('Status:', 'bbpress'); ?> </strong> <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr('auto-draft' === $status ? 'draft' : $status); ?> " /> <label class="screen-reader-text" for="post_status"><?php esc_html_e('Select what status to give the reply.', 'bbpress'); ?> </label> <?php bbp_form_reply_status_dropdown(array('select_id' => 'post_status', 'reply_id' => $post_id)); ?> </p> <hr /> <?php /** Forum *****************************************************************/ // Only allow individual manipulation of reply forum if there is a mismatch if ($reply_forum_id !== $topic_forum_id && (current_user_can('edit_others_replies') || current_user_can('moderate'))) { ?> <p> <strong class="label"><?php esc_html_e('Forum:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="bbp_forum_id"><?php esc_html_e('Forum', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_forum_post_type(), 'selected' => $reply_forum_id, 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC', 'walker' => '', 'exclude' => '', 'select_id' => 'bbp_forum_id', 'options_only' => false, 'show_none' => __('— No reply —', 'bbpress'), 'disable_categories' => current_user_can('edit_forums'), 'disabled' => '')); ?> </p> <?php } /** Topic *****************************************************************/ ?> <p> <strong class="label"><?php esc_html_e('Topic:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="parent_id"><?php esc_html_e('Topic', 'bbpress'); ?> </label> <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr($reply_topic_id); ?> " data-ajax-url="<?php echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'bbp_suggest_topic'), admin_url('admin-ajax.php', 'relative')), 'bbp_suggest_topic_nonce')); ?> " /> </p> <?php /** Reply To **************************************************************/ ?> <p> <strong class="label"><?php esc_html_e('Reply To:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="bbp_reply_to"><?php esc_html_e('Reply To', 'bbpress'); ?> </label> <?php bbp_reply_to_dropdown($post_id); ?> </p> <input name="ping_status" type="hidden" id="ping_status" value="open" /> <?php wp_nonce_field('bbp_reply_metabox_save', 'bbp_reply_metabox'); do_action('bbp_reply_metabox', $post_id); }
<?php if (!bbp_is_single_forum()) { ?> <?php do_action('bbp_theme_before_topic_form_forum'); ?> <p> <label for="bbp_forum_id"><?php _e('Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('show_none' => __('(No Forum)', 'bbpress'), 'selected' => bbp_get_form_topic_forum())); ?> </p> <?php do_action('bbp_theme_after_topic_form_forum'); ?> <?php } ?> <?php if (current_user_can('moderate')) { ?>
<?php do_action('bbp_theme_after_forum_visibility_status'); ?> <?php do_action('bbp_theme_before_forum_form_parent'); ?> <p> <label for="bbp_forum_parent_id"><?php esc_html_e('Parent Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('select_id' => 'bbp_forum_parent_id', 'show_none' => esc_html__('— No parent —', 'bbpress'), 'selected' => bbp_get_form_forum_parent(), 'exclude' => bbp_get_forum_id())); ?> </p> <?php do_action('bbp_theme_after_forum_form_parent'); ?> <?php do_action('bbp_theme_before_forum_form_submit_wrapper'); ?> <div class="bbp-submit-wrapper"> <?php do_action('bbp_theme_before_forum_form_submit_button');
/** * Reply metabox * * The metabox that holds all of the additional reply information * * @since bbPress (r2464) * * @uses bbp_get_topic_post_type() To get the topic post type * @uses bbp_dropdown() To show a dropdown of the topics for reply parent * @uses do_action() Calls 'bbp_reply_metabox' */ function bbp_reply_metabox() { // Post ID $post_id = get_the_ID(); // Get some meta $reply_topic_id = bbp_get_reply_topic_id($post_id); $reply_forum_id = bbp_get_reply_forum_id($post_id); // Allow individual manipulation of reply forum if (current_user_can('edit_others_replies') || current_user_can('moderate')) { // Forums $args = array('selected' => $reply_forum_id, 'select_id' => 'bbp_forum_id', 'show_none' => __('(Use Forum of Topic)', 'bbpress')); ?> <p><strong><?php _e('Forum', 'bbpress'); ?> </strong></p> <p> <label class="screen-reader-text" for="bbp_forum_id"><?php _e('Forum', 'bbpress'); ?> </label> <?php bbp_dropdown($args); ?> </p> <?php } // Topics $args = array('post_type' => bbp_get_topic_post_type(), 'selected' => $reply_topic_id, 'select_id' => 'parent_id', 'orderby' => 'post_date', 'numberposts' => '250', 'show_none' => is_super_admin() ? __('(No Topic)', 'bbpress') : ''); // Allow the dropdown to be filtered, to extend or limit the available // topics to choose as the reply parent. $args = apply_filters('bbp_reply_parent_dropdown', $args); ?> <p><strong><?php _e('Topic', 'bbpress'); ?> </strong></p> <p> <label class="screen-reader-text" for="parent_id"><?php _e('Topic', 'bbpress'); ?> </label> <?php bbp_dropdown($args); ?> </p> <?php wp_nonce_field('bbp_reply_metabox_save', 'bbp_reply_metabox'); do_action('bbp_reply_metabox', $post_id); }
/** * Add forum dropdown to topic and reply list table filters * * @since 2.0.0 bbPress (r2991) * * @uses bbp_get_reply_post_type() To get the reply post type * @uses bbp_get_topic_post_type() To get the topic post type * @uses bbp_dropdown() To generate a forum dropdown * @return bool False. If post type is not topic or reply */ public function filter_dropdown() { if ($this->bail()) { return; } // Add Empty Spam button if (!empty($_GET['post_status']) && bbp_get_spam_status_id() === $_GET['post_status'] && current_user_can('moderate')) { wp_nonce_field('bulk-destroy', '_destroy_nonce'); $title = esc_attr__('Empty Spam', 'bbpress'); submit_button($title, 'button-secondary apply', 'delete_all', false); } // Get which forum is selected $selected = !empty($_GET['bbp_forum_id']) ? $_GET['bbp_forum_id'] : ''; // Show the forums dropdown bbp_dropdown(array('selected' => $selected, 'show_none' => __('In all forums', 'bbpress'))); }
<legend><?php esc_html_e('Destination', 'bbpress'); ?> </legend> <div> <?php if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'post__not_in' => array(bbp_get_topic_id())))) { ?> <label for="bbp_destination_topic"><?php esc_html_e('Merge with this topic:', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()), 'selected' => -1, 'exclude' => bbp_get_topic_id(), 'select_id' => 'bbp_destination_topic')); ?> <?php } else { ?> <label><?php esc_html_e('There are no other topics in this forum to merge with.', 'bbpress'); ?> </label> <?php } ?>
/** * Replies per page setting field * * @since 2.1.0 bbPress (r3575) * * @uses bbp_form_option() To output the option value */ function bbp_admin_setting_callback_group_forums_root_id() { // Output the dropdown for all forums bbp_dropdown(array('selected' => bbp_get_group_forums_root_id(), 'show_none' => __('— Forum root —', 'bbpress'), 'orderby' => 'title', 'order' => 'ASC', 'select_id' => '_bbp_group_forums_root_id', 'disable_categories' => false, 'disabled' => '_bbp_group_forums_root_id')); ?> <?php esc_html_e('is the parent for all group forums', 'bbpress'); ?> <p class="description"><?php esc_html_e('Using the Forum Root is not recommended. Changing this does not move existing forums.', 'bbpress'); ?> </p> <?php }
/** * Replies per page setting field * * @since bbPress (r3575) * * @uses bbp_form_option() To output the option value */ function bbp_admin_setting_callback_group_forums_root_id() { ?> <?php bbp_dropdown(array('selected' => bbp_get_group_forums_root_id(), 'show_none' => __('(Forum Root)', 'bbpress'), 'select_id' => '_bbp_group_forums_root_id', 'disable_categories' => false)); ?> <label for="_bbp_group_forums_root_id"><?php _e('is the parent for all group forums', 'bbpress'); ?> </label> <p class="description"><?php _e('Using the Forum Root is not recommended. Changing this does not move existing forums.', 'bbpress'); ?> </p> <?php }
<?php do_action('bbp_theme_after_forum_visibility_status'); ?> <?php do_action('bbp_theme_before_forum_form_parent'); ?> <p> <label for="bbp_forum_parent_id"><?php esc_html_e('Parent Forum:', 'monsoon'); ?> </label><br /> <?php bbp_dropdown(array('select_id' => 'bbp_forum_parent_id', 'show_none' => esc_html__('(No Parent)', 'monsoon'), 'selected' => bbp_get_form_forum_parent(), 'exclude' => bbp_get_forum_id())); ?> </p> <?php do_action('bbp_theme_after_forum_form_parent'); ?> <?php do_action('bbp_theme_before_forum_form_submit_wrapper'); ?> <div class="bbp-submit-wrapper"> <?php do_action('bbp_theme_before_forum_form_submit_button');
</div> </fieldset> <?php // Topics options ?> <fieldset id="adv-search-topics" class="adv-search-fields <?php if ($context == 'topics') { echo 'active'; } ?> "> <div class="form-left"> <label for="inforum"><i class="fa fa-list fa-fw"></i>In Forum: </label> <?php bbp_dropdown($args = array('post_type' => 'forum', 'show_none' => 'Any Forum', 'selected' => isset($search->forum) ? $search->forum : NULL, 'select_id' => 'inforum')); ?> </div> </fieldset> <?php // Members and Groups options ?> <fieldset id="adv-search-members" class="adv-search-fields <?php if ($context == 'members' || $context == 'groups') { echo 'active'; } ?> "> <div class="form-left"> <label for="faction"><i class="fa fa-flag fa-fw"></i>In Alliance: </label>
<?php if (!bbp_is_single_forum()) { ?> <?php do_action('bbp_theme_before_topic_form_forum'); ?> <p> <label for="bbp_forum_id"><?php _e('Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('selected' => bbp_get_form_topic_forum())); ?> </p> <?php do_action('bbp_theme_after_topic_form_forum'); ?> <?php } ?> <?php if (current_user_can('moderate')) { ?>
/** * Reply metabox * * The metabox that holds all of the additional reply information * * @since bbPress (r2464) * * @uses bbp_get_topic_post_type() To get the topic post type * @uses do_action() Calls 'bbp_reply_metabox' */ function bbp_reply_metabox() { // Post ID $post_id = get_the_ID(); // Get some meta $reply_topic_id = bbp_get_reply_topic_id($post_id); $reply_forum_id = bbp_get_reply_forum_id($post_id); $reply_to = bbp_get_reply_to($post_id); // Allow individual manipulation of reply forum if (current_user_can('edit_others_replies') || current_user_can('moderate')) { ?> <p> <strong class="label"><?php esc_html_e('Forum:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="bbp_forum_id"><?php esc_html_e('Forum', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_forum_post_type(), 'selected' => $reply_forum_id, 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC', 'walker' => '', 'exclude' => '', 'select_id' => 'bbp_forum_id', 'tab' => bbp_get_tab_index(), 'options_only' => false, 'show_none' => __('— No parent —', 'bbpress'), 'disable_categories' => current_user_can('edit_forums'), 'disabled' => '')); ?> </p> <?php } ?> <p> <strong class="label"><?php esc_html_e('Topic:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="parent_id"><?php esc_html_e('Topic', 'bbpress'); ?> </label> <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr($reply_topic_id); ?> " /> </p> <p> <strong class="label"><?php esc_html_e('Reply To:', 'bbpress'); ?> </strong> <label class="screen-reader-text" for="bbp_reply_to"><?php esc_html_e('Reply To', 'bbpress'); ?> </label> <input name="bbp_reply_to" id="bbp_reply_to" type="text" value="<?php echo esc_attr($reply_to); ?> " /> </p> <input name="ping_status" type="hidden" id="ping_status" value="open" /> <?php wp_nonce_field('bbp_reply_metabox_save', 'bbp_reply_metabox'); do_action('bbp_reply_metabox', $post_id); }
<?php if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'post__not_in' => array(bbp_get_topic_id())))) { ?> <div> <input name="bbp_topic_split_option" id="bbp_topic_split_option_existing" type="radio" value="existing" tabindex="<?php bbp_tab_index(); ?> " /> <label for="bbp_topic_split_option_existing"><?php _e('Use an existing topic in this forum:', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'selected' => -1, 'exclude' => bbp_get_topic_id(), 'select_id' => 'bbp_destination_topic', 'none_found' => __('No other topics found!', 'bbpress'))); ?> </div> <?php } ?> </fieldset> <fieldset class="bbp-form"> <legend><?php _e('Topic Extras', 'bbpress'); ?> </legend>
public function topic_parent() { $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id()); ?> <p> <label for="bbp_forum_id"><?php esc_html_e('Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('include' => $forum_ids, 'selected' => bbp_get_form_topic_forum())); ?> </p> <?php }
?> </p> </div> <h4><?php _e('Destination', 'bbpress'); ?> </h4> <?php if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'post__not_in' => array(bbp_get_topic_id())))) { ?> <label for="bbp_destination_topic"><?php _e('Merge with this topic:', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'selected' => -1, 'exclude' => bbp_get_topic_id(), 'select_id' => 'bbp_destination_topic', 'none_found' => __('No topics were found to which the topic could be merged to!', 'bbpress'))); ?> <?php } else { ?> <p class="alert alert-danger"><?php _e('There are no other topics in this forum to merge with.', 'bbpress'); ?> </p> <?php } ?> <h4><?php _e('Topic Extras', 'bbpress'); ?>
<?php if (!bbp_is_single_forum()) { ?> <?php do_action('bbp_theme_before_topic_form_forum'); ?> <p> <label for="bbp_forum_id"><?php esc_html_e('Forum:', 'bbpress'); ?> </label><br /> <?php bbp_dropdown(array('show_none' => esc_html__('— No forum —', 'bbpress'), 'selected' => bbp_get_form_topic_forum())); ?> </p> <?php do_action('bbp_theme_after_topic_form_forum'); ?> <?php } ?> <?php if (current_user_can('moderate')) { ?>
<?php if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_reply_forum_id(bbp_get_reply_id()), 'post__not_in' => array(bbp_get_reply_topic_id(bbp_get_reply_id()))))) { ?> <div> <input name="bbp_reply_move_option" id="bbp_reply_move_option_existing" type="radio" value="existing" tabindex="<?php bbp_tab_index(); ?> " /> <label for="bbp_reply_move_option_existing"><?php _e('Use an existing topic in this forum:', 'bbpress'); ?> </label> <?php bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_reply_forum_id(bbp_get_reply_id()), 'selected' => -1, 'exclude' => bbp_get_reply_topic_id(bbp_get_reply_id()), 'select_id' => 'bbp_destination_topic')); ?> </div> <?php } ?> </fieldset> <div class="bbp-template-notice error"> <p><?php _e('<strong>WARNING:</strong> This process cannot be undone.', 'bbpress'); ?> </p>
/** * Add the bbPress topic option to the Discussion meta box */ function display_topic_option($post) { /** Store the post being edited and restore it after looping over forums */ global $post; $the_post = $post; if (!function_exists('bbp_has_forums')) { ?> <br /><p><?php _e('bbPress Topics for Posts has been enabled, but cannot detect your bbPress setup.', 'bbpress-post-topics'); ?> </p><?php return; } $bbpress_topic_options = $this->get_topic_options_for_post($post->ID); $bbpress_topic_status = $bbpress_topic_options['enabled'] != false; $bbpress_topic_display = $bbpress_topic_options['display']; $bbpress_topic_slug = $bbpress_topic_options['topic_id']; if ($bbpress_topic_slug) { $bbpress_topic = bbp_get_topic($bbpress_topic_slug); $bbpress_topic_slug = $bbpress_topic->post_name; /** If a topic already exists, don't select default forum */ $bbpress_topic_options['forum_id'] = 0; } $forums = bbp_has_forums(); if (!$forums) { ?> <br /><p><?php _e('bbPress Topics for Posts has been enabled, but you have not created any forums yet.', 'bbpress-post-topics'); ?> </p><?php return; } ?> <br /> <input type="hidden" name="bbpress_topic[form_displayed]" value="true" /> <label for="bbpress_topic_status" class="selectit"><input name="bbpress_topic[enabled]" type="checkbox" id="bbpress_topic_status" value="open" <?php checked($bbpress_topic_status); ?> /> <?php _e('Use a bbPress forum topic for comments on this post.', 'bbpress-post-topics'); ?> </label><br /> <div id="bbpress_topic_status_options" class="inside" style="display: <?php echo checked($bbpress_topic_status, true, false) ? 'block' : 'none'; ?> ;"> <h4>bbPress Topic Options</h4> <label for="bbpress_topic_slug"><?php _e('Use an existing topic:', 'bbpress-post-topics'); ?> </label> <input type="text" name="bbpress_topic[slug]" id="bbpress_topic_slug" placeholder="<?php _e('Topic ID or slug', 'bbpress-post-topics'); ?> " value="<?php echo $bbpress_topic_slug; ?> " <?php if ($bbpress_topic_options['forum_id']) { echo ' disabled="true"'; } ?> /> - OR - <label for="bbpress_topic_forum"><?php _e('Create a new topic in forum:', 'bbpress-post-topics'); ?> </label> <select name="bbpress_topic[forum_id]" id="bbpress_topic_forum"> <option value="0" selected><?php _e('Select a Forum', 'bbpress-post-topics'); ?> </option> <?php $forum_dropdown_options = array('selected' => $bbpress_topic_options['forum_id'], 'options_only' => true); bbp_dropdown($forum_dropdown_options); ?> </select><br /> — <input type="checkbox" name="bbpress_topic[copy_tags]" id="bbpress_topic_copy_tags" <?php checked($bbpress_topic_options['copy_tags'], 'on'); ?> /> <label for="bbpress_topic_copy_tags"><?php _e('Copy post tags to new topic', 'bbpress-post-topics'); ?> </label> <?php if ($import_date = get_post_meta($post->ID, 'bbpress_discussion_tags_copied', true)) { printf('( ' . __('last copied %s ago', 'bbpress-post-topics') . ' )', human_time_diff($import_date)); } ?> <br /> <?php if (wp_count_comments($post->ID)->total_comments > 0) { ?> — <input type="checkbox" name="bbpress_topic[copy_comments]" id="bbpress_topic_copy_comments" <?php checked($bbpress_topic_options['copy_comments'], 'on'); ?> /> <label for="bbpress_topic_copy_comments"><?php _e('Copy comments to bbPress topic', 'bbpress-post-topics'); ?> </label> <?php if ($import_date = get_post_meta($post->ID, 'bbpress_discussion_comments_copied', true)) { printf('( ' . __('last copied %s ago', 'bbpress-post-topics') . ' )', human_time_diff($import_date)); } ?> <br /> <?php } ?> — <input type="checkbox" name="bbpress_topic[use_defaults]" id="bbpress_topic_use_defaults" <?php checked($bbpress_topic_options['use_defaults']); ?> /> <label for="bbpress_topic_use_defaults"><?php _e('Use default display settings', 'bbpress-post-topics'); ?> </label> <div id="bbpress_topic_display_options" style="display: <?php echo checked($bbpress_topic_options['use_defaults'], true, false) ? 'none' : 'block'; ?> ; border-left: 1px solid #ccc; margin-left: 9px; padding-left: 5px;"> <label for=""><?php _e('On the post page, show:', 'bbpress-post-topics'); ?> </label><br /> <?php $xreplies_sort_options = array('newest' => __('most recent', 'bbpress-post-topics'), 'oldest' => __('oldest', 'bbpress-post-topics')); $xreplies_count = isset($bbpress_topic_options['display-extras']['xcount']) ? $bbpress_topic_options['display-extras']['xcount'] : 5; $xreplies_count_string = '<input type="text" name="bbpress_topic[display-extras][xcount]" value="' . $xreplies_count . '" class="small-text" maxlength="3" />'; $xsort_select_string = '<select name="bbpress_topic[display-extras][xsort]" id="bbpress_topic_display_sort">'; foreach ($xreplies_sort_options as $option => $label) { $xsort_select_string .= '<option value="' . $option . '" ' . selected($bbpress_topic_options['display-extras']['xsort'], $option, false) . '>' . $label . '</option>'; } $xsort_select_string .= '</select>'; /** Build list of display formats, including custom ones */ $display_formats = array('topic' => __('Entire topic', 'bbpress-post-topics'), 'replies' => __('Replies only', 'bbpress-post-topics'), 'xreplies' => sprintf(__('Only the %s %s %s replies', 'bbpress-post-topics'), '</label>', $xreplies_count_string, $xsort_select_string), 'link' => __('A link to the topic', 'bbpress-post-topics')); $display_formats = apply_filters('bbppt_display_format_options', $display_formats, $the_post->ID); ?> <fieldset> <?php foreach ($display_formats as $format_code => $format_label) { ?> <input type="radio" name="bbpress_topic[display]" id="bbpress_topic_display_<?php echo $format_code; ?> " value="<?php echo $format_code; ?> " <?php checked($bbpress_topic_options['display'], $format_code); ?> /><label for="bbpress_topic_display_<?php echo $format_code; ?> "><?php echo $format_label; ?> </label><br /> <?php } ?> </fieldset> </div> </div> <script type="text/javascript"> /** hide topic options when not checked */ jQuery('#bbpress_topic_status').change(function() { if(jQuery(this).attr('checked')) { jQuery('#bbpress_topic_status_options').show(); } else { jQuery('#bbpress_topic_status_options').hide(); } }); /** hide display options when defaults are selected */ jQuery('#bbpress_topic_use_defaults').change(function() { if(jQuery(this).attr('checked')) { jQuery('#bbpress_topic_display_options').hide(); } else { jQuery('#bbpress_topic_display_options').show(); } }); /** disable topic slug field when a forum is selected to prevent confusion */ jQuery('#bbpress_topic_forum').change(function() { if(jQuery(this).val() != 0) { jQuery('#bbpress_topic_slug').attr('disabled','true'); } else { jQuery('#bbpress_topic_slug').removeAttr('disabled'); } }); </script> <?php do_action('bbppt_display_options_fields', $the_post->ID); /** Restore the original post being edited */ $post = $the_post; }