summaryrefslogtreecommitdiff
path: root/modules/user/helpers/group.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/helpers/group.php')
-rw-r--r--modules/user/helpers/group.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php
index 95daa767..84272b79 100644
--- a/modules/user/helpers/group.php
+++ b/modules/user/helpers/group.php
@@ -38,6 +38,10 @@ class group_Core {
$group->name = $name;
$group->save();
+
+ // Create the view column for this group in the items table.
+ Database::instance()->query("ALTER TABLE `items` ADD `view_{$group->id}` BOOLEAN DEFAULT 0");
+
return $group;
}
@@ -47,6 +51,12 @@ class group_Core {
* @param string $name the group name
*/
static function delete($name) {
- ORM::factory("group")->where("name", $name)->find()->delete();
+ $group = ORM::factory("group")->where("name", $name)->find();
+
+ if ($group->loaded) {
+ // Drop the view column for this group in the items table.
+ Database::instance()->query("ALTER TABLE `items` DROP `view_{$group->id}`");
+ $group->delete();
+ }
}
} \ No newline at end of file