I am working on a plugin that adapts the current category/group paradigm to center content around groups (vs categories). Basically, the plugin ensures every group has exactly one category associated with it, and no one has privileges for that category except the members of the group. When a user wants to "post to the group' they are actually posting to the group's category.
The beginnings of the plugin have been easy to code. I hook into
filter:groups.createto automatically create a category with a
groupproperty and attach the resulting
cidto the group. When the user wants to view the "group feed", I direct them to the group's category and hook into
filter:category.getto attach the group to the category before it gets sent to the client.
Where I am stuck, however, is the templates. As a proof of concept for the plugin, I combined
groups/details.tplfile and the
I am hoping this is an easy solve, but I keep running into dead ends. Would much appreciate any thoughts on this!
@agd1 It sounds like the necessary scripts aren't being loaded. Can you post the original
category.tpland then the combined file?
@PitaJ sorry it took me a second to get back to you. I threw the code in Github https://github.com/aggied/nodebb-plugin-groupthink.
You'll see in the templates directory that there is a
category.tpl. This is the combined version. These are the links to the originals from the Persona theme:
The plugin is working w/ NodeBB 0.9 & the Persona theme. Thanks for any input!
Did you change the route for this page, or is it still
@psychobunny need to update the Git repo, but in my sandbox where I was toying with this plugin I actually overwrote the
groups/list.tplso that when a group is selected it doesn't take the user to
groups/:groupNamebut instead to to the url for the category associated with the group:
and to clarify the intent here a little bit: I'm very impressed with NodeBB, and I'd like to see a plugin that enables functionality not unlike Facebook groups.
So that's the problem then, NodeBB automatically loads via requirejs the JS file for a certain route.
Let's say you went to
It would auto load
(I'm on mobile now the routes are probably wrong, but hope you get what I mean)
So to solve this, you would have to detect page load of your new route via the
action:ajaxify.endroute and load the groups.js file as well
@psychobunny that was exactly the trick. I have updated the repo and everything seems to be working pretty well right now. Very pleased with how it is turning out!
The only seeming major block left is a problem with privileges. If I remove the
readprivileges from non-group members, NodeBB prevents them from seeing the "frankensteined" category/group view. I merged both views, so the user seems the same thing at both
/category/:cid/:slug, and both are restricted from viewing if the
readprivilege isn't given to a user.
My solution was to give the access but strip the topics out from the JSON response before sending to the client. One major problem -- they are still visible in the Recent and Popualr feeds. This tells me my solution is not really robust enough.
Any thoughts from anyone on how to get around this? I need to be able to embed a category topic list inside the group view and still let non-group members view the group page to join (without of course seeing the topics until they are a member).
Here's a screeenshot of the frankensteined view:
Thinking out loud here, perhaps a good lead on this would be to figure out what generates this error. The HTTP response to get this group comes back as 403 Forbidden, which means it must be coming from the category ACL.
I think I got most -- if not all -- of this figured out. I learned about NodeBB in the process -- very impressed with it!
For posterity, take a look at the nodebb-plugin-groupthink plugin. The way I ended up solving this is rethinking the privilege setup from what I first did. Nobody has any privileges to a group's category except group members. If a user visits a group page at
/groups/:groupnamethe group metadata is still passed to the client so the user can join the group, but the category is not retrieved. Due to some strange bug in the Persona theme (or in templates.js-- not sure) I couldn't wrap
<!-- IMPORT partials/topics_list.tpl -->in
<!-- IF group.isMember -->, but I solved this by rearranging some of the template html.
The plugin seems to be working well. Users can now "Post to a group" similar to how they would on other social networks.
I did a try and i liked it
It would be awesome if you could choose what category works that way and what category works on the standard forum way