Group plugin: Combining template files but javascript interactions don't work

Plugin Development
  • Global Moderator Plugin & Theme Dev

    @agd1 It sounds like the necessary scripts aren't being loaded. Can you post the original group/details.tpl and category.tpl and then the combined file?

  • GNU/Linux

    @PitaJ sorry it took me a second to get back to you. I threw the code in Github

    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 /groups/groupname?

  • GNU/Linux

    @psychobunny need to update the Git repo, but in my sandbox where I was toying with this plugin I actually overwrote the groups/list.tpl so that when a group is selected it doesn't take the user to groups/:groupName but instead to to the url for the category associated with the group: category/:cid/groupName

  • GNU/Linux

    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 /group/groupname

    It would auto load public/src/forum/group.js

    (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.end route and load the groups.js file as well

  • GNU/Linux

    @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 read privileges 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 /groups/:groupname and /category/:cid/:slug, and both are restricted from viewing if the read privilege 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:

    0_1449354246354_Screen Shot 2015-12-05 at 5.23.31 PM.png

  • GNU/Linux

    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.


  • GNU/Linux


    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/:groupname the 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 🙂

Suggested Topics

  • 0 Votes
    7 Posts

  • 0 Votes
    6 Posts

  • 0 Votes
    2 Posts

  • Widget doesn't render

    Plugin Development
    0 Votes
    5 Posts

| | | |