Hi!
I'm developing a plugin that allows a user to ignore others and hide his posts in every topic. That part is done, now I want to create a new page to display the list of ignored users in the profile. I've done this:
app.get('/user/:userslug/ignored', params.middleware.buildHeader, controllers.accounts.getIgnored);
app.get('/api/user/:userslug/ignored', controllers.accounts.getIgnored);
Where .getIgnored
equals:
controllers.accounts.getIgnored = function (req, res, next) {
if (!req.user) {
return helpers.notAllowed(req, res);
}
/* Retrieve the ignored users from DB... */
res.render('account/ignored', {
userslug: req.params.userslug,
ignored: users
});
}
Ok. Now, if I go to the URL /user/admin/ignored
it displays my template and my ignored users perfectly. So far, so good. The problem comes when I try to access that new page from a link (i.e. the profile dropdown), then the redirect doesn't work. I've figured out that the problem is I defined the routing on server-side but not on client-side, so... ¿How can I get that? Basing on the homepage plugin I suppose that I have to change the client routing by using the hook filter:templates.get_config
and add this:
Plugin.changeClientRouting = function (config, callback) {
config.custom_mapping['^user/.*/ignored'] = 'account/ignored';
callback(null, config);
};
But it doesn't seem to work.
¿Any help?
Thank you