• Hi,

    I’m trying to add a layer of security check (session check) around the RSS feeds. I want the feeds to be sent out only if a certain condition evaluates to True. e.g

    if( isset($_SESSION[‘site_uid’]) {
    /* Behave normally */
    } else {
    header(‘Location: ‘.$site_login_url);
    exit;
    }

    Is there a central location (single file/function) where I can add this? If not, what are the locations at which I should be adding this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Add this to any plugin or your theme’s functions.php

    function central_feed_location() {
      // <-- set $site_login_url here
      if( is_feed() && !isset($_SESSION['site_uid'] ) {
        header('Location: '.$site_login_url);
        die();
      }
    }
    add_action('init','central_feed_location');

    As you may know, the header() PHP function must run before anything is output.

    Thread Starter csgp_1412

    (@csgp_1412)

    No luck ??

    Are two words all you can tell me after I try to help you out? Okay here’s two words for you too: Best wishes.

    Thread Starter csgp_1412

    (@csgp_1412)

    Well. Thanks for the help, but it didn’t work.
    Economy of Expression! So, used just two words ??

    Anyways, tried a different method (definitely not very good) so that’s working for now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Central feed location?’ is closed to new replies.