while (bbp_replies()) { bbp_the_reply(); ?> <tr class="bbp-reply-header"> <td colspan="2"> <?php printf(__('%1$s at %2$s', 'bbpress'), get_the_date(), esc_attr(get_the_time())); ?> <a href="<?php bbp_reply_url(); ?> " title="<?php bbp_reply_title(); ?> " class="bbp-reply-permalink">#<?php bbp_reply_id(); ?> </a> <?php bbp_reply_admin_links(); ?> </td> </tr> <tr id="post-<?php bbp_reply_id();
/** * Output the forums for a group in the edit screens * * As of right now, bbPress only supports 1-to-1 group forum relationships. * In the future, many-to-many should be allowed. * * @since bbPress (r3653) * @uses bp_get_current_group_id() * @uses bbp_get_group_forum_ids() * @uses bbp_has_forums() * @uses bbp_get_template_part() */ public function display_forums($offset = 0) { global $wp_query; // Allow actions immediately before group forum output do_action('bbp_before_group_forum_display'); // Load up bbPress once $bbp = bbpress(); /** Query Resets ******************************************************/ // Forum data $forum_action = bp_action_variable($offset); $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id()); $forum_id = array_shift($forum_ids); // Always load up the group forum bbp_has_forums(array('p' => $forum_id, 'post_parent' => null)); // Set the global forum ID $bbp->current_forum_id = $forum_id; // Assume forum query bbp_set_query_name('bbp_single_forum'); ?> <div id="bbpress-forums"> <?php switch ($forum_action) { /** Single Forum **********************************************/ case false: case 'page': // Strip the super stickies from topic query add_filter('bbp_get_super_stickies', array($this, 'no_super_stickies'), 10, 1); // Unset the super sticky option on topic form add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1); // Query forums and show them if they exist if (bbp_forums()) { // Setup the forum bbp_the_forum(); ?> <h3><?php bbp_forum_title(); ?> </h3> <?php bbp_get_template_part('content', 'single-forum'); // No forums found } else { ?> <div id="message" class="info"> <p><?php esc_html_e('This group does not currently have a forum.', 'bbpress'); ?> </p> </div> <?php } break; /** Single Topic **********************************************/ /** Single Topic **********************************************/ case $this->topic_slug: // hide the 'to front' admin links add_filter('bbp_get_topic_stick_link', array($this, 'hide_super_sticky_admin_link'), 10, 2); // Get the topic bbp_has_topics(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1, 'show_stickies' => false)); // If no topic, 404 if (!bbp_topics()) { bp_do_404(bbp_get_forum_permalink($forum_id)); ?> <h3><?php bbp_forum_title(); ?> </h3> <?php bbp_get_template_part('feedback', 'no-topics'); return; } // Setup the topic bbp_the_topic(); ?> <h3><?php bbp_topic_title(); ?> </h3> <?php // Topic edit if (bp_action_variable($offset + 2) === bbp_get_edit_rewrite_id()) { // Unset the super sticky link on edit topic template add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1); // Set the edit switches $wp_query->bbp_is_edit = true; $wp_query->bbp_is_topic_edit = true; // Setup the global forum ID $bbp->current_topic_id = get_the_ID(); // Merge if (!empty($_GET['action']) && 'merge' === $_GET['action']) { bbp_set_query_name('bbp_topic_merge'); bbp_get_template_part('form', 'topic-merge'); // Split } elseif (!empty($_GET['action']) && 'split' === $_GET['action']) { bbp_set_query_name('bbp_topic_split'); bbp_get_template_part('form', 'topic-split'); // Edit } else { bbp_set_query_name('bbp_topic_form'); bbp_get_template_part('form', 'topic'); } // Single Topic } else { bbp_set_query_name('bbp_single_topic'); bbp_get_template_part('content', 'single-topic'); } break; /** Single Reply **********************************************/ /** Single Reply **********************************************/ case $this->reply_slug: // Get the reply bbp_has_replies(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1)); // If no topic, 404 if (!bbp_replies()) { bp_do_404(bbp_get_forum_permalink($forum_id)); ?> <h3><?php bbp_forum_title(); ?> </h3> <?php bbp_get_template_part('feedback', 'no-replies'); return; } // Setup the reply bbp_the_reply(); ?> <h3><?php bbp_reply_title(); ?> </h3> <?php if (bp_action_variable($offset + 2) === bbp_get_edit_rewrite_id()) { // Set the edit switches $wp_query->bbp_is_edit = true; $wp_query->bbp_is_reply_edit = true; // Setup the global reply ID $bbp->current_reply_id = get_the_ID(); // Move if (!empty($_GET['action']) && 'move' === $_GET['action']) { bbp_set_query_name('bbp_reply_move'); bbp_get_template_part('form', 'reply-move'); // Edit } else { bbp_set_query_name('bbp_reply_form'); bbp_get_template_part('form', 'reply'); } } break; } // Reset the query wp_reset_query(); ?> </div> <?php // Allow actions immediately after group forum output do_action('bbp_after_group_forum_display'); }
/** * Output an RSS2 feed of replies, based on the query passed. * * @since bbPress (r3171) * * @uses bbp_version() * @uses bbp_is_single_topic() * @uses bbp_user_can_view_forum() * @uses bbp_get_topic_forum_id() * @uses bbp_show_load_topic() * @uses bbp_topic_permalink() * @uses bbp_topic_title() * @uses bbp_get_topic_reply_count() * @uses bbp_topic_content() * @uses bbp_has_replies() * @uses bbp_replies() * @uses bbp_the_reply() * @uses bbp_reply_url() * @uses bbp_reply_title() * @uses bbp_reply_content() * @uses get_wp_title_rss() * @uses get_option() * @uses bloginfo_rss * @uses self_link() * @uses the_author() * @uses get_post_time() * @uses rss_enclosure() * @uses do_action() * @uses apply_filters() * * @param array $replies_query */ function bbp_display_replies_feed_rss2($replies_query = array()) { // User cannot access forum this topic is in if (bbp_is_single_topic() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) { return; } // Adjust the title based on context if (bbp_is_single_topic() && bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) { $title = apply_filters('wp_title_rss', get_wp_title_rss(' » ')); } elseif (!bbp_show_lead_topic()) { $title = ' » ' . __('All Posts', 'bbpress'); } else { $title = ' » ' . __('All Replies', 'bbpress'); } // Display the feed header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); header('Status: 200 OK'); echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; ?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" <?php do_action('bbp_feed'); ?> > <channel> <title><?php bloginfo_rss('name'); echo $title; ?> </title> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <link><?php self_link(); ?> </link> <description><?php // ?> </description> <pubDate><?php echo mysql2date('D, d M Y H:i:s O', current_time('mysql'), false); ?> </pubDate> <generator>http://bbpress.org/?v=<?php bbp_version(); ?> </generator> <language><?php bloginfo_rss('language'); ?> </language> <?php do_action('bbp_feed_head'); ?> <?php if (bbp_is_single_topic()) { ?> <?php if (bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) { ?> <?php if (bbp_show_lead_topic()) { ?> <item> <guid><?php bbp_topic_permalink(); ?> </guid> <title><![CDATA[<?php bbp_topic_title(); ?> ]]></title> <link><?php bbp_topic_permalink(); ?> </link> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?> </pubDate> <dc:creator><?php the_author(); ?> </dc:creator> <description> <![CDATA[ <p><?php printf(__('Replies: %s', 'bbpress'), bbp_get_topic_reply_count()); ?> </p> <?php bbp_topic_content(); ?> ]]> </description> <?php rss_enclosure(); ?> <?php do_action('bbp_feed_item'); ?> </item> <?php } ?> <?php } ?> <?php } ?> <?php if (bbp_has_replies($replies_query)) { ?> <?php while (bbp_replies()) { bbp_the_reply(); ?> <item> <guid><?php bbp_reply_url(); ?> </guid> <title><![CDATA[<?php bbp_reply_title(); ?> ]]></title> <link><?php bbp_reply_url(); ?> </link> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?> </pubDate> <dc:creator><?php the_author(); ?> </dc:creator> <description> <![CDATA[ <?php bbp_reply_content(); ?> ]]> </description> <?php rss_enclosure(); ?> <?php do_action('bbp_feed_item'); ?> </item> <?php } ?> <?php } ?> <?php do_action('bbp_feed_footer'); ?> </channel> </rss> <?php // We're done here exit; }
/** * Output the required hidden fields when creating/editing a reply * * @since bbPress (r2753) * * @uses bbp_is_reply_edit() To check if it's the reply edit page * @uses wp_nonce_field() To generate hidden nonce fields * @uses bbp_reply_id() To output the reply id * @uses bbp_topic_id() To output the topic id * @uses bbp_forum_id() To output the forum id */ function bbp_reply_form_fields() { if (bbp_is_reply_edit()) { ?> <input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php bbp_reply_title(); ?> " /> <input type="hidden" name="bbp_reply_id" id="bbp_reply_id" value="<?php bbp_reply_id(); ?> " /> <input type="hidden" name="action" id="bbp_post_action" value="bbp-edit-reply" /> <?php if (current_user_can('unfiltered_html')) { wp_nonce_field('bbp-unfiltered-html-reply_' . bbp_get_reply_id(), '_bbp_unfiltered_html_reply', false); } ?> <?php wp_nonce_field('bbp-edit-reply_' . bbp_get_reply_id()); } else { ?> <input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php printf(__('Reply To: %s', 'bbpress'), bbp_get_topic_title()); ?> " /> <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="<?php bbp_topic_id(); ?> " /> <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply" /> <?php if (current_user_can('unfiltered_html')) { wp_nonce_field('bbp-unfiltered-html-reply_' . bbp_get_topic_id(), '_bbp_unfiltered_html_reply', false); } ?> <?php wp_nonce_field('bbp-new-reply'); // Show redirect field if not viewing a specific topic if (bbp_is_query_name('bbp_single_topic')) { bbp_redirect_to_field(get_permalink()); } } }