Are there any errors that pop up when you click save, or in the browser console, or in the server logs?
Custom page + nodebb current user + mongodb access
Good evening gents and thanks for this amazing platform.
Being a NodeBB newbie please be patient and carry on if something sounds stupid down here.
Although I've some programming background I completely lack many concepts around NodeBB thus my question might look dumb or even impossible to answer... but let's try!
In the need of creating a custom page i've installed nodebb-plugin-custom-pages plugin and I've been able to display something in my custom page and to execute some stupid JS code.
The point writing some JS code in the page is it possible to:
- retrieve the current user browsing the page and use this information to programmatically modify the page?
- to connect to the underlying mongoDB and perform some operations on it?
Any advise will be really helpful to understand if I'm on the right way or not.
@knickknack for #1, yes you can access the global variable
uidalso give sightly different results, you can use the browser JS console to experiment).
For #2, the client-side scripts can't access mongo directly. What is it you want to do?
Thanks a lot PitaJ for the first point!
With regard to #2 the idea is to query for a value stored in mongo, assign this value to the user currently logged and store back on the DB the value increase by one. Actually this can be done directly writing in the objects collections or alternatively create a new collection.
Any thoughts here?
In order to do that you'd probably need to create a plugin.
Thanks Pitaj! Beside this guide is there any complete example you suggest to start to look at?