function init ($pg)
{
- if(!empty($_REQUEST['_core_skip_check'])){
- return;
- }
+
$group = DB_DataObject::factory('groups');
// group should be auto created - by update-database...
+
if(!$group->get('name', 'core-person-signup-bcc')){
- die("group core-person-signup-bcc does not exist : add ?_core_skip_check=1 to bypass this check");
+ $group = DB_DataObject::factory('groups');
+ $group->name = 'core-person-signup-bcc';
+ $group->insert();
}
$p = DB_DataObject::factory('Person');
+ if (!$p->count()) {
+ return; // can not check people...
+ }
+ // got people...
+
$member = DB_DataObject::factory('group_members');
// not got members..
- // if we only have one member - then add it .... (it's the admin, and they can modify this later..)
+ // if we only have one member - then add it .... (it's the admin, and they can modify this later.. - after they get annoyed with it..
+ $p->find(true);
+ $member = DB_DataObject::factory('group_members');
+ $member->group_id = $group->id;
+ $member->user_id = $p->id;
+ $member->insert();
- // only display if we have members..
- if($p->count() && !$member->count()){
- die("group core-person-signup-bcc does not have any members : add ?_core_skip_check=1 to bypass this check");
- }
+ // only display if we have members..
+
}