Exclude certain blogs from widgets?

Hi there,
I'd like to exclude a couple of blogs from the widget (my main blog for instance); How can I do that? My former webmaster found me a hack on a previous version of the plugin but I can't replicate it on the new version...
Thanks!

  • Sue

    Hi Yagg

    You can do this by opening up widget-recent-global-posts.php using a text editing program like EditPlus and Change line 97 in widget-recent-global-posts.php
    as follows:

    $query = "SELECT * FROM " . $wpdb->base_prefix . "site_posts WHERE blog_public NOT IN('1', '2', '3') AND post_type ='" . $recentglobalpoststype . "' ORDER BY post_published_stamp DESC LIMIT " . $recentglobalpostsnumber;

    This example, will exclude blog ID 1, 2 and 3. Provided the main blog is blog ID 1 it will be excluded.

    You check the blog ID by going to Sites > All Sites and hovering the mouse over the blog domain. The blog ID information will be displayed in the status bar at the bottom of your web browser.

    I've added a screenshot of how to find the blog ID if you haven't done that before.

    Save your amended widget-recent-global-posts.php and use this file when you upload widget-recent-global-posts directory to wp-content/plugins/

    If you are new to editing php files refer to the installation instructions for Recent Post Widgets. It demonstrates how to edit widget-recent-global-posts.php using EditPlus to enable the widget to be used on all sites on your network:

    Hope this information has helped and please let us know if you need further assistance!

    Thanks!

    Sue Waters
    WPMU DEV Support

  • Sue

    Hi Yagg

    Definitely not a pain in the neck. It was working on my install when I tested it but the code isn't quite correct. I've got one of our developers to double check it, then adjusted the code and have retested.

    Can you try this code:

    $query = "SELECT * FROM " . $wpdb->base_prefix . "site_posts WHERE blog_public = '1' AND blog_id NOT IN('1', '2', '3') AND post_type ='" . $recentglobalpoststype . "' ORDER BY post_published_stamp DESC LIMIT " . $recentglobalpostsnumber;

    Thanks!

    Sue Waters
    WPMU DEV Support