-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pman.php
59 lines (37 loc) · 1.38 KB
/
Pman.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
* this is loaded by the pman admin..
*
* it checks that required variables are set...
*
*/
class Pman_Core_Pman {
function init ($pg)
{
$group = DB_DataObject::factory('core_group');
// group should be auto created - by update-database...
if(!$group->get('name', 'core-person-signup-bcc')){
$group = DB_DataObject::factory('core_group');
$group->name = 'core-person-signup-bcc';
$group->insert();
}
$p = DB_DataObject::factory('core_person');
if (!$p->count()) {
return; // can not check people...
}
// got people...
$member = DB_DataObject::factory('core_group_member');
$member->group_id = $group->id;
if ($member->count()) {
return;
}
// not got members..
// 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('core_group_member');
$member->group_id = $group->id;
$member->user_id = $p->id;
$member->insert();
// only display if we have members..
}
}