0

We have a website with a members only content in the form of a forum.

I have already created the RSS feed and I can see that when I load the feed URL in a web browser that it is working. The problem is that I can only see it when I am logged into the website itself, and therefore when I load it into my web based reader, or Microsoft Outlooks RSS feed; that it can not see any posts.

The views screenshot I used is below:

Drupal Views creating an RSS

Does the fact that a user needs to be logged into the website to view the content prevent me from doing this?

EDIT: I have been editing drupal/modules/system/system.api.php to include suggestions below including changing 'forum/%forum_forum' for the explicit 'forum/rss.xml' - it loads the xml but with no content when I am not logged into the website itself.

EDIT 24/09: After a bit of a break I have come back to this one for a fresh look.

I installed Custom Menu Permissions as advised, found the forums/rss.xml and forums/%forums_forum/rss.xml and allocated them to a custom permission which I then allowed for both Anonymous and Authenticated users.

I flushed all the caches and tries while logged off. Still nothing.

I can see the rss feed still while logged in, so I know it is there. That would discount anything stopping it being produced.

I also ensured that I had removed my custom hook_alter code as suggested below to ensure there were no conflicts.

Any further assistance to the right direction would be appreciated....

1 Answer 1

0

Yes. The forum/%forum_forum route created by the Forum module does a user_access() check for the access content permission; any subpath of this route (e.g. your RSS view, forum/%forum_forum/rss.xml) will be checked as well.

You can override this via a hook_menu_alter() implementation:

/**
 * Implements hook_menu_alter().
 */
function MYMODULE_menu_alter(&$items) {
  $items['forum/%forum_forum']['access callback'] = 'MYMODULE_forum_override';
}

function MYMODULE_forum_override() {
  return preg_match('/^forum\/(\d+)\/rss.xml$/', request_path());
}
7
  • Thank you for your answer Shawn, but I am confused. Reading the implementation makes it look like all elements of the forum path will be overriden - ie everything will be exposed, rather than just the rss feed ? Commented Aug 4, 2016 at 0:46
  • That's a crude example to demonstrate the fix. If you want to fix the problem and keep your content protected, you'll need to build the details into your access callback (e.g. check the requested path matches forum/%forum_forum/rss.xml).
    – Shawn Conn
    Commented Aug 4, 2016 at 0:52
  • Ahh I see, sorry I was confusing myself between the level of drill down and how far I could take it. Thank you for your help I will seen what I can come up with. Commented Aug 4, 2016 at 0:56
  • Sure thing. Fill free to edit my answer with your actual solution if you go the module route.
    – Shawn Conn
    Commented Aug 4, 2016 at 1:11
  • Yes, altering system.api.php is known as "hacking core" and can cause problems with upgrading (see link). In the example, the MYMODULE_forum_override() function should be the only place you need to override the logic to show/hide the path (e.g. returning TRUE when request_path() matches your feed path).
    – Shawn Conn
    Commented Aug 5, 2016 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.