• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.1 Latest
Buy Hosting

how can I get all groups?

Scheduled Pinned Locked Moved NodeBB Development
groupsprivileges
3 Posts 2 Posters 1.4k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DoppyD Offline
    DoppyD Offline
    Doppy GNU/Linux
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #2

    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);
    
    1 Reply Last reply
    2
  • DoppyD Offline
    DoppyD Offline
    Doppy GNU/Linux
    wrote on last edited by
    #3

    @baris correct answer! thanks!

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development