custom plugin - increment in reputations
-
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (ether email, or push notification). You'll also be able to save bookmarks, use reactions, and upvote to show your appreciation to other community members.
With your input, this post could be even better 💗
RegisterLog in