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

Help pulling user info

Scheduled Pinned Locked Moved NodeBB Development
10 Posts 5 Posters 3.1k 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.
  • zeroZ Offline
    zeroZ Offline
    zero
    wrote on last edited by
    #1

    i want to make a menu for my home that has avatar, name, post count and reputation of the user logged in.
    For some reason i just cant figure out how to do that, is there any global shortcodes or anything?

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #2

    does this help? http://community.nodebb.org/api/user/psychobunny

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #3

    to get current user's name, app.username. then its just a simple matter of doing something like $.get

    1 Reply Last reply
    0
  • trevorT Offline
    trevorT Offline
    trevor Plugin & Theme Dev Anime Lovers GNU/Linux
    wrote on last edited by trevor
    #4

    O.o Interesting. @psychobunny thanks.

    1 Reply Last reply
    0
  • S Offline
    S Offline
    Scuzz
    wrote on last edited by
    #5

    How about the same thing but for groups?
    I need to find the gid of the admin group, is there a nice simple way of doing that?

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by
    #6

    Not on the client side, but on server-side, you can run this:

    var Groups = require('./groups');
    Groups.getGidFromName('Administrators', function(err, gid) {
      console.log('admin group gid is', gid);
    });
    

    getByGroupName will also return the group object

    1 Reply Last reply
    0
  • S Offline
    S Offline
    Scuzz
    wrote on last edited by
    #7

    @julian Thanks. I was using that last night but i was trying client side and couldnt figure out why it wasnt working 😛

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by julian
    #8

    Right-o -- group management is restricted to admin only, hence there are no public API endpoints for it.

    If you are an admin, try this route: /api/admin/groups

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #9

    I feel like getting group membership should be publically available, so we could write a groups page for example, or give users labels depending on who they are. (ex. coloured username / badge for admins)

    1 Reply Last reply
    0
  • S Offline
    S Offline
    Scuzz
    wrote on last edited by
    #10

    @julian
    Got it with this

    socket.emit('admin.groups.get', gid, function(err, groupObj) {
    });
    

    Works like a charm.

    1 Reply Last reply
    1

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