I'm using WPMU-1.2.3 with the Sitewide plugin that was available today (2007-10-01). Since I'm using a subdir configuration I faced some problems during the configuration that were already discussed here. Here are some problems I had and how I solved (or bypassed) them by editing the wpmufeed.php file. (I've never coded PHP before. Most probably there are better ways to do what I intended.)
The verification that is performed on the feed URLs doesn't like the URLs for subdir configurations. I made this correction:
@@ -77,14 +77,25 @@
if (preg_match('/^[0-9]+$/',$_POST['triggerblog']) && $_POST['triggerblog'] > 0) $triggerblog = intval($_POST['triggerblog']);
else $configerror[] = 'Trigger blog must be a numeric blog ID. Default: 1';
- if (preg_match('/^\/[a-zA-Z0-9_\/\-]+\/$/',$_POST['triggerurl'])) $triggerurl = $_POST['triggerurl'];
- else $configerror[] = 'Invalid trigger URL. Must be a relative path beginning with and ending with a "/". Default: /wpmu-feed/';
+ if( constant( 'VHOST' ) == 'yes' ) {
+ if (preg_match('/^\/[a-zA-Z0-9_\/\-]+\/$/',$_POST['triggerurl'])) $triggerurl = $_POST['triggerurl'];
+ else $configerror[] = 'Invalid trigger URL. Must be a relative path beginning with and ending with a "/". Default: /wpmu-feed/';
+
+ if (preg_match('/^[a-zA-Z0-9_\-]+\/$/',$_POST['commentsurl'])) $commentsurl = $_POST['commentsurl'];
+ else $configerror[] = 'Invalid comments URL. Must be a relative path ending with a "/". Default: comments/';
+
+ if (preg_match('/^[a-zA-Z0-9_\-]+\/$/',$_POST['pagesurl'])) $pagesurl = $_POST['pagesurl'];
+ else $configerror[] = 'Invalid pages URL. Must be a relative path ending with a "/". Default: pages/';
+ } else {
+ if (preg_match('/^\?[a-zA-Z0-9_\/\-]+=[a-zA-Z0-9_\/\-]+$/',$_POST['triggerurl'])) $triggerurl = $_POST['triggerurl'];
+ else $configerror[] = 'Invalid trigger URL. Must be a query string beginning with a "?". Default: ?wpmu-feed=posts';
- if (preg_match('/^[a-zA-Z0-9_\-]+\/$/',$_POST['commentsurl'])) $commentsurl = $_POST['commentsurl'];
- else $configerror[] = 'Invalid comments URL. Must be a relative path ending with a "/". Default: comments/';
+ if (preg_match('/^\?[a-zA-Z0-9_\/\-]+=[a-zA-Z0-9_\/\-]+$/',$_POST['commentsurl'])) $commentsurl = $_POST['commentsurl'];
+ else $configerror[] = 'Invalid comments URL. Must be a query string beginning with a "?". Default: ?wpmu-feed=comments';
- if (preg_match('/^[a-zA-Z0-9_\-]+\/$/',$_POST['pagesurl'])) $pagesurl = $_POST['pagesurl'];
- else $configerror[] = 'Invalid pages URL. Must be a relative path ending with a "/". Default: pages/';
+ if (preg_match('/^\?[a-zA-Z0-9_\/\-]+=[a-zA-Z0-9_\/\-]+$/',$_POST['pagesurl'])) $pagesurl = $_POST['pagesurl'];
+ else $configerror[] = 'Invalid pages URL. Must be a query string beginning with a "?". Default: ?wpmu-feed=pages';
+ }
if (preg_match('/^[0-9]+$/',$_POST['feedcount']) && $_POST['feedcount'] > 0) $feedcount = intval($_POST['feedcount']);
else $configerror[] = 'Post count must be a number greater than zero. Default: 20';
The "test link" links were wrong too. This is what I did:
@@ -177,8 +188,13 @@
function create_testlink($type) {
global $wpdb;
if ($type == 'posts') $url = $this->triggerurl;
- if ($type == 'comments') $url = $this->triggerurl.$this->commentsurl;
- if ($type == 'pages') $url = $this->triggerurl.$this->pagesurl;
+ if( constant( 'VHOST' ) == 'yes' ) {
+ if ($type == 'comments') $url = $this->triggerurl.$this->commentsurl;
+ if ($type == 'pages') $url = $this->triggerurl.$this->pagesurl;
+ } else {
+ if ($type == 'comments') $url = $this->commentsurl;
+ if ($type == 'pages') $url = $this->pagesurl;
+ }
Since the feeds that were being generated weren't being correctly imported in my feed aggregator I pasted the XML on the W3C Feed Validation Service and it reported some problems.
The first one is that some feeds had an empty guid
tag. I bypassed the problem like this:
@@ -376,7 +392,7 @@
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?>
- <guid isPermaLink="false"><?php the_guid(); ?></guid>
+ <guid isPermaLink="false"><?php if (get_the_guid()) { the_guid(); } else { permalink_single_rss(); } ?></guid>
<?php if ($this->excerpt) : ?>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php else : ?>
Moreover, all feed items had empty wfw:commentRss
tags too. I simply removed this tag altogether:
@@ -387,7 +403,6 @@
<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
<?php endif; ?>
<?php endif; ?>
- <wfw:commentRss><?php comments_rss() ?></wfw:commentRss>
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
</item>
There are one remaining problem that I couldn't understand yet. There must be something strange in some posts and pages because the feeds generated for them are being truncated just after the link
tag. This leaves the XML corrupt in a way that it cannot be imported by my feed aggregator.
So far I was able to avoid the problem in my posts feed by reducing the number of items in it to 10. This is because the post causing the problem is currently the number 14 in the list. But whatever is causing the feed to break is probably going to happen again in a future post, rendering the feed unuseable again.
The same problem occurs with the pages feed.
What would be the best strategy to investigate this problem further?
Notice that this is a Brazilian blog site and the posts are all in Portuguese. Perhaps the accented characters we use may have something to do with this.