with credit system,
smile
Is it possibile create a topic automatically in the future with a timestamp ? Anyone can help me?
Yes, you can pass a timestamp in the future to the topics.post
method.
@baris I suppose that I'm wroing something because the topic is not created in the future. In my plugin.json I use this hook:
{ "hook": "action:topic.save", "method": "modificaPost" }
In my library.js I do this:
converter.modificaPost = function(data, callback) {
console.log("DATA " + JSON.stringify(data));
//I Take the timestamp from database and you can suppose that it is correct because I check ten times.
async.waterfall([
function(next) {
//take the timestamp relative to user
db.getObject(hash + ":uid:" + data.uid, next);
},
function(timestamp, next) {
var timestamp_nuovo = timestamp.timestamp;
data.timestamp = timestamp.timestamp;
Topics.post(data, next);
}
], function(err) {
if (err) {
//return callback(err);
}
console.log("DATA NUOVA " + JSON.stringify(data));
return callback(null, data);
});
};
Anyone can help me?
@Doppy action:topic.save
is triggered after the topic is created. You will want to listen to filter:topic.create
and change the timestamp in the data passed to the hook.