Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    1. Home
    2. Joykiller
    • Profile
    • Following 0
    • Followers 1
    • Topics 20
    • Posts 107
    • Best 15
    • Groups 1

    Joykiller

    @Joykiller

    GNU/Linux

    20
    Reputation
    1076
    Profile views
    107
    Posts
    1
    Followers
    0
    Following
    Joined Last Online

    Joykiller Unfollow Follow
    GNU/Linux

    Best posts made by Joykiller

    • What is the proper way to add custom fields to a user profile hash?

      Ok, So I have figured out the template system, learned from some other plugins a few things. Able to modify broken ones to make work again etc.

      Now I have a plugin that on their registration adds a field to their main user mongo objectid. Question is where can I find some useful information on how to pull that said information from the database to display it in html on the template.

      I know base values can be done such as username etc with {username} obviously I need the plugin to "whitelist" or add this new value to be able to use it in templates too.

      I'm self taught programmer, learn from things i see. Examples are super helpful to me.

      I assume id have to do something like:

      Require User src
      User.getUserField(data.uid, 'NAMEOFID', function (err, NAMEOFIDDATA) {
       //What to do here to push it to template field?
      }
      

      I just find it hard to find accurate documentation and descriptions of nodebb plugin making maybe im looking in the wrong areas but seems like its hidden easter eggs.

      But yeah, a bit more detail.

      db.objects.find({_key: "user:4"})
      
      { "_id" : ObjectId("5ce1e1fa549c71c7acd236cb"), "_key" : "user:4", "valueId" : "hello", "returnTo" : "/" }
      

      (Obviously theres more in that object id i just removed it) - however I want to display valueid's value (hello) to a tpl. If this makes it easier to understand.

      posted in Developer FAQ
      Joykiller
      Joykiller
    • RE: [nodebb-widget-discord] Discord Server Widget

      @AbelRavyn You still supporting this?

      Would be interesting to integrate this into the profiles of the user.

      r/discordapp - Unofficial Discord API server, reverse engineering and bots galore.

      Was looking into this too, maybe adding it to communicate with that api to ban users if they are banned from nodebb on the voip as well. But prob should wait till official api comes out though prob could port it easily enough.

      posted in NodeBB Plugins
      Joykiller
      Joykiller
    • RE: What is the proper way to add custom fields to a user profile hash?

      @baris said in Plugin Dev [newb Question]:

      It works for custom templates as well as long as it is rendered with res.render('nameOfCustomTpl', data); Then the hook name becomes filter:nameOfCustomTpl.build

      Just wanted to stop in and say thanks. Got it working!

      posted in Developer FAQ
      Joykiller
      Joykiller
    • RE: May Docker Discussion

      Haha just came here to post this too.

      From Discover on Google https://duo.com/decipher/docker-bug-allows-root-access-to-host-file-system

      posted in Feature Requests
      Joykiller
      Joykiller
    • RE: Error when starting NodeBB (Error parsing your configuration file)

      @MarximusMG said:

      {
      "url": "http://community.domain.com",
      "secret": "",
      "database": "redis",
      "port":"4567",
      "bind_address":"0.0.0.0", //new
      "redis": {
      "host": "127.0.0.1",
      "port": "6379",
      "username": "
      ",
      "password": "***",
      "database": "0"
      },

      "use_port":"false", //don't forget this setting
      

      }

      try

      {
          "url": "http://community.domain.com",
          "secret": "***",
          "database": "redis",
          "port":"4567",
          "bind_address":"0.0.0.0", 
          "redis": {
              "host": "127.0.0.1",
              "port": "6379",
              "username": "***",
              "password": "***",
              "database": "0"
          }
      }
      

      As Pichalite also mentioned. then repost log.

      posted in Technical Support
      Joykiller
      Joykiller
    • RE: [nodebb-plugin-blog-comments] Blog Commenting Engine (Ghost, Wordpress widget)

      Necroing - @psychobunny you going to ever update this to newest version of ghost / nodebb?

      posted in NodeBB Plugins
      Joykiller
      Joykiller
    • [FORUM PERMISSIONS] - Request - Topics Access

      Access Topics - If disabled so they cannot view, can you change this because having the following settings..

      [Registered Users]
      Access Topics - (Unchecked)
      Create Topics - (Checked)
      Reply to Topics - (Checked)

      ATM, if Access is unchecked they can still make a post but cannot view their own. Would it be possible to make it so if Access Topics is unchecked allow them to view their OWN topic instead of disallowing all topics to be viewed?

      This way since they can still post their own topics and reply to it. Others say moderators can reply etc. But other registered users cannot see their topic. Only ones they create them selves. (This is so we can do private support per-say, like if someones reporting something about some one else. Other than a Chat etc. Soon hopefully to add a Form that posts into my form section for this soon.

      posted in Feature Requests
      Joykiller
      Joykiller
    • RE: issues installing Nodebb on Debian 8

      This might be just me, but I wouldn't be loading that under root directory. Create a new user and use that for nodebb location under home location. As to nodebb not showing up. What does your nodebb config, and nginx config look like? I don't know what you mean by debian comes with nginx already. Sure might be in the repo but shouldn't come installed, Unless a script you ran installed it for you.

      posted in Technical Support
      Joykiller
      Joykiller
    • Plugin/Questions To get started

      So I've been using nodebb for a little while but never got into the coding of a plugin for it.

      I've been working on a side project for a while using nodejs, (I'm learning still.) but I have it working and writes to a mongodb for persistence. I am looking at making a new page for displaying that info. Can anyone help me with links or helpful hints on how to get started?

      I assume I'd need to do it in a plugin, any help would be appreciated thanks.

      posted in General Discussion
      Joykiller
      Joykiller
    • RE: Which is better NodeBB or Discourse?

      @scottalanmiller Yeah, im in the middle of writing a system that would love to utilize the API, but the write API and having to manually update other plugins for their routes and all that, along with trying to figure out peoples coding stack is too much. So I'm prob just going to end up writing/searching the mongodb instead. But API would be awesome.

      posted in Feature Requests
      Joykiller
      Joykiller

    Latest posts made by Joykiller

    • 504 Error on /admin/extend/rewards [Solved]

      Not sure whats causing it. Anyone else getting this issue?

      Ran as ./nodebb dev - Not showing anything abnormal in verbose logs. Says its firing hooks etc but backend admin just keeps spinning.

      Running version: v1.12.2

      Mmm thats odd works fine with my local install.

      -- Think its a plugin did reset all and it seems to be working i guess ill ahve to trace it down! Ignore this message I suppose. 😄

      Was to do with: nodebb-rewards-essentials https://github.com/NodeBB/nodebb-rewards-essentials
      Removed it works fine now, I have no idea where that thing came from it doesnt show up in find plugins anymore i assume its not valid for current version. No clue why it was installed. lol

      posted in Technical Support
      Joykiller
      Joykiller
    • Wheres the documentation for permissions

      -Rephrasing-

      Is there a way to create a specific administrator but restrict the templates they go on? I doubt this is built into the backend. Do you think this would be possible for a plugin to do?

      posted in Technical Support
      Joykiller
      Joykiller
    • RE: May Docker Discussion

      Haha just came here to post this too.

      From Discover on Google https://duo.com/decipher/docker-bug-allows-root-access-to-host-file-system

      posted in Feature Requests
      Joykiller
      Joykiller
    • RE: Proper way to return res.redirect('')?

      @Joykiller said in Proper way to return res.redirect('')?:

      @julian said in Proper way to return res.redirect('')?:

      Callbacks don't work all that nicely with async functions... I think stripe.subscribe is called with await and returns undefined before the isValueID method is called and returns.

      I added asyncs to test, removed them same issue with headers response from res.redirect. Oh i see what this plugin does, I guess i could write it to the session and then call it from there. Argh im at a loss that didnt work either still same header issue. seems like even the other values prob would do the same as mine I duno if the way it was coded from base was correct.

      Nevermind I got it working with writing to the session first, had an error on previous attempt.

      Thanks for the help.

      posted in Plugin Development
      Joykiller
      Joykiller
    • RE: Proper way to return res.redirect('')?

      @julian said in Proper way to return res.redirect('')?:

      Callbacks don't work all that nicely with async functions... I think stripe.subscribe is called with await and returns undefined before the isValueID method is called and returns.

      I added asyncs to test, removed them same issue with headers response from res.redirect. Oh i see what this plugin does, I guess i could write it to the session and then call it from there. Argh im at a loss that didnt work either still same header issue. seems like even the other values prob would do the same as mine I duno if the way it was coded from base was correct.

      posted in Plugin Development
      Joykiller
      Joykiller
    • RE: Proper way to return res.redirect('')?

      @baris said in Proper way to return res.redirect('')?:

      You didn't post the rest of the stripe.subscribe function.

      Yeah thats why i listed stripe.js git, All i am doing is checking for value I created stripe.isValueID to call the valueId back and if its there or not pass res redirect. nothing else is changed just added that above code, //get value is above the stripe.subscribe block. It's fairly large section.

      I get it to return the valueId no problems and conditional works fine. Problem is trying to do the return res.redirect causes the header issue. Just not entirely sure why.

      posted in Plugin Development
      Joykiller
      Joykiller
    • RE: Proper way to return res.redirect('')?

      @baris said in Proper way to return res.redirect('')?:

      @Joykiller said in Proper way to return res.redirect('')?:

      Cannot set headers after they are sent to the client

      This usually means res.send or res.redirect was already called and you are calling it again. What is the rest of the code?

      Probably would help huh, sorry about that.

      So I'm editing the Stripe Plugin for subs, which was based on the paypal system.
      Trying to add a new field to check before it goes to the onsubscription function.

      // get value
      stripe.isValueID = async function(uid, callback) {
        user.getUserField(uid, 'valueId', callback);
      };
      
      stripe.subscribe = async function(req, res, next) {
      var uid = req.user.uid;
      
      
      // this part breaks because of header shit.
      stripe.isValueID(uid, function(err, isValueID) {
        //console.log(isValueID);
        // if(!isValueID) {
          //return helpers.redirect('/?subscribe=fail');
          //return notAllowed(req, res);
          //return res.redirect('/?subscribe=fail');
        //}
      });
      
      

      https://github.com/edthefifth/nodebb-plugin-stripe-subscriptions/blob/master/lib/stripe.js
      around line 62. but each time i check the if conditional it triggers the sent headers issue.

      posted in Plugin Development
      Joykiller
      Joykiller
    • Proper way to return res.redirect('')?

      I'm trying to write some redirection if a specific value is found then send error message from my plugin.

      Each time i seem to do the redirection code block

              winston.warn('Could not find value for user:'+uid);
              return res.redirect('/?template=fail');
      

      It works, but then restarts the whole forum.

      2019-05-26T04:50:05.304Z [4567/15619] - error: uncaughtException: Cannot set headers after they are sent to the client
      Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
      

      Guess its some middleware issue calling directly from helpers like notAllowed seems to work

      posted in Plugin Development
      Joykiller
      Joykiller
    • RE: Stripe Subscription Plugin

      @psychobunny Pinging you since this is a fork of your plugin for paypal.

      Ok so, Update 1:
      Removed the function onload wrapper. Still same problem as above, however step closer, Now clicking the navigation once more loads the GET files. But doesnt do it on initial visit from navmenu.

      I guess a quick fix would be to just have it refresh or reload page when visiting it, but that isnt good i dont think.

      UPDATE 2: SOLVED.. Nevermind its not solved. Some times it works some times theres a delay and still never gets sent..

      Found another bug.. You may call me the bug hunter. 😄
      https://github.com/edthefifth/nodebb-plugin-stripe-subscriptions/blob/master/library.js line 90 - Getting an error i assume due to the template not entirely sure about this one.

      ajaxify.js in console brings up the following..
      7f8febd0-20fd-4704-b9dd-2b783675586d-image.png

      So if you're subscribed, then go back to visit the Subscribe link in navmenu, the loading bar will continue to spin but not load or /redirect you. Unless you refresh.

      posted in Plugin Development
      Joykiller
      Joykiller
    • RE: Stripe Subscription Plugin

      @edthefifth or anyone for that matter that might know whats going on let me know.

      So I've taken this plugin and been playing around to modify to suit my needs, however I have come across some bug. I think I narrowed it down to the subscribe.tpl - Basically theres a script section within it that loads up the stripe payment popup info on click by the element customButton.

      Problem is, ive noticed that if the page is visited by the navigation the popup does not execute. Button just acts like nothings attached. BUT.. If you refresh the page then click the button it seems to work no problem.

      https://github.com/edthefifth/nodebb-plugin-stripe-subscriptions/blob/master/static/templates/subscribe.tpl
      anyone know how to solve this issue?
      Line like 32

      I assume its not like rendering the script as its being sent from menu, I guess i should move the script to the header so it preloads? I duno.

      Yeah console output seems to confirm this..
      Visiting from the menu no fetch for getting the api is passed.
      Once refreshed on console reports fetching no problem.

      posted in Plugin Development
      Joykiller
      Joykiller