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.

Other Articles on this Subject:

22 Responses to “FOF powered subscriptions page hack”

  1. April 9th, 2004 | 5:49 pm

    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. :)

  2. April 9th, 2004 | 5:50 pm

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

  3. April 9th, 2004 | 6:12 pm

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

  4. gat
    April 9th, 2004 | 6:29 pm

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

  5. April 9th, 2004 | 9:11 pm

    Great write-up, Carthik! Thanks for sharing.

  6. Harish
    April 12th, 2004 | 4:50 am

    :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

  7. April 13th, 2004 | 5:06 pm

    […] es una traducción de otro que escribió carthik.net titulado originalmente ”FOF powered subscriptions page hack” . Sin embargo, el padre […]

  8. April 14th, 2004 | 9:04 am

    Your pingback did arrive, and its listed above :)

  9. May 27th, 2004 | 1:34 am

    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!

  10. May 27th, 2004 | 1:37 am

    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:

  11. May 27th, 2004 | 9:26 am

    […] st-Not-Be-Named @ 1:26 pm This is a trial for using the RSS feeds that is posted on Cathik’s site. A real gem, these bloggers really are the peo […]

  12. May 28th, 2004 | 7:25 pm

    […] subscription page where my xml subscriptions are displayed. The idea and the code came fromCarthik. (The instructions weren’t especially clear, but I fi […]

  13. June 4th, 2004 | 4:46 pm

    […] rel=”bookmark” title=”Permanent Link: friends page”> 2004/06/04 @ 12:38 pm carthik.net had a great little hack to behave like an LJ “Fri […]

  14. June 20th, 2004 | 8:25 am

    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

  15. July 27th, 2004 | 8:48 am
  16. August 23rd, 2004 | 2:16 pm

    […] 是研究了半天不知道他是怎麼做成的。在wordpress的網站上,找到一篇C A R T H I K . N E T: FOF powered subscriptions page hack,是用 […]

  17. September 26th, 2004 | 3:30 pm

    […] is working using FOF (Feed on Feeds). In about 30 mins I had tis up and running. Thanks to Carthik for getting the explanations on how to get this working. I […]

  18. September 26th, 2004 | 3:30 pm

    […] is working using FOF (Feed on Feeds). In about 30 mins I had tis up and running. Thanks to Carthik for getting the explanations on how to get this working. I […]

  19. October 5th, 2004 | 11:40 pm

    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/

  20. October 8th, 2004 | 3:19 pm

    […] e. Found a pretty slick way to incorporate RSS feeds onto a WordPress run site. Here are instructions for setting up a hack using Feed on Feeds, a web base […]

  21. November 29th, 2004 | 2:26 am

    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!

  22. November 29th, 2004 | 10:56 am

    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.

Leave a reply