@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!
@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:
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:
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.