how can I get all groups?

NodeBB Development
  • I need to get all groups that there are in my forum, I mean all groups visibile/invisible or with other settings.
    For now I use this set

    var set="'groups:visible:createtime;'

    But this is not correct, because I don't see ( in the result) the hidden groups. So I think something like this:

    var set='groups:all:createtime;'
    groups.getGroups(set, 0, -1, function(err, gruppi) { 

    Anyone can help me?

  • You need to use groups:createtime but filter the privilege groups so the below should give you what you want.

    	function (next) {
    		db.getSortedSetRange('groups:createtime', 0, -1, next);
    	function (groupNames, next) {
    		groupNames = groupNames.filter(function (name) {
    			return !groups.isPrivilegeGroup(name);
    		groups.getGroupsData(groupNames, next);
    ], callback);
  • @baris correct answer! thanks!

Suggested Topics