Reply To: [RESOLVED] Programmatically creating a group
I figured it out by going through a plugin that creates groups. The bottom part of the above code can be replaced with:
$saved = $new_group -> save();
if ( $saved )
{
$id = $new_group->id;
groups_update_groupmeta( $id, 'total_member_count', 1 );
groups_update_groupmeta( $id, 'last_activity', time() );
groups_update_groupmeta( $id, 'theme’, ‘buddypress' );
groups_update_groupmeta( $id, 'stylesheet’, ‘buddypress' );
} else {
return false;
}