• 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.4.2 Latest
Buy Hosting
A

alexschomb

@alexschomb
About
Posts
22
Topics
4
Groups
0
Followers
0
Following
0

Topics

  • A

    Accessing nodeBB functions via Cron Jobs

    Scheduled Pinned Locked Moved Plugin Development
    0 Votes
    7 Posts
    2k Views
    A

    Thanks, that should do the trick! 🙂

    Gonna post my cronjob as soon as it's ready. Can take a few days, because of christmas.

  • A

    Guest user appears in several groups although not added

    Scheduled Pinned Locked Moved Technical Support
    0 Votes
    4 Posts
    2k Views
    A

    Any ideas?

  • A

    Disallow editing password, email, ...

    Scheduled Pinned Locked Moved Unsolved Plugin Development
    0 Votes
    6 Posts
    2k Views
    julianJ

    @baris possibly a regression?

  • A

    Checking Group Membership of UID

    Scheduled Pinned Locked Moved Solved Plugin Development
    0 Votes
    4 Posts
    1k Views
    A

    Thanks to both of you for your quick help!

    Both solution do work indeed. As baris pointed out, my failure was returning values from async functions.

    Here is a working example for each solution:

    var Groups = module.parent.require('./groups'); Groups.isMember(uid, 'administrators', function(err, isMember) { if (err) { next(err); } if (isMember) { winston.info('user is an administrator'); Groups.join('administrators', uid); } else { winston.info('user is no administrator'); Groups.leave('administrators', uid); } }); var User = module.parent.require('./user'); var Groups = module.parent.require('./groups'); User.isAdministrator(uid, function(err, isAdmin) { if (err) { next(err); } if (isAdmin) { winston.info('user is an administrator'); Groups.join('administrators', uid); } else { winston.info('user is no administrator'); Groups.leave('administrators', uid); } });
  • 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
  • Login

  • Don't have an account? Register

  • Login or register to search.