bbp_display_replies_feed_rss2( array $replies_query = array() )

Output an RSS2 feed of replies, based on the query passed.

Description

Parameters

$replies_query

(Optional)

Default value: array()

Source

File: bp-forums/replies/functions.php

2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
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',   'buddyboss' );
    else
        $title = ' » ' .  __( 'All Replies', 'buddyboss' );
 
    // 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 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', 'buddyboss' ), 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
bbPress (r3171) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.