bbp_display_replies_feed_rss2

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

Description

bbp_display_replies_feed_rss2( (array) $replies_query = array() ); 

Parameters (1)

0. $replies_query — Optional. (array) => array()
The replies query.

Usage

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

Defined (1)

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

/includes/replies/functions.php  
  1. function bbp_display_replies_feed_rss2( $replies_query = array() ) { 
  2.  
  3. // User cannot access forum this topic is in 
  4. if ( bbp_is_single_topic() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) 
  5. return; 
  6.  
  7. // Adjust the title based on context 
  8. if ( bbp_is_single_topic() && bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) 
  9. $title = apply_filters( 'wp_title_rss', get_wp_title_rss( ' » ' ) ); 
  10. elseif ( !bbp_show_lead_topic() ) 
  11. $title = ' » ' . __( 'All Posts', bbpress ); 
  12. else 
  13. $title = ' » ' . __( 'All Replies', bbpress ); 
  14.  
  15. // Display the feed 
  16. header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true ); 
  17. header( 'Status: 200 OK' ); 
  18. echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; ?> 
  19.  
  20. <rss version="2.0" 
  21. xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  22. xmlns:wfw="http://wellformedweb.org/CommentAPI/" 
  23. xmlns:dc="http://purl.org/dc/elements/1.1/" 
  24. xmlns:atom="http://www.w3.org/2005/Atom" 
  25.  
  26. <?php do_action( 'bbp_feed' ); ?> 
  27.  
  28. <channel> 
  29. <title><?php bloginfo_rss('name'); echo $title; ?></title> 
  30. <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 
  31. <link><?php self_link(); ?></link> 
  32. <description><?php //?></description> 
  33. <pubDate><?php echo mysql2date( 'D, d M Y H:i:s O', current_time( 'mysql' ), false ); ?></pubDate> 
  34. <generator>http://bbpress.org/?v=<?php bbp_version(); ?></generator> 
  35. <language><?php bloginfo_rss( 'language' ); ?></language> 
  36.  
  37. <?php do_action( 'bbp_feed_head' ); ?> 
  38.  
  39. <?php if ( bbp_is_single_topic() ) : ?> 
  40. <?php if ( bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) : ?> 
  41. <?php if ( bbp_show_lead_topic() ) : ?> 
  42.  
  43. <item> 
  44. <guid><?php bbp_topic_permalink(); ?></guid> 
  45. <title><![CDATA[<?php bbp_topic_title(); ?>]]></title> 
  46. <link><?php bbp_topic_permalink(); ?></link> 
  47. <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> 
  48. <dc:creator><?php the_author(); ?></dc:creator> 
  49.  
  50. <description> 
  51. <![CDATA[ 
  52. <p><?php printf( __( 'Replies: %s', bbpress ), bbp_get_topic_reply_count() ); ?></p> 
  53. <?php bbp_topic_content(); ?> 
  54. ]]> 
  55. </description> 
  56.  
  57. <?php rss_enclosure(); ?> 
  58.  
  59. <?php do_action( 'bbp_feed_item' ); ?> 
  60.  
  61. </item> 
  62.  
  63. <?php endif; ?> 
  64. <?php endif; ?> 
  65. <?php endif; ?> 
  66.  
  67. <?php if ( bbp_has_replies( $replies_query ) ) : ?> 
  68. <?php while ( bbp_replies() ) : bbp_the_reply(); ?> 
  69.  
  70. <item> 
  71. <guid><?php bbp_reply_url(); ?></guid> 
  72. <title><![CDATA[<?php bbp_reply_title(); ?>]]></title> 
  73. <link><?php bbp_reply_url(); ?></link> 
  74. <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> 
  75. <dc:creator><?php the_author() ?></dc:creator> 
  76.  
  77. <description> 
  78. <![CDATA[ 
  79. <?php bbp_reply_content(); ?> 
  80. ]]> 
  81. </description> 
  82.  
  83. <?php rss_enclosure(); ?> 
  84.  
  85. <?php do_action( 'bbp_feed_item' ); ?> 
  86.  
  87. </item> 
  88.  
  89. <?php endwhile; ?> 
  90. <?php endif; ?> 
  91.  
  92. <?php do_action( 'bbp_feed_footer' ); ?> 
  93.  
  94. </channel> 
  95. </rss> 
  96.  
  97. <?php 
  98.  
  99. // We're done here 
  100. exit();