This will be available in 1.18.4 https://github.com/NodeBB/NodeBB/issues/9845
How to get category info in "filter:config.get" hook?
noob111 Anime Lovers
Hi, I have following:
My purpose is to use my own sort method for sorting topics in a category, automatically modifying visible "Sort By" html element with a special sorting method that I implemented, and make it selected automatically.
I tried many hooks but "filter:config.get" was only one that is called before rendering or sending anything to client side. Other hooks such as "filter:categories.buildTopicsSortedSet", "filter:categories.getSortedSetRangeDirection","filter:category.topics.prepare", they all didn't work.
For example, if I changed like following in a method for "filter:categories.buildTopicsSortedSet":
data.settings.categoryTopicSort = 'most_myown';
but in client side, it only shows the previous value of "data.settings.categoryTopicSort", not the value "most_myown".
So I had to use "filter:config.get" because changing config there actually reflects to client side.
To implement it, I first need to check information about category that the user just entered, and append it to config, and send it to client. They are supposed to be done in "configGet" method, which you see above. But I do not know how to get information about category that the user is in. I need to know about category info because my own sorting will only work for certain categories.
Thank you very much.