What's the best practice to make tpl, back-end function work together in plugin?

NodeBB Plugins
  • Hi guys,

    What I want is a custom page with some form to submit data to the db. I have learnt quite a few about the plugin system and start with the nodebb-plugin-quickstart, then modify it and make my own custom page visible. But the quickstart's page is for the admin and I guess this is the submit data handling funciton in static/lib/admin.js:

    define('admin/plugins/quickstart', ['settings'], function(Settings) {
    var ACP = {};
    ACP.init = function() {
    	Settings.load('quickstart', $('.quickstart-settings'));
    	$('#save').on('click', function() {
    		Settings.save('quickstart', $('.quickstart-settings'), function() {
    				type: 'success',
    				alert_id: 'quickstart-saved',
    				title: 'Settings Saved',
    				message: 'Please reload your NodeBB to apply these settings',
    				clickfn: function() {
    return ACP;

    But obviously it's for a ACP page, and I want a form page for all users. So may you tell me how to add the $('#save').on('click', function()... for my form page, and where to write the post function? Thank you very much!

  • @psychobunny @baris @yariplus @julian @PitaJ Could you give me some tip or plugin as sample? Thanks a lot!

  • @Tivon Hm, maybe the shoutbox plugin could get you pointed in the right direction?

  • @Bri Thanks, it's helpful! 🙂

Suggested Topics

  • 0 Votes
    3 Posts

    Yes, the last post on the forum was made 2 days ago. I just created a new post and vuala - it works and also the template is brand new. Looks like the the post statistics somehow was reset after upgrade, this is why it didn't pick up the topics created earlier this week. Thanks for explanation!

  • News plugin - portal

    NodeBB Plugins
    0 Votes
    15 Posts

    @phit Thanks!

    Yeah, that's probably because it's still parsing that newsTemplate. I'll add an option.

    Published 0.1.2, with option to hide from guests. For anyone who wants to get the same affect as above without modifying the templates, I added three new widget areas: contenttop, contentbottom, and contentbetween. Just add a widget there and hide it from registered users.

    I'll create a topic for this asap...

    (Also fixed relative_path)

  • 0 Votes
    4 Posts

    @limker said:

    Looks like your plugin will reject any user with a non-gmail account. Maybe you should check with a list of valid email domains, i'm sure you can find one easily on google.

    Actually I think this is a bad idea. Because anyone can run their own mailserver.

    Just check if the email contains an @ is enough for valid email testing. Most regex solutions will fail on stuff like:

    "this email contains spaces"@example.org which is a valid email address. An email address may even contain a @ character in the local part in some odd configurations.

  • Visual plugins

    NodeBB Plugins
    1 Votes
    4 Posts

    @julian thanks 😉

  • 5 Votes
    78 Posts

    @julian Is it possible to display the search icon in the mobile menu in the sticky title menu, as in all top platforms?