Hi @plumis-
A group will always have an admin (the person who created it), so I’m not sure about your criteria for deletion, but deleting groups is straightforward. You’re going to need to add some cron jobs that run every fifteen minutes, then find the groups your want to delete (based on your criteria). Something like this:
// Get recently created groups:
$groups = groups_get_groups();
foreach ($groups as $group) {
// Delete groups with only one member.
$members = groups_get_group_members( array( 'exclude_admins_mods' ) );
if ( 1 == $members['count'] ) {
groups_delete_group( $group->id );
}
}
You’ll have to figure some things out, like how to schedule run the routine via cronjob (check out this plugin https://wordpress.org/plugins/wp-crontrol/), and also what your criteria will be. bp-groups-functions.php
has many helpful functions in it that you could use.