Re: Hide a blog in blogs lists
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?