How to add custom "New Topic" button?

Technical Support
  • i want to add new topic button in may navigation bar. how can i do it?

  • Add an ID of 'newtopic' to a custom route, set the route to '#'

    And you will need to add some js, in the custom header section.

        $('body').on('click', '#newtopic', function () {
    		var cid =;
    		if (cid) {
    			$(window).trigger('', {
    				cid: cid
    		} else {
    			socket.emit('categories.getCategoriesByPrivilege', 'topics:create', function(err, categories) {
    				if (err) {
    					return app.alertError(err.message);
    				categories = categories.filter(function(category) {
    					return ! && !parseInt(category.parentCid, 10);
    				if (categories.length) {
    					$(window).trigger('', {
    						cid: categories[0].cid

    That's the same function that's in app.js

    Really, there should be an app.newTopic() that you can call anywhere. Then it would just be
    $(function(){$('body').on('click', '#newtopic', app.newTopic);};

    Could even be one of the available core routes.

  • This pr makes it a lot easier.

  • This post is deleted!

Suggested Topics