Please open an issue on our github tracker, I am not sure if we should just remove the saving to user settings in the sort dropdown all together and move the sort settings to /user/<slug>/settings like everything else. Then you can change the sort order in every topic without effecting your settings. The setting used in the user page would be the default sort when you enter a topic.
Key-value tags for topics or posts
-
I'm just getting started with nodeBB. I would really like to associate key-value pairs with topics. That is, I want to be able to tag a topic with things like "priority: low" or "prog_lang: julia". The only thing I found so far is https://community.nodebb.org/topic/1858/embedded-metadata-for-posts-and-other-objects.
Any thoughts about the feasibility of this would be appreciated.
-
Store the values in a database hash. Call it
topic:{tid}:yourplugin
, where {tid} is the topic id.The hash is a key-value store, so you would do,
db.setObjectField('topic:{tid}:yourplugin', 'priority', 'low')
to set a value. You do not need to define the object ahead of time.
Now you probably want to add that data to the template vars so it can be displayed to the user, so hook into
filter:topic.build
and add the values.plugin.topicBuild = function(data, next) { db.getObject('topic:' + data.templateData.tid + ':yourplugin', function (err, yourdata){ if (err) console.log(err) if (err || !yourdata) return next(null, data) // Add your key-values to the template data. data.templateData.yourplugin = yourdata next(null, data) }) }
Now you will be able to see the data in your template using, e.g.
{yourplugin.priority}
-
Oh, just realized you posted this in feature requests. This is more of a plugin thing. No way to do this in core.
-