Monday, February 9, 2009

Wordpress 2.7 Members Only plugin FeedKey Fix

After upgrading from Wordpress 2.6 to 2.7, the Feed Key feature of the Members Only plugin I use at another blog was not working. Members Only is a WordPress plugin that requires users to login to your blog in order to read/write. In addition, you can protect your RSS feed as a unique URL is generated for each user.

Every user was getting the following error:
Feed Key is Invalid
The Feed Key you used is invalid. It is either incorrect or has been revoked. Please login to obtain a valid Feed Key.
The feed URL in the version of Members Only that worked with 2.6 changed during the upgrade to 2.7, so a simple URL change solved the problem. I attempted to contact the plugin's author Andrew Hamilton and sent him the updated files, but I have not heard anything from him, so I am posting here for those who can use it.

Along the way, the need arose for a comment feed, so I modified the existing plugin and added the URL needed for the comment feed. This change was also submitted to Andrew.

Right click and download the updated file here. Once downloaded, replace the members-only.php file in your existing installation (~/wp-content/plugins/members-only/).

If you have any questions / comments... let me know!

Updated: URL was fixed.


Tom said...

I tried it and got error

Fatal error: Call to undefined function: register_activation_hook() in /homepages/4/d117277271/htdocs/ on line 17

Hans said...

Right click on the file to download it to your desktop, you must have left clicked to run. The file is a php file.

Hans said...

I noticed while looking at the code that I did not update the version number that is recorded in Wordpress for the plugin. I have since updated it to record as the version with my changes.

j said...


The file is still running through PHP software... even if you right click to download it, the server is going to process it and return the output, not the source itself.

You have to upload a zip or rename it to .txt in order for users to be able to get to the source.

I look forward to looking at your solution.

Hans said...

Sorry about that, stupid error on my part, the links have been updated in the post.

deKay said...

Thanks for trying, but I still get the Feed Key is Invalid error :(

Hans said...

My guess is that you are getting the following error "The Feed Key you used is invalid. It is either incorrect or has been revoked." Please try the following:

Log in and "Reset Key" in your profile.

Enter the Feed URL's on that same page once they have been reset into google reader or your favorite RSS reader. They should look something like

If you do not use the feed key URLs that look like the ones above then you will get a "No Feed Key Found... Please login to obtain yours.".

deKay said...

I did all that, but no go. However, it suddenly started working this afternoon!

Thanks for making this work. Shame the author hasn't officially added it :(

Hans said...

My guess is that something was cached in your RSS reader.

Mingo said...

Another wee fix for Members Only, perhaps I think we should keep the alt version of Members Only in one place until Andrew gets back to it.

When you select to have people go to the "Front Page" when they log in directly from the Login page, they are directed to http://blogurl/wordpress

People (like me) who have moved their front page outside of the /wordpress/ dir receive a 404 error.

Line 495 of the plugin reads:

$redirect_to = get_option('siteurl');

And should be changed to:

$redirect_to = get_option('home');

Which fixes this problem. I've changed it in my own installation, but I thought you might make the change to the plugin you keep here.


Hans said...

Mingo, I have added your change, tested it with 2.7 and posted it. I will be posting any additional changes to the following label.

Freaky Deaky said...

I tried the feedkey fix and got the following error:

Fatal error: Call to undefined function members_only_gen_feedkey() in /home/abc3xxxx/public_html/wp-content/plugins/feed-key.php on line 258

Hans said...

Freaky Deaky,

I have posted an updated version for feed-key here:

Freaky Deaky said...

Thank you very much! The update solved my problem.

Allen said...


Nik said...

Hi everyone!

A few days ago I installed the "Members Only" plugin and soon discovered that if someone tried to subscribe to my feed, they got the message "No Feed Key Found."

This message continues to appear even after I deactivated and uninstalled the thing.

I'd like everyone to have open access to my feeds again.

Your help will be incredibly appreciated as I am preparing for an official launch, like, today!

Hope to hear from you soon, folks!

Hans said...

Nik, under users, do you see a User's Feed Key section? If so, you may not have disabled things. Install the plugin again and then go to https://yourdomain/wp-admin/options-general.php?page=members-only.php and then scroll to the bottom. Under "Feed Access Options" turn the option "Feed Access" to "Open Feeds", and then try disabling and uninstalling the plugin.

Nik said...

Many thanks for the quick reply, Hans!

Installing & uninstalling didn't work. I never even tried protecting my feeds in the first place. Just used the plugin to redirect visitors to an "under construction" page while I was working on the site.

Gosh, this sucks so much. Now nobody can subscribe to my RSS feed . . .

Any suggestions? I don't feel like reinstalling WordPress and rebuilding my site from scratch.

Nik said...

Good news, Hans -- the ominous "No Feed Key Found" Feedburner message went away as soon as I published my first post so now RSS subscription is back in action!

Ian said...

In the absence of Andrew Hamilton providing any contact for this plugin (and for feedkeys) do you know if it is possible to get hold of the feed URL. I want to change the Entries RSS link in the meta block to use the feedkeey based URL I also want to use the URL in and don't and to have to make a call to the database *per post* to get user ID and then get the corresponding feed key out of the usermeta table so that I can work out the feed URL. Also in firefox the system offers an RSS link in the title bar which shows http://siteurl/feed http://siteurl/feed/rss and http://siteurl/feed/atom is there a way of providing only feedkey based methods ?

Ian T (n03lm on

Hans said...

Ian, I am not sure as I have only looked into the fixes that I needed, I will take a look to see if these things are possible or not, and get back to you in a few days.


Ian said...


Various things. Firstly I've decided not to use subscribe remind but to create a one off page (with custom template) that contains the code
<?php get_currentuserinfo();
if ($members_only_opt ['feed_access'] == 'feedkeys') //Check if Feed Keys are being used
$feedkey = get_usermeta($current_user->ID,'feed_key');
$permalink_structure = get_option(permalink_structure);

//Check if Permalinks are being used
// HM: modified for v2.7
//empty($permalink_structure) ? $feedjoin = '?feed=rss2&feedkey=' : $feedjoin = '/wp-feed.php?feedkey=';
empty($permalink_structure) ? $feedjoin = '/index.php/feed/?feedkey=' : $feedjoin = '/feed/?feedkey=';

$feedurl = $blogurl.$feedjoin.$feedkey;
$feedurl = '<a href="'.$feedurl.'">'.$feedurl.'</a>';
<p><?php echo empty($feedkey) ? _e('URL is available once Feed Key has been generated.') : _e($feedurl); ?>
to provide the User with their feedkey'd URL in an easier format.

Second - and more important for you I think the line empty($permalink_structure) ? $feedjoin = '/feed/?feedkey=' : $feedjoin = '/index.php/feed/?feedkey='; appears to be the wrong way round in your code (i've swapped it in the above code snippet).

I say this becasue if permalinks are empy then you want to use an index.php based URL and if they are full then you don't, which is not what the code you have in line 137 and 143 (or there abouts) in your updated for 2.7 version of the plugin.



Scarla said...

Thanks so much Hans. You are appreciated.

Paul Stead said...


Thanks just what i was looking for


Bruce Lewin said...

The php file is not avaliable? seems to be down at the moment?

I'll try again in a bit but any chance of a repost or onto another site?

Thanks btw!

Bruce Lewin said...

Just got the download down!

Bruno said...

All working fine here on WP 2.71 (on a test site), so thanks for the good work. Just the 1 remark: if all u want to do is allow "chosen" people to read ur blog, then why give them access to the admin page, even if they're only subscriber? Shouldn't the role/permissions of a "chosen" reader and that of a subscriber be entirely different?