Skip to content

custom plugin - increment in reputations

General
4 2 1.1k 1
  • Hi

    I am trying to create plugin for after each reply increment in in the reputation point of topic Author.

    I tried something in library.js file. (Two more files i have created package.json and plugin.js)

    Could you please help me to correct out.

    'use strict';
     
    var Topics = require.main.require('./src/topics');
    var User = require.main.require('./src/user');
    var meta = require.main.require('./src/meta');
     
    var reputationPoints = 1; // Number of reputation points to award per reply
     
    var plugin = {};
     
    plugin.postReply = async function (payload) {
      var tid = payload.topic.tid;
      var topic = await Topics.getTopicFields(tid, ['uid']);
     
      await User.incrementUserReputationBy(topic.uid, reputationPoints); // Increase reputation points by the specified amount
    };
     
    module.exports = plugin;
    
    
  • Hi

    I am trying to create plugin for after each reply increment in in the reputation point of topic Author.

    I tried something in library.js file. (Two more files i have created package.json and plugin.js)

    Could you please help me to correct out.

    'use strict';
     
    var Topics = require.main.require('./src/topics');
    var User = require.main.require('./src/user');
    var meta = require.main.require('./src/meta');
     
    var reputationPoints = 1; // Number of reputation points to award per reply
     
    var plugin = {};
     
    plugin.postReply = async function (payload) {
      var tid = payload.topic.tid;
      var topic = await Topics.getTopicFields(tid, ['uid']);
     
      await User.incrementUserReputationBy(topic.uid, reputationPoints); // Increase reputation points by the specified amount
    };
     
    module.exports = plugin;
    
    

    @Vijay-Kumavat-0 are you attempting to modify or extend nodebb-plugin-rewards-essential?

  • Yes, I saw this plugin,

    But i tried to create new rather than customize nodebb-plugin-rewards-essential. Because it is bit confusing me.

    Am i on the right track?

  • Yes, I saw this plugin,

    But i tried to create new rather than customize nodebb-plugin-rewards-essential. Because it is bit confusing me.

    Am i on the right track?

    @Vijay-Kumavat-0 I think you’d be better off customising the plugin above to be honest. It seems like you’d be reinventing the wheel otherwise.

    I’d modify

    /nodebb/node_modules/nodebb-rewards-essentials/lib/conditions.js
    /nodebb/node_modules/nodebb-rewards-essentials/lib/rewards.js

    These seem to be the two files that control what is in the dropdown lists.


Related Topics
  • 7 Votes
    6 Posts
    142 Views
    I have an update regarding this. They both said that they are getting used to navigating Fedora and that it is working great for them so far. They said there is still a bit of a learning curve they are going through but overall happy.
  • Infrared the new WiFi?

    General wifi infrared
    4
    2 Votes
    4 Posts
    1k Views
    @JAC those speeds are indeed possible over light as a transport medium (if you consider the speed) but I can’t comprehend the distance quoted. If you happen to encounter a solid obstacle, the beam is either absorbed, or deflected meaning the data never arrives.
  • 3 Votes
    7 Posts
    1k Views
    @phenomlab I will have to test this out in my virtual environment. I have an Arch KDE Plasma install in virtualbox that I am testing a bunch of things out before I actually wipe the hard drive and install linux. I am currently in the process of copying my Arch test web server over to virtualbox on linux to make sure that it works. This is the virtual server that I test updates on before updating the production server. I can’t remember the error I was getting but I think it had to do with the network device. That was on the virtualbox side. So the cloud storage will be the next thing that I test.
  • Email Provider

    General email gmail proton
    9
    5 Votes
    9 Posts
    2k Views
    @phenomlab lol it is a great excuse and sometimes a combination of both haha
  • Virgin Media Pricing

    General virgin media sky
    11
    9 Votes
    11 Posts
    2k Views
    @phenomlab some good savings there Mark. I’ll post mine once my new deal changes over.
  • OKTA offering personal password manager

    General okta password manager
    31
    18 Votes
    31 Posts
    5k Views
    @Madchatthew yes, works well for us.
  • 2 Votes
    6 Posts
    1k Views
    @dave1904 I’d start by adding a console.log function to hookData so you can see what is being returned return hookData; console.log(hookData):
  • 12 Votes
    47 Posts
    9k Views
    @dave1904 just coming back to this thread as @DownPW and I both experienced issues with other plugins today, and the fix was to use the plugin ordering in the ACP and move the Harmony theme to the very top so it comes before everything else in terms of other plugins. It might be worth at least trying this to see if it gives you a result rather than the previous bulldozer approach. Thinking about it, the previous fix I proposed is along the same lines and disabling plugins does in fact change the order when they are enabled again, so this is definitely worth a try. Let me know how you get on.