@alexlii Hi Alex, you can use the bpgsites_get_all_possible_groupsites filter to modify the list of sites that are available. For example:
add_filter( 'bpgsites_get_all_possible_groupsites', 'my_sites_filter' );
function my_sites_filter( $sites ) {
$disallowed_sites = array( 23, 42, 72 ); // how you build this list is up to you
$allowed_sites = array();
foreach( $sites AS $site_id ) {
if ( in_array( $site_id, $disallowed_sites ) ) {
continue;
}
$allowed_sites[] = $site_id;
}
return $allowed_sites;
}
Obviously you can be more sophisticated about the source of the site IDs and the checks that you make, or you could reverse the logic and include only specific blogs rather than excluding specific ones. I hope the above gets you going in the right direction.
Cheers, Christian
Hello Christin,
Thanks so much! I see!
Should I add those code into plugin of bp-group-sites, or into WordPress config file? Thanks in advance!
Alex
You can add this code to a custom plugin or your (child) theme’s ‘functions.php’ file.
https://codex.wordpress.org/Functions_File_Explained
Cheers, Christian
thanks Chritian,I will try!
Alex