• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Composer default category

Scheduled Pinned Locked Moved Plugin Development
composer
8 Posts 2 Posters 626 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Sebastián CisnerosS Offline
    Sebastián CisnerosS Offline
    Sebastián Cisneros Gamers
    wrote on last edited by Sebastián Cisneros
    #1

    I need a way to setup a default category when you open the composer.

    The same way nodebb already does it when you are in a category page, and hit the "new topic" button, but all over the nodebb app.

    for example, on the home / landing page (that is loading the categories.tpl) I need to setup 1 category as default and already preselcted when you open the composer.

    Im actually not using categories, so, I need to avoid the error of empty category when you post a new topic.

    Any ideas? Thanks.

    Sebastián CisnerosS 1 Reply Last reply
    0
  • Sebastián CisnerosS Offline
    Sebastián CisnerosS Offline
    Sebastián Cisneros Gamers
    replied to Sebastián Cisneros on last edited by
    #2

    @sebastián-cisneros no answer for this one?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #3

    This took a while to reply because there was a bug in composer-default that needed fixing.

    If you update to [email protected] then you can use the below javascript code in your custom javascript tab to force topics into a default category.

    require(['hooks'], function (hooks) {
    	app.newTopic = function (cid, tags) {
    		const defaultCid = 2;
    		hooks.fire('action:composer.topic.new', {
    			cid: cid || ajaxify.data.cid || defaultCid || 0,
    			tags: tags || (ajaxify.data.tag ? [ajaxify.data.tag] : []),
    		});    
    	};
    });
    

    Replace defaultCid with your prefered category id.

    Sebastián CisnerosS 1 Reply Last reply
    2
  • Sebastián CisnerosS Offline
    Sebastián CisnerosS Offline
    Sebastián Cisneros Gamers
    replied to <baris> on last edited by
    #4

    @baris Thanks for the reply. Will this actually work if I'm using composer redactor?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #5

    It should still work. Redactor still uses some files from default-composer.

    Sebastián CisnerosS 1 Reply Last reply
    0
  • Sebastián CisnerosS Offline
    Sebastián CisnerosS Offline
    Sebastián Cisneros Gamers
    replied to <baris> on last edited by
    #6

    @baris It worked, but... there is one more thing about it.
    I have set some Tag Whitelist in that default category, and the tags select dropdown should appear also by default (related to the default category), but it doesn't

    b247a0e0-1304-4d82-ba10-96518fab4d4f-image.png

    is there a way to get this done?

    Again thanks for all the help, you are Awesome!.

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #7

    Please try with [email protected]

    Sebastián CisnerosS 1 Reply Last reply
    1
  • Sebastián CisnerosS Offline
    Sebastián CisnerosS Offline
    Sebastián Cisneros Gamers
    replied to <baris> on last edited by
    #8

    @baris Thanks! I got one more question about the composer, but I will post in a different topic.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development