Skip to content

custom plugin - increment in reputations

General
  • 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
  • Email Provider

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

    General
    11
    9 Votes
    11 Posts
    318 Views
    @phenomlab some good savings there Mark. I’ll post mine once my new deal changes over.
  • Windows 10 End of Life

    General
    10
    2 Votes
    10 Posts
    263 Views
    @phenomlab this looks very nice as well. It is nice that they keep the KDE Neon a rolling release so you will get those updated apps even though Ubuntu isn’t a rolling release. Is it a rolling distro? KDE neon is rolling for KDE software. The Ubuntu base OS is not, but certain packages will be updated as needed to support KDE software requiring newer library versions than what is provided by Ubuntu. Apps from the main repositories are not rolling either, and therefore can be up to two years old. Users are encouraged not to use them, and to instead get apps from Snap or Flatpak using KDE’s Discover app store. In neon, Discover is set up to only show apps from these sources, filtering out apps from the repositories.
  • OKTA offering personal password manager

    General
    20
    10 Votes
    20 Posts
    526 Views
    @phenomlab That is very nice!
  • Mongo Completely Broken.

    General
    20
    3 Votes
    20 Posts
    568 Views
    @Sampo2910 said in Mongo Completely Broken.: I can see you cringing Yes, that does make me slightly uncomfortable but OK.
  • Which VPN do you currently use?

    General
    6
    4 Votes
    6 Posts
    658 Views
    @phenomlab absolutely, their step brother residing in a different Countries. https://surfshark.com/blog/surfshark-vs-nordvpn
  • 2 Votes
    6 Posts
    478 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
    3k 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.