Created
May 25, 2012 22:44
-
-
Save sbrajesh/2790977 to your computer and use it in GitHub Desktop.
Remove the blogs from Blog Dir list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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