FOF powered subscriptions page hack

This article should explain how to use the Feed on Feeds server-side RSS aggregator to create a page on a WordPress powered blog.

Update : Instructions in Spanish, thanks to Frank Pereiro, from Tenerif�, Spain. He also adds that it works so much to his satisfaction that he now uses this as his primary news reader. Many thanks to him!

First off, let me say that I love Feed on Feeds, and I wish to thank Steve Minutillo for making it available under the GPL.
This modified code is also made available under the same terms as the original Feed on Feeds code. I claim no rights to the original Feed on Feeds code. You are free to modify part or whole of the _modified_ code that I have included for your needs.

I started off with this with gat’s excellent tutorial for doing something similar. Thanks, gat :)

For example, I can read all the feeds I subscribe to at My subscriptions page using the setup I am about to describe.

Advantages:
1) Feed on Feeds (FoF) is a server-sider RSS aggregator, so you dont have to rely on other applications/ websites/ services to read a page with all your RSS feed updates.
2) FoF gives you updates in chronological order, unlike some RSS aggregators, where, if you are subscribed to say 2 xml feeds, you see all the entries from feed 1, then all the entries from feed2. With FoF you get the latest from feed 1, the latest from feed 2, — in short, you get the entries in the order that the websites were updated, latest first.

Here’s an overview of what needs to be done :
1)The required files need to be edited/uploaded.
2)The WordPress index.php file needs to be modified.
3) The .htaccess file needs to be modified to rewrite some urls.

Step 1.
a) Get the fofwp.zip file and unzip it.
b) edit the “config.php” that is in the “fof” folder.
c) edit the “init2.php” file that is the “fofwp” folder, that is, outside the “fof” folder (lines 3, 11 and 12 to be precise).
d)upload all the files to your server, if your wordpress files are in the /blog directory, the “init2.php” and the “view.php” files should be in the same directory The “fof” folder should also be in the same directory, so now the directory with wordpress installed in it now has an additional directory “fof” in it so that you now have a “/blog/fof” directory.
e) point your browser to /blog/fof/install.php and run through the installation.

Now FoF is hopefully installed and running fine. If you had any problems, the installation help at the FoF about page should be of help.
Also, please read the same page for more details about how to add/delete feeds, update them etc.

Step 2 : Modifying index.php

The portion of index.php that serves the entries is what needs to be modified. What we are trying to do is to have the index.php file display the subscriptions page when the parameter “subscriptions” is passed to it.

So find the line that says :
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>

and just above this line, include the following piece of code :
<?php
$subscriptions = $_GET['subscriptions'];
if ($subscriptions == 1) { echo "My subscriptions:<br/>";
include('view.php');
}
else { ?>

then,

find the lines that say :
<p>Sorry, no posts matched your criteria.</p>
<?php } ?>

and add :
<?php } ?>

on the line immediately after.

–So, here, we did a “if subscriptions, serve the view.php; else serve the index.php as you normally do otherwise”.

Step 3 : Taking care of security.

You need to protect your “fof” folder on the webserver with a .htaccess and .htpasswd file setup.
I have included a “sample.htaccess” and “sample.htpasswd” file , but you need to create your own .htaccess and .htpasswd to protect this directory so only you can update/delete/modify the feeds etc. A lot of resources are available as to how to password protect a directory in Apache.
Once that is done, lets write some ReWrite rules for friendlier urls. I you don’t have the mod_reqrite module installed on the server, or don’t want to use it, then your subscriptions page can be accessed at “http://yourblog.com/index.php?subscriptions=1″
To add the rewrite rules, open the .htaccess file in your blog root directory and add the following lines to it :
RewriteRule ^subscriptions(.*) /index.php?subscriptions=1 [QSA]
RewriteRule ^view.php(.*) /index.php?m=000000 [QSA]

The first one makes “http://yourblog.com/subscriptions/” the url for your subscriptions page, and the second one prevents nosy people from accessing the view.php page directly, so you can be sure no one can mess around.

If you use the above instructions, and the code, please do let me know at mail @ carthik REMOVE THIS. net . I will be glad to hear from you.
I know this is no where near perfect, ’cause this is the first time I am attempting anything of this kind, so please tell me whatever you think about it, including suggestions for improving how it works/ feedback etc. Leave me comment on this post, or send me an email.

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

22 Responses to FOF powered subscriptions page hack

  1. Pingback: Uberwald

  2. Laurenz says:

    I installed your aggregator in order to display some RSS-feeds from Yahoo-groups I own on my weblog. However, obviously, the validator expects an e-mail address which Yahoo does not provide (presumably to prevent SPAM and harassment): “author must include an email address”.
    Is there any way around this?
    Also, is it necessary to put the code in index.php or could I also create a special subscriptions.php with your code?
    Thanks!

    Laurenz

  3. Pingback: Lakers部落手記 » Blog聯播網 (RSS Agrregate)

  4. Pingback: swimmingllama.com » Friday!

  5. Pingback: Karen Mark & James » feedonfeeds-0.1.7 with WP

  6. Pingback: Karen Mark & James » feedonfeeds-0.1.7 with WP

  7. Knight says:

    i did some modify on the display part, hope you dun mind,
    now it will display the subscribe list on the left block
    example http://knight.surf.net.my/

  8. I incorporated your script into my site’s home page. And I’ve got a question. Will these feeds be updated automatically or do I have to update them manualy?
    Thanks!

  9. Carthik says:

    Peter, You will have to schedule the update script to run regularly. You can use cron to do so. Please refer to the installation guide for FOF which details how to do this.

  10. Vitaliy says:

    That seems neat, I dont really have any use for it. I just got a little app letting me know who and when updated and that is as much as I need. :)

  11. Carthik says:

    Interesting. What app do you use?
    I am too used to my LJ friends page…and too lazy to click too much, I guess :)

  12. Vitaliy says:

    I am on Linux, I use this program called Liferea.

  13. gat says:

    hea! that’s great mate ;) thanks alot :)

  14. skippy says:

    Great write-up, Carthik! Thanks for sharing.

  15. Harish says:

    :mrgreen: :mrgreen::mrgreen:
    Too much tech stuff that I cannot in years understand,but just wanted to tell you i was thinking of you ,drop a mail sometime..just could’nt catch you newhere else……love,harish

  16. Pingback: FrankPereiro

  17. Carthik says:

    Your pingback did arrive, and its listed above :)

  18. ThunderByrd says:

    Argh! I can’t get to your subscription page… the page returns a database error.

    Also, does this hack work with WP 1.2?

    Keep up the great work! Props!

  19. ThunderByrd says:

    I can’t win. Your subscription link doesn’t work, and I typed in my (new) website address wrong. And I don’t see the message I posted either. Moderation?

    Anyway, cheers! :lol:

  20. Pingback: Visual Grammar » RSS Feeds

  21. Pingback: Notes »

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>