aboutsummaryrefslogtreecommitdiff
path: root/mod/categories/start.php
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-25 10:00:38 -0700
commitdccc333c765bb28da55b4a55d9c916acdb88413a (patch)
treebdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/categories/start.php
parentec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff)
parent003cb81c7888f4d2fd763e5814027c6f8d71186f (diff)
downloadelgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz
elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/categories/start.php')
-rw-r--r--mod/categories/start.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/mod/categories/start.php b/mod/categories/start.php
index ff5b01efc..2ccea0d70 100644
--- a/mod/categories/start.php
+++ b/mod/categories/start.php
@@ -15,13 +15,14 @@ function categories_init() {
elgg_extend_view('css/elgg', 'categories/css');
- $action_base = elgg_get_plugins_path() . 'categories/actions';
- elgg_register_action('settings/categories/save', "$action_base/save.php", 'admin');
-
elgg_register_page_handler('categories', 'categories_page_handler');
elgg_register_event_handler('update', 'all', 'categories_save');
elgg_register_event_handler('create', 'all', 'categories_save');
+
+ // To keep the category plugins in the settings area and because we have to do special stuff,
+ // handle saving ourself.
+ elgg_register_plugin_hook_handler('action', 'plugins/settings/save', 'categories_save_site_categories');
}
@@ -54,3 +55,29 @@ function categories_save($event, $object_type, $object) {
}
return TRUE;
}
+
+/**
+ * Saves the site categories.
+ *
+ * @param type $hook
+ * @param type $type
+ * @param type $value
+ * @param type $params
+ */
+function categories_save_site_categories($hook, $type, $value, $params) {
+ $plugin_id = get_input('plugin_id');
+ if ($plugin_id != 'categories') {
+ return $value;
+ }
+
+ $categories = get_input('categories');
+ $categories = string_to_tag_array($categories);
+
+ $site = elgg_get_site_entity();
+ $site->categories = $categories;
+ system_message(elgg_echo("categories:save:success"));
+
+ elgg_delete_admin_notice('categories_admin_notice_no_categories');
+
+ forward(REFERER);
+} \ No newline at end of file