Check if user is in group
Hey there! So, I've been customizing a theme lately, and I was wondering if there was a way to check if a user is in a group, for example:
Please let me know if there's any way of doing this, thank you!
EDIT: Or even being able to do this per-user would be absolutely fine for me! Thanks again.
@itsCrafted I believe you'd want to have a plugin (or your theme, rather, since themes are plugins too) listen to the
filter:users.gethook, and add that information as necessary.
Save the value as a boolean, and then you'll be able to use it in the
<!-- IF -->
@julian Thanks! Any pointers on where to get started with this? I'm very new.
- Notice the hook listener registered here: https://github.com/NodeBB/nodebb-plugin-quickstart/blob/master/plugin.json#L7
- Corresponding to a method in the plugin library itself: https://github.com/NodeBB/nodebb-plugin-quickstart/blob/master/library.js#L7
You'll want to listen to the hook I mentioned above, and make a call to
groups.isMember()to check group membership status, and then save it to the corresponding users' information.