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;
    
    
  • @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?

  • @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