NodeBB referral system plugin
-
I am creating a plugin for Nodebb forum which works like this:
User(A) created his account - > he gets a referral code (his username)
Anyone(B) uses his referral code while registration + earns 150 currency -> User(A) gets 20 points for each such user.I have already created the repository and following modules:
Registration screen has input for referral code.
If referral is entered is cross checked against all registered user names.
If founds a matching username, inside a new hash the new user and original users are mapped.
Else displays the message the wrong "referral code entered".
If no referral code was entered user is registered as normal and no mapping happens.here is the link to the repository https://github.com/ethicalvats/nodebb-plugin-ds-refferal
-
Nice idea, might play nice with that money plugin that I think @psychobunny was developing. Maybe you could fire your own custom hook for other plugins to listen to?
Some tips:
Refferal_ds.checkRefferalYour custom registration field should be in the userData object with the ID that you gave it as key.
It's also better to require NodeBB modules using module.parent.require, rather than going up a few paths. This makes sure that your plugin will still work when people npm link it.
-
@pedrov you can try nodebb-plugin-user-invitations
it's a similar concept. Feel free to make any feature requests.
-
@surikmeetr yes, this has been a feature for a while now. I haven't tested on 1.10 though.
-
@yariplus You mean user-specific invite links? I'm aware, and it works on 1.10 (though the links are incorrect if nodebb is in a subfolder, a problem many plugins have).
But I meant specifically what you referenced in issue #52 on github: adding a unique code to the invitation link so it's not possible to guess it.