What do you mean like "moderator"?
-
I need to became an user into "categories moderator". So I go in my:
http://192.168.56.101:4567/admin/manage/categories/1#privileges
and I add new user for the first category and I check the checkbox under moderate so I think the user become moderator of the first category. Now I my code I need to understand if a user is a moderator of any category.
categories.getAllCategories(data.uid, function(err, category) { if (err) { return callback(err); } privileges.users.isModerator(category, data.uid, function(err, isModerator) { if (err) { return callback(err); } console.log("IS MODERATOR "+JSON.stringify(isModerator)); }); });
When I print the value "isModerator" I see all false for all categories in the forum. Anyone can help to understand how I user can became "moderator"?And a groups moderator exists?
-
You are passing the wrong parameters to
privileges.users.isModerator
. Try :var cids = category.map(function(category) { return category.cid; }); privileges.users.isModerator(data.uid, cids, function(err, isModerator) { console.log(isModerator); });
-
-
The end result is that it's turning an array of Category Objects into an array of Category IDs
[{name:'General', cid:'0'},{name:'Help', cid:'1'}]
will become['0', '1']