bbp_display_topics_feed_rss2

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

Description

bbp_display_topics_feed_rss2( (array) $topics_query = array() ); 

Parameters (1)

0. $topics_query — Optional. (array) => array()
The topics query.

Usage

  1. if ( !function_exists( 'bbp_display_topics_feed_rss2' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/functions.php'; 
  3.  
  4. // The topics query. 
  5. $topics_query = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_display_topics_feed_rss2($topics_query); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/topics/functions.php  
  1. function bbp_display_topics_feed_rss2( $topics_query = array() ) { 
  2.  
  3. // User cannot access this forum 
  4. if ( bbp_is_single_forum() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_forum_id() ) ) ) 
  5. return; 
  6.  
  7. // Display the feed 
  8. header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true ); 
  9. header( 'Status: 200 OK' ); 
  10. echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; ?> 
  11.  
  12. <rss version="2.0" 
  13. xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  14. xmlns:wfw="http://wellformedweb.org/CommentAPI/" 
  15. xmlns:dc="http://purl.org/dc/elements/1.1/" 
  16. xmlns:atom="http://www.w3.org/2005/Atom" 
  17.  
  18. <?php do_action( 'bbp_feed' ); ?> 
  19.  
  20. <channel> 
  21.  
  22. <title><?php bloginfo_rss( 'name' ); ?> » <?php _e( 'All Topics', bbpress ); ?></title> 
  23. <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 
  24. <link><?php self_link(); ?></link> 
  25. <description><?php //?></description> 
  26. <pubDate><?php echo mysql2date( 'D, d M Y H:i:s O', current_time( 'mysql' ), false ); ?></pubDate> 
  27. <generator>http://bbpress.org/?v=<?php bbp_version(); ?></generator> 
  28. <language><?php bloginfo_rss( 'language' ); ?></language> 
  29.  
  30. <?php do_action( 'bbp_feed_head' ); ?> 
  31.  
  32. <?php if ( bbp_has_topics( $topics_query ) ) : ?> 
  33.  
  34. <?php while ( bbp_topics() ) : bbp_the_topic(); ?> 
  35.  
  36. <item> 
  37. <guid><?php bbp_topic_permalink(); ?></guid> 
  38. <title><![CDATA[<?php bbp_topic_title(); ?>]]></title> 
  39. <link><?php bbp_topic_permalink(); ?></link> 
  40. <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> 
  41. <dc:creator><?php the_author() ?></dc:creator> 
  42.  
  43. <?php if ( !post_password_required() ) : ?> 
  44.  
  45. <description> 
  46. <![CDATA[ 
  47. <p><?php printf( esc_html__( 'Replies: %s', bbpress ), bbp_get_topic_reply_count() ); ?></p> 
  48. <?php bbp_topic_content(); ?> 
  49. ]]> 
  50. </description> 
  51.  
  52. <?php rss_enclosure(); ?> 
  53.  
  54. <?php endif; ?> 
  55.  
  56. <?php do_action( 'bbp_feed_item' ); ?> 
  57.  
  58. </item> 
  59.  
  60. <?php endwhile; ?> 
  61. <?php endif; ?> 
  62.  
  63. <?php do_action( 'bbp_feed_footer' ); ?> 
  64.  
  65. </channel> 
  66. </rss> 
  67.  
  68. <?php 
  69. exit();