Skip to content

Instantly share code, notes, and snippets.

@sbrajesh
Created May 25, 2012 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbrajesh/2790977 to your computer and use it in GitHub Desktop.
Save sbrajesh/2790977 to your computer and use it in GitHub Desktop.
Remove the blogs from Blog Dir list
<?php
add_action('bp_blogs_get_blogs','bpdev_exclude_blogs',20,2);
function bpdev_exclude_blogs($blogs_details=false,$params){
//list of users to exclude
$blogs=array();
$excluded_blogs=array(1,3);//comma separated ids of blogs whom you want to exclude
$selected_blogs=$blogs_details['blogs'];
$count=$blogs_details['total'];
//find and remove
$blogs_count=count($selected_blogs );
for($i=0;$i<$blogs_count;$i++){
if(in_array($selected_blogs[$i]->blog_id,$excluded_blogs )){
$count--;
continue;
}
//otherwise
$blogs[]=$selected_blogs[$i];
}
return array('blogs'=>$blogs,'total'=>$count);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment