Hiding "Test" products from template blogs in marketplace

Hi,

On my multisite i have installed a blog, which im using as blog template for new blogs.

In this blog i have some “Test” products, which is showing up on the marketplace.

I want to know if there is a way to hide these product. Hide products from blogs used for template, or maybe just hide products, which contain the word “Test”.

Could this be possible?

Best regards,

  • Panos
    • SLS

    Hi Mikkel ,

    In case you don’t want this blog to be accessible, you try setting that blog as “Archived” from your site.com/wp-admin/network/sites.php.

    If you don’t want to archive the blog, you can use following snippet in a mu-plugin:

    add_action( 'admin_init', function(){

    $blog_id = 25;

    if( is_integer( $blog_id ) ){

    global $wpdb;

    $global_products_table = "{$wpdb->base_prefix}mp_products";

    $wpdb->update( $global_products_table,
    array(
    'blog_public' => 0
    ),
    array(
    'blog_id' => $blog_id
    ),
    array( '%d' ),
    array( '%d' )
    );

    }

    }, 10 );

    Replace

    $blog_id = 25;

    accordingly and then simply refresh an admin page. You can comment this sipped out, as at this point the blog products won’t be public.

    Final option is to edit file wp-content/plugins/marketpress/includes/multisite/template-functions.php by adding a new line with

    $where .= " AND blog_id <> 50";

    just after th line that contains

    $where = " WHERE post_status = 'publish' AND blog_public = 1";

    about line 222, so it should look like:

    `$where = ” WHERE post_status = ‘publish’ AND blog_public = 1″;

    $where .= ” AND blog_id <> 50″;

    Hope this helps!

  • Mikkel
    • WP Core Meltdown

    Hi again,

    I just tried to archive the template site, and now the products dont show up on marketplace anymore, so thats good.

    Also im still able to change the template site, so everything just running perfectly.

    Thank you!

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.