bbp_display_topics_feed_rss2( array $topics_query = array() )

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

Description

Parameters

$topics_query

(Optional)

Default value: array()

Source

File: bp-forums/topics/functions.php

3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
function bbp_display_topics_feed_rss2( $topics_query = array() ) {
 
    // User cannot access this forum
    if ( bbp_is_single_forum() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_forum_id() ) ) )
        return;
 
    // 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' ); ?> &#187; <?php _e( 'All Discussions', 'buddyboss' ); ?></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_has_topics( $topics_query ) ) : ?>
 
            <?php while ( bbp_topics() ) : bbp_the_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_meta( bbp_get_topic_id(), '_bbp_last_active_time', true ) ); ?></pubDate>
                    <dc:creator><?php the_author() ?></dc:creator>
 
                    <?php if ( !post_password_required() ) : ?>
 
                    <description>
                        <![CDATA[
                        <p><?php printf( esc_html__( 'Replies: %s', 'buddyboss' ), bbp_get_topic_reply_count() ); ?></p>
                        <?php bbp_topic_content(); ?>
                        ]]>
                    </description>
 
                    <?php rss_enclosure(); ?>
 
                    <?php endif; ?>
 
                    <?php do_action( 'bbp_feed_item' ); ?>
 
                </item>
 
                <?php endwhile; ?>
            <?php endif; ?>
 
        <?php do_action( 'bbp_feed_footer' ); ?>
 
    </channel>
    </rss>
 
<?php
    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.