bbp_display_replies_feed_rss2( array $replies_query = array() )
Output an RSS2 feed of replies, based on the query passed.
Description Description
Parameters Parameters
- $replies_query
-
(Optional)
Default value: array()
Source Source
File: includes/replies/functions.php
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() ) {
$title = get_wp_title_rss();
} elseif ( ! bbp_show_lead_topic() ) {
$title = get_bloginfo_rss( 'name' ) . ' » ' . __( 'All Posts', 'bbpress' );
} else {
$title = get_bloginfo_rss( 'name' ) . ' » ' . __( 'All Replies', 'bbpress' );
}
$title = apply_filters( 'wp_title_rss', $title );
// Display the feed
header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; 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 echo $title; // Already escaped ?></title>
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
<link><?php self_link(); ?></link>
<description><?php //?></description>
<lastBuildDate><?php echo date( 'r' ); ?></lastBuildDate>
<generator><?php echo esc_url_raw( 'https://bbpress.org/?v=' . convert_chars( bbp_get_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 endif; ?>
<?php endif; ?>
<?php endif; ?>
<?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 endwhile; ?>
<?php endif; ?>
<?php do_action( 'bbp_feed_footer' ); ?>
</channel>
</rss>
<?php
// We're done here
exit();
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |