Skip to content

Node.js based forum software built for the modern web

pass the data used to create the category to filter:category.create

barisusakli0be2a79210d5
diff --git a/src/categories/create.js b/src/categories/create.js
index 1b47f87760..71eef4e72e 100644
--- a/src/categories/create.js
+++ b/src/categories/create.js
@@ -38,7 +38,7 @@ module.exports = function(Categories) {
imageClass: 'auto'
};
- plugins.fireHook('filter:category.create', {category: category}, next);
+ plugins.fireHook('filter:category.create', {category: category, data: data}, next);
},
function(data, next) {
category = data.category;
diff --git a/src/categories/update.js b/src/categories/update.js
index 6ea03b8930..fb5cec5054 100644
--- a/src/categories/update.js
+++ b/src/categories/update.js
@@ -18,11 +18,15 @@ module.exports = function(Categories) {
var modifiedFields = modified[cid];
- if(modifiedFields.hasOwnProperty('name')){
+ if (modifiedFields.hasOwnProperty('name')) {
modifiedFields.slug = cid + '/' + utils.slugify(modifiedFields.name);
}
- plugins.fireHook('filter:category.update', {category:modifiedFields}, function(err, categoryData) {
+ plugins.fireHook('filter:category.update', {category: modifiedFields}, function(err, categoryData) {
+ if (err) {
+ return next(err);
+ }
+
var category = categoryData.category;
var fields = Object.keys(category);
async.each(fields, function(key, next) {