Forums

Join
bbPress Support ForumsTroubleshootingAll RSS Feeds Broken?

Info

All RSS Feeds Broken?

  1. Yeah that looks like WordPress is attempting to handle the RSS as well as bbPress, so it's definitely a deep integration issue. I'm not sure how to detangle that, but hopefully someone else can or I'll try and have a look tomorrow.

  2. Was there another thread started about this that I'm not seeing? I'm running deep integration and absolutely no feeds either, with the diffs applied.

  3. @ kawauso

    I applied the patches suggested via the trac and your comments but my rss feed is still returning invalid in Chrome, Opera and Firefox (in Safari it works fine)

    it does seem to be something wrong with the markup via an extra space in front of the xml declaration somewhere...

    Anyone have any ideas??

    Chrome:

    error on line 1 at column 6: XML declaration allowed only at the start of the document

    Opera:

    XML parsing failed: syntax error (Line: 1, Character: 1)

    Error:XML declaration not at beginning of document

    and it shows a space in front of the initial <? xml

    Firefox:

    XML Parsing Error: XML or text declaration not at start of entity
    Location: /rss.php?topic=2074
    Line Number 1, Column 2: <?xml version="1.0" encoding="UTF-8"?>
    -^

  4. I've been wondering about this. I applied the patch and had the same experience. So my question is, how do RSS feeds actually work? Should the feed be shown using the patched rss.php file immediately, or is there some time delay, or do you need to publish some content to update the feed? When you call up a feed URL in the browser, what happens?

    My experience was the same when applying the patch, but then I wondered how soon I should have seen the results.

  5. Is there somebody who knows how to fix the rss problem?

  6. I think a patch was posted. Have you tried that? http://trac.bbpress.org/ticket/1209

  7. I solved the problem!

    I removed all "»" in the rss.php

    Replace the code of your rss.php with the following code and it should work:

    <?php<br />
    require('./bb-load.php');</p>
    <p>// Determine the type of feed and the id of the object<br />
    if ( isset($_GET['view']) || bb_get_path() == 'view' ) {</p>
    <p>	// View<br />
    	$feed = 'view';<br />
    	$feed_id = isset($_GET['view']) ? $_GET['view'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['topic']) || bb_get_path() == 'topic' ) {</p>
    <p>	// Topic<br />
    	$feed = 'topic';<br />
    	$topic = get_topic(isset($_GET['topic']) ? $_GET['topic'] : bb_get_path(2));<br />
    	$feed_id = $topic->topic_id;</p>
    <p>} elseif ( isset($_GET['profile']) || bb_get_path() == 'profile' ) {</p>
    <p>	// Profile<br />
    	$feed = 'profile';<br />
    	$feed_id = isset($_GET['profile']) ? $_GET['profile'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['tag']) || bb_get_path() == 'tags' ) {</p>
    <p>	if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
    		// Tag recent topics<br />
    		$feed = 'tag-topics';<br />
    	} else {<br />
    		// Tag recent posts<br />
    		$feed = 'tag-posts';<br />
    	}<br />
    	$feed_id = isset($_GET['tag']) ? $_GET['tag'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['forum']) || bb_get_path() == 'forum' ) {</p>
    <p>	if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
    		// Forum recent topics<br />
    		$feed = 'forum-topics';<br />
    	} else {<br />
    		// Forum recent posts<br />
    		$feed = 'forum-posts';<br />
    	}<br />
    	$forum = bb_get_forum(isset($_GET['forum']) ? $_GET['forum'] : bb_get_path(2));<br />
    	$feed_id = $forum->forum_id;</p>
    <p>} elseif ( isset($_GET['topics']) || bb_get_path() == 'topics' ) {</p>
    <p>	// Recent topics<br />
    	$feed = 'all-topics';</p>
    <p>} else {</p>
    <p>	// Recent posts<br />
    	$feed = 'all-posts';</p>
    <p>}</p>
    <p>// Initialise the override variable<br />
    $bb_db_override = false;<br />
    do_action( 'bb_rss.php_pre_db' );</p>
    <p>if ( !$bb_db_override ) {</p>
    <p>	// Get the posts and the title for the given feed<br />
    	switch ($feed) {<br />
    		case 'view':<br />
    			if ( !isset($bb_views[$feed_id]) )<br />
    				die();<br />
    			if ( !$bb_views[$feed_id]['feed'] )<br />
    				die();<br />
    			if ( !$topics_object = new BB_Query( 'topic', $bb_views[$feed_id]['query'], "bb_view_$feed_id" ) )<br />
    				die();</p>
    <p>			$topics = $topics_object->results;<br />
    			if ( !$topics || !is_array($topics) )<br />
    				die();</p>
    <p>			$posts = array();<br />
    			foreach ($topics as $topic) {<br />
    				$posts[] = bb_get_first_post($topic->topic_id);<br />
    			}</p>
    <p>			$title = esc_html( sprintf( __( '%1$s View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ) );<br />
    			$link = get_view_link($feed_id);<br />
    			$link_self = bb_get_view_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'topic':<br />
    			if ( !$topic = get_topic ( $feed_id ) )<br />
    				die();<br />
    			if ( !$posts = get_thread( $feed_id, 0, 1 ) )<br />
    				die();<br />
    			$title = esc_html( sprintf( __( '%1$s  Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ) );<br />
    			$link = get_topic_link($feed_id);<br />
    			$link_self = get_topic_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'profile':<br />
    			if ( bb_get_option( 'mod_rewrite' ) === 'slugs' ) {<br />
    				$user = bb_get_user_by_nicename( $feed_id );<br />
    			} else {<br />
    				$user = bb_get_user( $feed_id );<br />
    			}<br />
    			if ( !$user ) {<br />
    				die();<br />
    			}<br />
    			if ( !$posts = get_user_favorites( $user->ID ) ) {<br />
    				die();<br />
    			}<br />
    			$title = esc_html( sprintf( __( '%1$s  User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_login ) );<br />
    			$link = bb_get_profile_link($feed_id);<br />
    			$link_self = get_favorites_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'tag-topics':<br />
    			if ( !$tag = bb_get_tag( $feed_id ) )<br />
    				die();<br />
    			if ( !$topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
    				die();</p>
    <p>			$posts = array();<br />
    			foreach ($topics as $topic) {<br />
    				$posts[] = bb_get_first_post($topic->topic_id);<br />
    			}</p>
    <p>			$title = esc_html( sprintf( __( '%1$s  Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
    			$link = bb_get_tag_link($feed_id);<br />
    			$link_self = bb_get_tag_topics_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'tag-posts':<br />
    			if ( !$tag = bb_get_tag( $feed_id ) )<br />
    				die();<br />
    			if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
    				die();<br />
    			$title = esc_html( sprintf( __( '%1$s  Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
    			$link = bb_get_tag_link($feed_id);<br />
    			$link_self = bb_get_tag_posts_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'forum-topics':<br />
    			if ( !$topics = get_latest_topics( $feed_id ) )<br />
    				die();</p>
    <p>			$posts = array();<br />
    			foreach ($topics as $topic) {<br />
    				$posts[] = bb_get_first_post($topic->topic_id);<br />
    			}</p>
    <p>			$title = esc_html( sprintf( __( '%1$s  Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
    			$link = get_forum_link($feed_id);<br />
    			$link_self = bb_get_forum_topics_rss_link($feed_id);<br />
    			break;</p>
    <p>		case 'forum-posts':<br />
    			if ( !$posts = bb_get_latest_forum_posts( $feed_id ) )<br />
    				die();<br />
    			$title = esc_html( sprintf( __( '%1$s  Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
    			$link = get_forum_link($feed_id);<br />
    			$link_self = bb_get_forum_posts_rss_link($feed_id);<br />
    			break;</p>
    <p>		// Get just the first post from the latest topics<br />
    		case 'all-topics':<br />
    			if ( !$topics = get_latest_topics() )<br />
    				die();</p>
    <p>			$posts = array();<br />
    			foreach ($topics as $topic) {<br />
    				$posts[] = bb_get_first_post($topic->topic_id);<br />
    			}</p>
    <p>			$title = esc_html( sprintf( __( '%1$s  Recent Topics' ), bb_get_option( 'name' ) ) );<br />
    			$link = bb_get_uri();<br />
    			$link_self = bb_get_topics_rss_link();<br />
    			break;</p>
    <p>		// Get latest posts by default<br />
    		case 'all-posts':<br />
    		default:<br />
    			if ( !$posts = bb_get_latest_posts( 35 ) )<br />
    				die();<br />
    			$title = esc_html( sprintf( __( '%1$s  Recent Posts' ), bb_get_option( 'name' ) ) );<br />
    			$link = bb_get_uri();<br />
    			$link_self = bb_get_posts_rss_link();<br />
    			break;<br />
    	}<br />
    }</p>
    <p>bb_send_304( $posts[0]->post_time );</p>
    <p>if (!$description = esc_html( bb_get_option('description') )) {<br />
    	$description = $title;<br />
    }<br />
    $title = apply_filters( 'bb_title_rss', $title, $feed );<br />
    $description = apply_filters( 'bb_description_rss', $description, $feed );<br />
    $posts = apply_filters( 'bb_posts_rss', $posts, $feed );<br />
    $link_self = apply_filters( 'bb_link_self_rss', $link_self, $feed );</p>
    <p>bb_load_template( 'rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed );</p>
    <p>?>
  8. WTF is the problem?

    Errore interpretazione XML: la dichiarazione XML o testuale non è all'inizio di un'entità
    Indirizzo: http://ciobomario.com/forum/rss/forum/presentati
    Linea numero 2, colonna 1:<?xml version="1.0" encoding="UTF-8"?>
    ^

  9. There's a space character before <?xml

  10. @zaerl

    Ho provato a fare tutte le modifiche possibile, ma non ho trovato soluzione... come risolvo? Ho anche sostituito i file rss2.php, rss.php con quelli di default (anche se prima non li avevo toccati) ma nulla

  11. (In english please). I don't know. I don't have problems with feeds.

  12. CioboMario, this is the same problem I had. The files do not contain an extra space before the <?xml but when output the error comes up. Try replacing your files with the latest versions - http://trac.bbpress.org/ticket/1181

  13. I think I've created a quite strong code for the RSS. It allows plugins to apply their filters (example: smilies!!!). It fixes problems with double apersand encoding and " " not working well with UTF-8. It also fixes the date of items which is not valid if you use localization, even if the options array sets "false" on "localize".
    Feel free to try the code for yourself, it works with stock bbPress 1.0.2. You JUST need to put this content in your rss2.php (check the theme folder).

    <?php
    header( 'Content-Type: text/xml; charset=UTF-8' );
    echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
    bb_generator( 'comment' );
    
    function datefix($buffer) {
    	/*
    	 * fix della data in modo da tenerla in inglese, rispettando
    	 * le specifiche dei feed RSS
    	 */
    	 return gmdate('D, d M Y H:i:s +0000', $buffer);
    }
    
    function callback($buffer)
    {
    	/*
    	 * sistema il codice rimuovendo la doppia codifica di "&" e
    	 * rimuove il carattere "&nbsp;" che crea problemi con UTF-8
    	 * in questo modo ho il testo del post dopo che i plugin (tipo
    	 * le faccine) hanno applicato le loro modifiche html e ritorno
    	 * il codice html senza entities ma in forma pura
    	 */
    
    	$single = str_replace("&", "&", $buffer);
    	$spaced = str_replace("&nbsp;", " ", $single);
    	return html_entity_decode($spaced);
    }
    
    ?>
    <rss version="2.0"
    	xmlns:content="http://purl.org/rss/1.0/modules/content/"
    	xmlns:dc="http://purl.org/dc/elements/1.1/"
    	xmlns:atom="http://www.w3.org/2005/Atom">
    	<channel>
    		<title><?php echo $title; ?></title>
    		<link><?php echo $link; ?></link>
    		<description><![CDATA[<?php echo $description; ?>]]></description>
    		<language><?php esc_html( bb_option('language') ); ?></language>
    		<pubDate><?php echo gmdate('D, d M Y H:i:s +0000'); ?></pubDate>
    		<?php bb_generator( 'rss2' ); ?>
    		<textInput>
    			<title><![CDATA[<?php _e('Search'); ?>]]></title>
    			<description><![CDATA[<?php _e('Search all topics from these forums.'); ?>]]></description>
    			<name>q</name>
    			<link><?php bb_uri('search.php'); ?></link>
    		</textInput>
    		<atom:link href="<?php echo $link_self; ?>" rel="self" type="application/rss+xml" />
    
    <?php foreach ($posts as $bb_post) : ?>
    		<item>
    			<title><?php post_author(); ?> <?php _e('on')?> "<?php topic_title( $bb_post->topic_id ); ?>"</title>
    			<link><?php post_link(); ?></link>
    			<pubDate><?php 
    
    			ob_start("datefix");
    			bb_post_time('U');
    			ob_end_flush();
    
    			?></pubDate>
    			<dc:creator><?php post_author(); ?></dc:creator>
    			<guid isPermaLink="false"><?php post_id(); ?>@<?php bb_uri(); ?></guid>
    			<description><![CDATA[<?php
    
    			ob_start("callback");
    			post_text();
    			ob_end_flush();
    
    			?>]]></description>
    		</item>
    <?php endforeach; ?>
    
    	</channel>
    </rss>

    Sorry for comments in italian.
    BTW @ yoyopop, I don't remember in which topic, but I read on this forum that the problem is related to some plugins having extra spaces in their code before the opening "<?php" tag. Check it...

  14. You must log in to post.