Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

Hide a blog in blogs lists (2 posts)

Started 1 year, 5 months ago by: Alberto

  • Profile picture of Alberto Alberto said 1 year, 5 months ago:

    Hi!
    I’ve installed a multisite wordpress with buddypress. One of these blogs will be a store.
    Is there any plugin or hack to hide this blog in every page that blogs are listed?

    Regards

  • Profile picture of Alberto Alberto said 1 year, 5 months ago:

    I’m trying to do something like this but only works with no ajax:

    function valid_blog($blog_name) {
    	$blacklist = array ('blog1', 'blog2', 'blog3');
    	if (in_array(strtolower($blog_name), $blacklist)) {
    		return false;
    	}else{
    		return true;
    	}
    }
    
    function remove_invalid_blogs_from_loop($b, $blogs) {
    	$blogs_new = array();
    	foreach ($blogs->blogs as $key => $blog) {
    	    if (valid_book($blog->name)) {
    		array_push($blogs_new, $blog);
    	    }else{
    	        $blogs->blog_count = $blogs->blog_count-1;
    	        $blogs->total_blog_count = $blogs->total_blog_count-1;
    	        $blogs->pag_num = $blogs->pag_num-1;
    	    }
    	}
    	$blogs->blogs = $blogs_new;
    	return $blogs;
    }
    
    add_action('bp_has_blogs','remove_invalid_blogs_from_loop', 10, 2 );

    Any idea of what is the best way to do this?