@pichalite thank to your suggest it works I have only topics that aren't "Pin". If I do this:
0_1470823097376_pinTopic.png
The topics show in this way:
0_1470823128648_Schermata del 2016-08-10 11:45:59.png
In the image I can see that "primo creato " topic that I have PIN it's the last but I want to become the first.
I want that when I PIN a topic, this must be the first among the topics (now it is the last).
In plugin.json I put this hook:
{
"hook": "filter:category.topics.prepare", "method": "ordina_zero"
}
and in library I do this:
converter.ordina_zero = function(data, callback) {
//Prendo quale element del sorted ha cliccato
user.getSettings(data['uid'], function(err, settings) {
if (settings.categoryTopicSort === 'zero') {
data.reverse = false;
data.set = 'cid:' + data.cid + ':tids:posts';
}
callback(null, data);
});
};
My purpose is show the PIN topic at the beginning and after show the topics with their order. Can you help me?