The module is effectively blocking access to rss.xml, which is great -- thanks very much for that.

What it's not doing is removing the "<link...>" tag from <head> via the rss_permissions_preprocess_page function. I tried using exactly the same code from the module in my theme's preprocess_page function and it didn't work there, either. I also tried removing the conditions around the replacement, and that also didn't work.

The problem isn't with the code in the function: at the top of the preprocess function I can echo $vars['head'] and <link> is there, then run your preg_replace and remove it, then echo $vars['head'] again and it's gone. However, when the page template is called, it's back.

It seems like the <head> is being rebuilt after the preprocessing, or something like that. The only way I've managed to successfully remove it is to include the replacement right in page.tpl.php:

$head = preg_replace('/<link rel="alternate" type="application\/rss\+xml" title=".*?" href=".*?" \/>/', '', $head);

Any idea why it's not working from the module's preprocess_page function?

Comments

phpdiva’s picture

I haven't encountered this before, but you're right - it sounds like the $head variable is being rebuilt somehow. Maybe one of the custom modules or themes is doing something?
You can disable all the custom themes and modules you have running, and see if the issue is still happening. If not, enable the modules / themes one at a time, and you can find which one is causing it.

Let me know if you're able to pinpoint the issue.

kkkatsumoto’s picture

I thought I'm in the same situation however it was only visible when I was logged in from main account which is by default something more than admin. Check back as anonymous user or logged in by normal user. It works for me fine.

noah’s picture

Status: Active » Closed (fixed)

Confirmed -- the link only appears when logged in. Not sure how I didn't notice this before.

Thanks again for a very useful module, and thanks kkkatsumoto for the info.

phpdiva’s picture

Ah cool, thanks, kkkatsumoto!

daniel wentsch’s picture

I'm still experiencing this problem, with both, 6.x-1.1 and the latest dev. Permissions are being set correctly but the link still appears inside the head, thus generating a 404. Cleared caches 10 times, logged in as different roles as well as an anonymous user – always the same result.
I'm trying to diable taxonomy feeds only, but I also tried disabling all feeds. The head links simply stay there :(

noah’s picture

I was able to solve this issue by manually increasing the weight of this module in the system table. The weight was originally 0, and the link still appeared in the header. I increased it to 99, and the link went away. Presumably this works because something with a weight of more than 0 was running after the RSS Permissions module and restoring the link.

morrisjones’s picture

Not logged in, weight increased manually, still getting the link "alternate" in the head. The link returns access denied, but still ...

sillygwailo’s picture

Issue summary: View changes
Status: Closed (fixed) » Active
sillygwailo’s picture

I committed a change to the dev branch which increases the weight of the module and changes slightly how the regular expression works. It checks for the URL in question and removes the <link> element specific to the URL. I only gave it a weight of 15 but could be convinced to go higher.

To compare the module's weight to others (this might be a good time to backup your database in case something goes wrong):

SELECT name, weight FROM system WHERE weight > 0;

If 15 doesn't work for you (see below), I'd be interested to know which modules you have that have a bigger weight than 15.

To change the weight of the RSS Permissions module:

UPDATE system SET weight = 15 WHERE name = 'rss_permissions' AND type = 'module';

Change 15 to whatever number works for you.