Custom Page: pageView events and access restrictions

Unsolved Technical Support
  • #1

    Hi All,
    I am working on a plugin code that creates a custom page accessible to the client.
    Its working and all is good! Two questions if I may:

    1. I am not getting pageView events on the custom page (for the rest of the site I do). Am I doing something wrong?
    2. Am I able to restrict access to the custom page to certain groups? How would I go about implementing that?

    Thank you very much in advance!
    JJ.

  • NodeBB
    #2

    For setting up your cutom page use this https://github.com/NodeBB/NodeBB/blob/master/src/routes/helpers.js#L5, or at least use the middleware.pageView function as a middleware, that will count the pageviews.

    As for only allowing some groups to view the page. You have check if the user is a member of those groups with the function groups.isMemberOfGroups(uid, ['group1', 'group2'], callback); You can get the uid from req.uid in your route handler.


Suggested Topics


  • 0 Votes
    1 Posts
    165 Views

  • 0 Votes
    5 Posts
    914 Views

  • 0 Votes
    8 Posts
    1376 Views

  • 0 Votes
    2 Posts
    1570 Views

  • 0 Votes
    3 Posts
    1645 Views

| | | |