- $group->nickname = $nickname;
- $group->fullname = $fullname;
- $group->homepage = $homepage;
- $group->description = $description;
- $group->location = $location;
- $group->uri = $uri;
- $group->mainpage = $mainpage;
- $group->created = common_sql_now();
+ // We must create a new, incrementally assigned profile_id
+ $profile = new Profile();
+ $profile->nickname = $nickname;
+ $profile->fullname = $fullname;
+ $profile->profileurl = $mainpage;
+ $profile->homepage = $homepage;
+ $profile->bio = $description;
+ $profile->location = $location;
+ $profile->created = common_sql_now();
+
+ $group->nickname = $profile->nickname;
+ $group->fullname = $profile->fullname;
+ $group->homepage = $profile->homepage;
+ $group->description = $profile->bio;
+ $group->location = $profile->location;
+ $group->mainpage = $profile->profileurl;
+ $group->created = $profile->created;
+
+ $profile->query('BEGIN');
+ $id = $profile->insert();
+ if ($id === false) {
+ $profile->query('ROLLBACK');
+ throw new ServerException(_('Profile insertion failed'));
+ }
+
+ $group->profile_id = $id;
+ $group->uri = $uri;