[Recent Global Posts Feed] Private posts appear in Recent Global Posts Feed

I'm looking to replace a (now abandoned) plugin I've been using to display public posts from across my multisite network.
I set up the Recent Global Posts Feed, but I'm finding that posts from private blogs are appearing in the feed. The "usage" section of the Recent Global Posts Feed webpage (https://premium.wpmudev.org/project/recent-global-posts-feed/) says "The Recent Global Posts Feed is for public posts only. Posts from privates sites don’t appear in the feed.".
Since I am seeing posts from private sites in my feed, I'm wondering if I set it up incorrectly.
Any suggestions?

Cheers,
Stephanie

  • Ash

    Hello dmpress

    Maybe those sites are indexed before they mark them private. When you say private, you mean discouraging search engine to track, right?

    Once the posts are indexed using post indexer plugin, the Global Post feed can't filter from there.

    For now, please go to /wp-content/plugins/recent-global-posts-feed/global-posts-feed.php line no 94 and just after

    <?php while ( network_have_posts() ) : network_the_post(); ?>

    add the following:

    <?php
    	$post = network_get_post();
    	switch_to_blog( $post->BLOG_ID );
    	$public = get_option( 'blog_public' );
    	restore_current_blog();
    
    	if( ! $public ) continue;
    ?>

    Please note that, this change will be lost when you will update the plugin. So, please note down the changes and apply again once you update the plugin. Have a nice day!

    Cheers,
    Ash

  • dmpress

    Hi Ash,

    Thank you for your reply. In my latest test scenario, the blog is set to only permit registered users (and has been for some time). I added a new post to this blog, and it then appeared in the feed.

    I would assume that because the blog was private at the time the post was made, it shouldn't appear in the feed.

    Thank you for suggesting the change in the code to the plugin - unfortunately, it isn't feasible for us to add extra code that could be overwritten by an update. We've done this in the past, and are now transitioning away from this kind of ad-hoc code patching.

    If the plugin is advertised as only pulling content from public blogs, it should work that way by default.

  • Ash

    Hello dmpress

    the blog is set to only permit registered users (and has been for some time).

    Would you please post a screenshot of the above part? I am not quite clear about how you make the site private. Is it by using another plugin?

    If the plugin is advertised as only pulling content from public blogs, it should work that way by default.

    I do agree with you. I will mark it as a bug and report to the developer. But please, let me understand the private status of your subsite. I will try to do the best for you :slight_smile:

    Have a nice day!

    Cheers,
    Ash

  • dmpress

    Hi Ash,

    Thank you for the speedy replies!

    Yes, we have the WPMU Dev Multisite Privacy plugin installed (https://premium.wpmudev.org/project/sitewide-privacy-options-for-wordpress-mu/) to provide some additional privacy settings. Since we are an educational institution, many of our sites are private, so we rely quite heavily on this plugin.

    Here is a screenshot of the blog in question:

    Cheers,
    Stephanie

  • Ash

    Hello dmpress

    To make compatible with the option you selected, please use the following code as modification instead of what I gave first:

    <?php
    					$post = network_get_post();
    					switch_to_blog( $post->BLOG_ID );
    					$public = get_option( 'blog_public' );
    					restore_current_blog();
    
    					if( $public != 1 ) continue;
    				?>

    Also, I am reporting this to the developer, so he can work on this. Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.