Skip to content

Instantly share code, notes, and snippets.

@richlloydmiles
Created February 3, 2017 12:50
Show Gist options
  • Save richlloydmiles/0e77c14d39480baa0897ce8904a90b53 to your computer and use it in GitHub Desktop.
Save richlloydmiles/0e77c14d39480baa0897ce8904a90b53 to your computer and use it in GitHub Desktop.
$new_group = new BP_Groups_Group;
$new_group->creator_id = 1;
$new_group->name = 'test';
$new_group->slug = 'test';
$new_group->description = 'nothing';
$new_group->news = 'whatever';
$new_group->status = 'public';
$new_group->is_invitation_only = 1;
$new_group->enable_wire = 1;
$new_group->enable_forum = 1;
$new_group->enable_photos = 1;
$new_group->photos_admin_only = 1;
$new_group->date_created = current_time('mysql');
$new_group->total_member_count = 1;
$new_group->avatar_thumb = 'some kind of path';
$new_group->avatar_full = 'some kind of path';
$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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment