a question about syntax of benchpressjs

NodeBB Development
  • I have a question about benchpressjs: say, I have an array, I want to skip the output for the first and second item in the array, here is my code:

                        *{{{ each localNews.topics }}}
                        {{{ if @index !="0" }}}
                        {{{ if @index !="1" }}}
                        {{{ end }}}
                        {{{ end }}}
                        {{{ end }}}*

    but the code is not working, any ideas or suggestion? thanks in advance

  • We don't have any built in conditional support. There's the @first helper which works for when you only want to check if @index == 0. To do this, I'd suggest adding a helper for whatever condition you need.

Suggested Topics

  • 1 Votes
    18 Posts

    @yariplus said in Noob Plugin question: Alterin error message on filter hook.:

    Yep, you can use this function here the same way.


    Just declare it at the global scope so that your hook can see it.

    Thank you very much @yariplus ; I achieved what i needed thanks to your help.

    I was able to see my custom page with my custom messages like you pointed out.

    Then, because i only wanted to change the message displayed on the 403 error regarding the logic on my plugin i was able to change it to using another method; only if it could help anyone else, i just imported the helpers module and called the function notAllowed with my custom message:

    var helpers = require.main.require('./src/controllers/helpers'); // filter:topic.build tagsTitle.topicBuild = function (data, callback) { if (data.templateData.privileges.errorMessage) { helpers.notAllowed(data.req,data.res, data.templateData.privileges.errorMessage); }else{ callback(null, data); } };

    Thanks again. I learned a lot of basic stuff just trying your suggestions.

    Kind regards.

  • SSO Plugin questions

    NodeBB Development
    0 Votes
    1 Posts

    I'm working with this SSO plugin skeleton: https://github.com/julianlam/nodebb-plugin-sso-oauth to create my own.

    I want to add a check to see if the user who is trying to connect to this 3rd party is already logged in to NodeBB, if so I would like to disregard the email address provided by the 3rd party sso and just add the other fields from the sso provider to his profile.

    The reason for this is becuase whenever a user is already logged in and tries to connect via SSO and that he is registered in that 3rd party with a different email address, NodeBB will create a new user.

    I can see that I need to add a check under the OAuth.login function but not sure how to check if there's currently a logged in session for this user.

  • npm question.

    NodeBB Development
    0 Votes
    1 Posts

    So turns out I've been committing plugins on two seperate accounts, because my brain cells have 410.

    I have 6 packages on one account, and 7 on another. I would like to combine them. As trying to publish my changes is giving me 403 errors. And I can't seem to logout of one npm and log in to the other. I'm all so very confused. 😕

  • 0 Votes
    6 Posts

    Thanks 🙂

  • 0 Votes
    3 Posts

    Thanks! It is the right step toward allowing for images being saved on the server vs imgur. That's why I am using it among other reasons as well. 😛