RSS Feed just for Supporter Blogs

I am looking for ways to convert more of our blogs to supporter.

I would like to setup an RSS feed just for supporter blogs so we can promote just those blogs on our front page and throughout our distribution channels. You guys have any suggestions?

  • DavidM
    • DEV MAN’s Mascot

    Hi Rich,

    You could modify the Recent Global Posts Feed plugin to only included Supporter posts.

    It's a bit tricky, but it can be done. Alternatively you could modify Post Indexer to only index Supporter blogs, which could be tricky as well.

    The is_supporter() check couldn't be used in these instances, thus they're a bit tricky.

    I'll ask a few of the other guys around here if they've got any other ideas on that too.

    Cheers,
    David

  • Mason
    • DEV MAN’s Sidekick

    Ah, we can do this much more easily with a simple function to block RSS feeds for non-supporters.

    Drop this in a new file, name it supporter-rss.php and put that in your mu-plugins folder. Should do the trick:

    <?php
    /*
    Plugin Name: Supporter (Feature: Disable RSS Feeds)
    */
    
    function mj_supporter_disable_feed() {
    if (!is_supporter()) {
    	wp_die( __('No feed available. Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
    	}
    }
    
    add_action('do_feed', 'mj_supporter_disable_feed', 1);
    add_action('do_feed_rdf', 'mj_supporter_disable_feed', 1);
    add_action('do_feed_rss', 'mj_supporter_disable_feed', 1);
    add_action('do_feed_rss2', 'mj_supporter_disable_feed', 1);
    add_action('do_feed_atom', 'mj_supporter_disable_feed', 1);
    
    ?>

    Let us know if it does the trick for ya.

  • Rich
    • Design Lord, Child of Thor

    I think David's solution is more of what we're after. We don't want to stop non-supporter blogs from having an RSS Feed, we just want to promote the supporter blogs in a global RSS feed.

    Now, I guess my question would be:

    Would it be better to edit Post Indexer to only pull in supporter blogs?

    OR

    Have Post Indexer pull them all in and have Recent Global Posts Feed strip out all non-supporter blogs?

    Which would be less database query heavy and how would I do it?

  • Rich
    • Design Lord, Child of Thor

    Actually, I would need to to it in Post Indexer because we want to display only Supporter Blogs on our front page and RSS feed, so editing it at the source would be better.

    Now onto the question, how do I do that? Is there a supporter table that I can check?

  • Philip John
    • DEV MAN’s Apprentice

    Hiya,

    Sorry for the delay here - looks like our notifications must have stopped.

    I'd recommend you modify Post Indexer to do this. You'd basically just need to wrap everything within the post_indexer_post_insert_update() function inside an IF like so;

    function post_indexer_post_insert_update($tmp_post_ID){
        if (is_supporter()){
        ... function code ...
        }
    }

    I haven't tested that and it might not be that simple so you'll have to do some testing!

    Phil

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.