how can I get all groups?


  • GNU/Linux

    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?


  • Admin

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

    async.waterfall([
    	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);
    

  • GNU/Linux

    @baris correct answer! thanks!


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.