Need a working example of grabbing post data
-
Cool, let me know if you have any other questions.
-
@yariplus, I've been playing around with the code and got it working pretty well like I wanted but now I can't figure out how to get data out of getUserData().
It gives me null, complains that user is not defined, crashes Nodebb and does all kinds of stuff depending on how I try to do it but it doesn't give me any useful data.
I've been trying to get it working with action:user.loggedIn so I could display "user <name here> logged in" when an user logs in. And also with action:user.create so I could display something like "<name here> registered at forums" when an user registers at the forums.
-
@Pilvinen Hmm, sounds like you're sending or reading the wrong parameters somewhere. If it's crashing NodeBB, you might have forgot the
return
statement in yourif (err)
.Plugin.loggedIn = function (uid) { User.getUserData(uid, function (err, userData) { if (err || !userData) return console.log("Couldn't find user: " + uid); console.log("User '" + userData.username + "' has logged in."); }); };
-
@yariplus said:
@LLLRH said:
@yariplus,Your guide is simple but very helpful to write plugin, thanks
Thanks for your feedback! Glad to help anyone getting into NodeBB development.
If you are interested in writing a beginners guide to plugin development, we'd be happy to feature it on our blog
(I have to update ghost first, so that we can post it under your username)
-
@psychobunny said:
@yariplus said:
@LLLRH said:
@yariplus,Your guide is simple but very helpful to write plugin, thanks
Thanks for your feedback! Glad to help anyone getting into NodeBB development.
If you are interested in writing a beginners guide to plugin development, we'd be happy to feature it on our blog
(I have to update ghost first, so that we can post it under your username)
Actually, yes. That is something I've been wanting to do. I jumped into NodeBB development as a total newbie to Javascript, so I probably have a good perspective for beginners. I have some formal education in technical writing as well.
-
@yariplus said:
Actually, yes. That is something I've been wanting to do. I jumped into NodeBB development as a total newbie to Javascript, so I probably have a good perspective for beginners. I have some formal education in technical writing as well.
Please do this! We need more tutorials and technical guides. I've been trying to immerse myself more in the source and writing plugins so I can write some stuff for the community.